Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Envelope Format

Objekt encrypted envelopes use CBOR (RFC 8949) with a registered tag for instant detection.

Detection

Every envelope starts with a 9-byte CBOR tag prefix:

0xDB 0x00 0x00 0x6F 0x62 0x6A 0x65 0x6B 0x74
 ^tag(8-byte)  ^---------- "objekt" ----------^

This encodes CBOR tag 122,511,826,820,980 — the ASCII bytes of "objekt" as a 48-bit integer. Any standard CBOR decoder reads this as Tag(122511826820980, <map>).

Detection is a 9-byte prefix check — no CBOR decoding needed:

import { isEncrypted } from "@objekt.sh/ecies";
 
if (isEncrypted(data)) {
  // It's an Objekt encrypted envelope
}

Structure

Tag(122511826820980) {
  v: 2,                          // Version
  mime: "image/png",             // Original content MIME type
  access: "reveal.objekt.sh/1a35e1.eth/phone",  // x402 reveal URL (optional)
  r: [                           // Recipient stanzas
    {
      c: 1,                      // CurveId (1 = secp256k1, 2 = X25519)
      pub: Uint8Array(33),       // Recipient compressed public key
      epk: Uint8Array(33),       // Ephemeral public key (ECDH)
      w: Uint8Array(60),         // Wrapped AES key (nonce + ciphertext + GCM tag)
      id: "eip155:1:0xabc...",   // CAIP-10 address (optional)
    },
  ],
  ct: Uint8Array,                // Content ciphertext (nonce + encrypted + GCM tag)
}

Fields

FieldTypeDescription
vnumberEnvelope version (currently 2)
mimestringOriginal MIME type of the plaintext content
accessstring?URL where a view key can be purchased via x402
rarrayRecipient stanzas — one per authorized decryptor
r[].cnumberCurve ID: 1 = secp256k1, 2 = X25519
r[].pubbytesRecipient's compressed public key
r[].epkbytesEphemeral public key used in ECDH key agreement
r[].wbytesWrapped AES-256 key (12B nonce + 32B ciphertext + 16B GCM tag)
r[].idstring?Recipient's CAIP-10 address
ctbytesAES-256-GCM encrypted content (12B nonce + ciphertext + 16B tag)

Why CBOR?

  • Self-describing — parseable decades later without external schema
  • Binary-nativeUint8Array values encode directly (no base64 overhead)
  • Extensible — add fields without breaking old parsers
  • IPFS-native — CBOR is the encoding used by IPLD, the data model behind IPFS
  • Compact — smaller than JSON, smaller than the previous hand-rolled binary format
  • Tagged — CBOR tags are specifically designed for format identification