Expand description
Agent card — DID-anchored identity for a wire endpoint.
An agent card binds:
- a handle (
paul) - to a DID (
did:wire:paul) - to one or more Ed25519 verify keys
- with a signature from the canonical key
Bilateral pairing produces a 6-digit Short Authentication String (SAS) by HMAC’ing the two sorted public keys. Both peers compute the same digits independently from their own knowledge of both keys; the operator reads them aloud out-of-band (the magic-wormhole flow) to confirm.
Enums§
Constants§
Functions§
- bare_
handle - Strip the federation suffix (
@relay.example) from a handle, returning the bare local-part. This is the canonical on-disk form: outbox/inbox files are keyed by bare handle (paul-mac.jsonl), and the pinned-peers map inrelay_state.jsonis keyed by bare handle. - build_
agent_ card - Build an unsigned agent card for
handlewith one verify key. - card_
canonical - Canonical bytes of an agent card — strips
signaturebefore serialization. - compute_
sas - 6-digit bilateral SAS over two raw 32-byte public keys.
- did_for
- Legacy DID constructor — DID =
did:wire:<handle>with no pubkey suffix. Pre-v0.5.7 model. Kept for backward-compat in code paths that don’t have the pubkey on hand (display helpers, test fixtures) and for tests that pin specific DID strings. NEW callers should usedid_for_with_key. - did_
for_ with_ key - Build a DID from
handle+public_key. Returnsdid:wire:<handle>-<8-hex-of-sha256(public_key)>. The pubkey suffix makes the DID uniquely tied to the keypair — two operators picking the same handle (e.g., both auto-init’ing as<hostname>on the same hostname) get distinct DIDs. - display_
handle_ from_ did - Extract the display-friendly handle from a DID. Handles both legacy
(
did:wire:paul) and v0.5.7+ (did:wire:paul-abc12345) forms. The v0.5.7 trailing-<8-hex>suffix is stripped when present. - sign_
agent_ card - Sign an agent card with
private_key. Returns the card withsignaturefield appended (base64 of Ed25519 signature overcard_canonical(card)). - verify_
agent_ card - Verify a signed card. Picks the first verify_key, validates the
signature over
card_canonical(card)(stripped ofsignature).
Type Aliases§
- Agent
Card - Convenience type — at this stage we use serde_json::Value so the wire shape stays explicit. A typed struct can come in v0.2+.