# net.anisota.chronicle.achievement

> Published by [anisota.net](https://lexicon.garden/identity/did:plc:lcieujcfkv4jx7gehsvok3pr)

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:lcieujcfkv4jx7gehsvok3pr/net.anisota.chronicle.achievement)
- [Documentation](https://lexicon.garden/lexicon/did:plc:lcieujcfkv4jx7gehsvok3pr/net.anisota.chronicle.achievement/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:lcieujcfkv4jx7gehsvok3pr/net.anisota.chronicle.achievement/examples)

## Definitions

### `net.anisota.chronicle.achievement`

**Type**: `record`

Consolidated achievement record. Replaces 30 beta achievement lexicons. rkey is the achievement ID (e.g. followers2500, level50). Created once with createRecord when achievement is unlocked. Immutable.

**Key**: `any`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `name` | `string` | No | Display name of the achievement |
| `tier` | `integer` | No | Tier or milestone value (e.g. 2500 for followers2500) |
| `rarity` | `string` | No | Rarity tier of the achievement |
| `context` | `ref` → `#achievementContext` | No |  |
| `category` | `string` | Yes | Category of the achievement |
| `xpReward` | `integer` | No | XP awarded for this achievement |
| `createdAt` | `string` (datetime) | Yes | When the achievement record was created |
| `signature` | `ref` → `#chronicleSignature` | Yes |  |
| `unlockedAt` | `string` (datetime) | Yes | When the achievement was unlocked |
| `description` | `string` | No | Description of what was accomplished |
| `achievementId` | `string` | Yes | Unique identifier for the achievement (e.g. 'followers2500', 'level50') |
| `dailyRecordRef` | `string` | No | AT URI of the daily record when the achievement was unlocked |

### `net.anisota.chronicle.achievement#achievementContext`

**Type**: `object`

Contextual data at the time of achievement unlock

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `level` | `integer` | No | Player level when achievement was unlocked |
| `totalXP` | `integer` | No | Total XP when achievement was unlocked |
| `postCount` | `integer` | No | Post count when achievement was unlocked |
| `followerCount` | `integer` | No | Follower count when achievement was unlocked |
| `specimenCount` | `integer` | No | Specimen count when achievement was unlocked |

### `net.anisota.chronicle.achievement#chronicleSignature`

**Type**: `object`

ES256 cryptographic signature proving record authenticity. The signature itself proves legitimacy - no separate verification lexicons needed.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `alg` | `string` | Yes | Signing algorithm (ES256) |
| `kid` | `string` | Yes | Key identifier for the signing key |
| `sig` | `string` | Yes | Base64-encoded ES256 signature |
| `nonce` | `string` | Yes | Unique random nonce to prevent replay |
| `version` | `integer` | Yes | Signature schema version |
| `signedAt` | `string` (datetime) | Yes | When the record was signed |

## Raw Schema

```json
{
  "id": "net.anisota.chronicle.achievement",
  "defs": {
    "main": {
      "key": "any",
      "type": "record",
      "record": {
        "type": "object",
        "required": [
          "achievementId",
          "category",
          "unlockedAt",
          "signature",
          "createdAt"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100,
            "description": "Display name of the achievement"
          },
          "tier": {
            "type": "integer",
            "minimum": 0,
            "description": "Tier or milestone value (e.g. 2500 for followers2500)"
          },
          "rarity": {
            "enum": [
              "common",
              "uncommon",
              "rare",
              "epic",
              "legendary"
            ],
            "type": "string",
            "description": "Rarity tier of the achievement"
          },
          "context": {
            "ref": "#achievementContext",
            "type": "ref"
          },
          "category": {
            "enum": [
              "followers",
              "level",
              "social",
              "collection",
              "patterns",
              "special",
              "expedition"
            ],
            "type": "string",
            "description": "Category of the achievement"
          },
          "xpReward": {
            "type": "integer",
            "minimum": 0,
            "description": "XP awarded for this achievement"
          },
          "createdAt": {
            "type": "string",
            "format": "datetime",
            "description": "When the achievement record was created"
          },
          "signature": {
            "ref": "#chronicleSignature",
            "type": "ref"
          },
          "unlockedAt": {
            "type": "string",
            "format": "datetime",
            "description": "When the achievement was unlocked"
          },
          "description": {
            "type": "string",
            "maxLength": 500,
            "description": "Description of what was accomplished"
          },
          "achievementId": {
            "type": "string",
            "maxLength": 100,
            "description": "Unique identifier for the achievement (e.g. 'followers2500', 'level50')"
          },
          "dailyRecordRef": {
            "type": "string",
            "description": "AT URI of the daily record when the achievement was unlocked"
          }
        }
      },
      "description": "Consolidated achievement record. Replaces 30 beta achievement lexicons. rkey is the achievement ID (e.g. followers2500, level50). Created once with createRecord when achievement is unlocked. Immutable."
    },
    "achievementContext": {
      "type": "object",
      "properties": {
        "level": {
          "type": "integer",
          "minimum": 1,
          "description": "Player level when achievement was unlocked"
        },
        "totalXP": {
          "type": "integer",
          "minimum": 0,
          "description": "Total XP when achievement was unlocked"
        },
        "postCount": {
          "type": "integer",
          "minimum": 0,
          "description": "Post count when achievement was unlocked"
        },
        "followerCount": {
          "type": "integer",
          "minimum": 0,
          "description": "Follower count when achievement was unlocked"
        },
        "specimenCount": {
          "type": "integer",
          "minimum": 0,
          "description": "Specimen count when achievement was unlocked"
        }
      },
      "description": "Contextual data at the time of achievement unlock"
    },
    "chronicleSignature": {
      "type": "object",
      "required": [
        "sig",
        "alg",
        "kid",
        "signedAt",
        "nonce",
        "version"
      ],
      "properties": {
        "alg": {
          "type": "string",
          "description": "Signing algorithm (ES256)"
        },
        "kid": {
          "type": "string",
          "description": "Key identifier for the signing key"
        },
        "sig": {
          "type": "string",
          "description": "Base64-encoded ES256 signature"
        },
        "nonce": {
          "type": "string",
          "description": "Unique random nonce to prevent replay"
        },
        "version": {
          "type": "integer",
          "description": "Signature schema version"
        },
        "signedAt": {
          "type": "string",
          "format": "datetime",
          "description": "When the record was signed"
        }
      },
      "description": "ES256 cryptographic signature proving record authenticity. The signature itself proves legitimacy - no separate verification lexicons needed."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
