A very compact representation of DIDs and DID URLs
Multidid is a representation strategy for DIDs and DID URLs that is very compact and extensible. It allows any DID method to be represented as a string of bytes.
<multidid-code><method-code><method-bytes><url-length><url-bytes>
Where:
multidid-code
- the value0x0d1d
encoded as a multiformats varintmethod-code
- a varint encoded multicode for the DID Method identifiermethod-bytes
- data representing the method-idurl-length
- a varint describing the length of theurl-bytes
parameterurl-bytes
- a UTF-8 encoded string representing the DID URL parameters
By default, DIDs from any DID method can be represented by using the 0x55
code
(representing "raw" data) as the method-code
, which allows the url-bytes
to
contain an entire DID URL, including arbitrary method identifier, paths, query
parameters, etc. To take advantage of a more optimized representation, specific
DID methods can claim entries in the method-code
table by submitting a
specification to the methods
folder in this repository which claims a prefix
in the multicodec table,
and adding it to the method table below.
The main constraint on all specific method-multicodec
s is that for a given
code, the length of the method specific identifier, the method-bytes
, MUST be
known. Otherwise it would be impossible to know when to start parsing the
url-bytes
.
Code | Method |
---|---|
0x55 | did:* |
0xe7, 0xeb, 0xec, 0xed, 0x1200, 0x1201, 0x1202, 0x1205 | did:key |
0xca | did:pkh |