Crypto: keys, blobs and codecs
Map of src/crypto: key derivation, signed Seed blobs, request envelopes, the vault codec, the vendored CBOR and gzip bundle, and the parity vectors that pin all of it to the original client.

src/crypto is Seed Exact's own port of the Seed client's cryptography. The app has no daemon and does not import @seed-hypermedia/client, so every signed byte it publishes is produced here, in pure JavaScript that runs inside the data module runtime. The module has no ambient clock and no Node dependency: time and (for tests) randomness are arguments.

Responsibility

    Derive keys from recovery phrases and encode account ids.

    Build and sign the blobs the app publishes: Changes, version Refs, Comments, profile updates.

    Sign request envelopes for the notify service and the agents server.

    Encrypt, serialize and parse vault state in the Go daemon's exact format.

    Prove byte equality with the original client through generated vectors.

Files

File

Role

Page

primitives.ts

BIP-39, SLIP-10, Ed25519, principals, base64, HKDF, XChaCha20-Poly1305, UUID, timestamps

Primitives

seedkey.ts

Desktop .seedkey export and import

Primitives

blob.ts, signing.ts, signer.ts

CIDs, the zero-signature convention, signer shapes

Blobs

change.ts, ref.ts, comment.ts, profile.ts

The four signed blob builders

Blobs

types.ts, unicode.ts

Block and id types, packHmId, annotation overlap check

Blobs

envelopes.ts

Agents and notify request envelopes

Envelopes

envelope.ts, vault.ts, state-codec.ts

Vault file envelope, sealing, state codec

Vault codec

cbor.ts, vendor/

Generated CBOR and gzip bundle

Vendored codecs

sources.ts, __tests__/, tools/crypto-vectors/

Runtime self-test, vectors, generator

Parity vectors

index.ts

Public surface, plus signerFromKeyPair

Blobs

How the pieces relate

flowchart TB V["vendor/codecs.js: encode, strictEncode, decode, gzip"] --> B[blob.ts and signing.ts] P[primitives.ts] --> B B --> CH[change.ts] B --> RF[ref.ts] B --> CM[comment.ts] CH --> PR[profile.ts] RF --> PR B --> EN[envelopes.ts] V --> SC[state-codec.ts] P --> VA[vault.ts] SC --> VA EV[envelope.ts] --> VA FX["fixtures/rn-client.json"] -. checks .-> CH FX -. checks .-> CM FX -. checks .-> SC FX -. checks .-> EN

Who uses it

Consumer

What it imports

Identity

Mnemonic and key pair functions through src/identity/crypto-impl.ts

Discuss: loading and posting

createComment, commentRecordIdFromBlob

Profile

createProfilePublishBlobs, yieldCryptoTurn

Activity: notify client

createNotifyEnvelope

Agents: signed action envelope

cbor.ts and primitives.ts directly

Vault

AEAD, base64, state codec, envelope codec

Dependency versions are listed in Dependencies. Anything in this module that loops over crypto operations must respect the 100 ms turn budget.

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime

Comments