Module did_key
Expand description
Shared did:key (Ed25519) ⇄ raw-key codec.
This is the single source of truth for the ed25519-pub multicodec
prefix, the base58btc multibase encoding, and DID-URL fragment/query
stripping used to convert between a raw 32-byte Ed25519 public key and its
did:key:z6Mk… / Multikey publicKeyMultibase forms.
It is compiled on all targets (unlike did:web resolution, which is
native-only, and iroh_peer, which is wasm32-only) precisely so the native
did:web admission resolver and the wasm32 iroh_peer browser identity
helpers share one implementation and can never drift (#281/#475).
hyprstream_rpc::did_web re-exports decode_ed25519_multikey,
did_key_to_ed25519, and ed25519_to_did_key for source compatibility with
existing callers.
This module is the single canonical home for the multicodec constants
(MULTICODEC_ED25519_PUB, MULTICODEC_ML_DSA_65_PUB) and the generic
decode_multikey helper (#916); previously these were duplicated in
hyprstream::auth::mesh_trust and hyprstream-rpc’s service_entry.
Constants§
- MULTICODEC_
ED25519_ PUB - Multicodec
ed25519-pubunsigned-varint prefix (0xed01→ bytes0xed 0x01). - MULTICODEC_
ML_ DSA_ 65_ PUB - Multicodec
ml-dsa-65-pubunsigned-varint prefix (0x1211→ bytes0x91 0x24).
Functions§
- decode_
ed25519_ multikey - Decode a
MultikeypublicKeyMultibasestring into raw Ed25519 key bytes. - decode_
multikey - Decode a
MultikeypublicKeyMultibasestring into raw key bytes, verifying the base58btc multibase prefix (z) and the expected multicodec header. - did_
key_ to_ ed25519 - Decode a
did:key(Ed25519) identifier into its raw 32-byte Ed25519 key. - ed25519_
to_ did_ key - Encode a raw 32-byte Ed25519 public key as a
did:key(Ed25519) identifier (did:key:z6Mk…).