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
| Field | Type | Description |
|---|---|---|
v | number | Envelope version (currently 2) |
mime | string | Original MIME type of the plaintext content |
access | string? | URL where a view key can be purchased via x402 |
r | array | Recipient stanzas — one per authorized decryptor |
r[].c | number | Curve ID: 1 = secp256k1, 2 = X25519 |
r[].pub | bytes | Recipient's compressed public key |
r[].epk | bytes | Ephemeral public key used in ECDH key agreement |
r[].w | bytes | Wrapped AES-256 key (12B nonce + 32B ciphertext + 16B GCM tag) |
r[].id | string? | Recipient's CAIP-10 address |
ct | bytes | AES-256-GCM encrypted content (12B nonce + ciphertext + 16B tag) |
Why CBOR?
- Self-describing — parseable decades later without external schema
- Binary-native —
Uint8Arrayvalues 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