Expand description
Encoding and decoding between NDN Names and did:ndn DID strings.
§Encoding
A did:ndn DID is the base64url (no padding) encoding of the complete NDN
Name TLV wire format, including the outer Name-Type and TLV-Length octets.
did:ndn:<base64url(Name TLV)>Every NDN name maps to exactly one DID, and every valid did:ndn DID maps to
exactly one NDN name. The encoding is lossless across all component types
(GenericNameComponent, BLAKE3_DIGEST, ImplicitSha256Digest, versioned
components, etc.) without any type-specific special cases.
§Backward compatibility
Earlier drafts of the spec used two forms that are now deprecated:
- Simple form — colon-joined ASCII component values:
/com/acme/alice→did:ndn:com:acme:alice v1:binary form —did:ndn:v1:<base64url(Name TLV)>
Both forms are still accepted by did_to_name for backward compatibility.
name_to_did no longer produces either deprecated form.
§Ambiguity in the deprecated scheme
The v1: prefix occupied the same position as the first name-component in the
simple form. A name whose first component is literally v1 would produce the
same did:ndn:v1:... string as a binary-encoded name, making round-trip
decoding impossible without external context. The unified binary form has no
such ambiguity.
Functions§
- did_
to_ name - Decode a
did:ndnDID string back to an NDNName. - name_
to_ did - Encode an NDN
Nameas adid:ndnDID string.