{
  "lexicon": 1,
  "id": "at.didcomm.dm",
  "description": "Body schema for an end-to-end-encrypted atcomm direct message. Transport-agnostic: it describes the DECRYPTED JSON body, and any E2EE stack that yields one (v1 carrier: a DIDComm v2 encrypted envelope, message type https://didcomm.at/dm/1.0/message) can carry it. This lexicon is a schema vocabulary ONLY — the message is never stored as a PDS record; infrastructure sees ciphertext only. Field shape mirrors chat.bsky.convo.defs#messageInput so existing atproto clients can render the decrypted body with the rendering code they already have.",
  "defs": {
    "main": {
      "type": "object",
      "required": ["text"],
      "properties": {
        "senderDid": {
          "type": "string",
          "format": "did",
          "description": "The sender's CLAIMED atproto identity (did:plc/did:web). Clients MUST NOT attribute the message to this identity until verified: resolve the DID, fetch its keyPackage record, and check it advertises the did:peer in the DIDComm envelope's `from`. Unverifiable claims render as unknown sender, never as the handle. Enables attribution of first-contact messages (there is no reverse did:peer -> atproto DID lookup)."
        },
        "text": {
          "type": "string",
          "maxLength": 10000,
          "maxGraphemes": 1000,
          "description": "Plain-text message content. The only field a conforming client MUST render."
        },
        "facets": {
          "type": "array",
          "description": "Annotations of substrings in text: links, mentions, at:// references. Optional; clients without facet support render text as-is.",
          "items": { "type": "ref", "ref": "app.bsky.richtext.facet" }
        },
        "embed": {
          "type": "union",
          "description": "Optional embedded reference to a PUBLIC atproto record (e.g. a Bluesky post) — same type chat.bsky.convo DMs embed, so existing render code applies unchanged. The recipient's client hydrates it from the public network; no content travels in the body, so E2EE guarantees are unaffected. Open union: unknown variants MUST be ignored (degrade to text).",
          "refs": ["app.bsky.embed.record"]
        }
      }
    }
  }
}
