Open oed opened 1 year ago
DID URLs are a thing that exist-- they haven't gotten too much play in did v1 but i think some people are starting to use them in prod these days, such as the cheqd.io guys who are currently exploring and specifying using DID URLs to address immutable and in some cases content-addressed resources needed for some fancy VC use cases in the VCs themselves...
A DID URL combines all the chaos of a URN (the did part) with all the chaos of a URL (after the ? or #) so supporting them may take a little creativity on the processing. I like Joel's approach of prefixing the easy-to-parse, ?/#-free dids like did:key
and did:pkh
but also preserving a prefix for the "long-form"/uncompact/troublesome/potentially parameterized hell-DIDs that might need to be supported some day by less efficient systems :D
Sidenote, the easiest way to get answers about DID URLs if you have questions is to ask markus sabadello, @ / peacekeeper, he is lead editor on the DID Resolution spec (which includes all the parsing rules for ? and # params) and, coincidentally, also co-editor of the dnslink spec, active everywhere, very good dood and generous with his time on such matters.
New proposal that takes DID URLs into consideration. All DIDs are represented as:
0xd1d | <varint-url-length> | <method-specific-code> | <method-id-bytes> | <utf8-url-bytes>
Where:
varint-url-length
is the length of the url component of the DIDmethod-specific-code
- multicode that uniquely identifies the DID methodmethod-id-bytes
- the DID identiferutf8-url-bytes
- the utf-8 bytes of the url component of the DID URL component (can be empty if varint-url-length
is zero)Examples:
// did:key - secp256k1
0xd1d | 0x00 | 0xe7 | <pubkey-bytes>
// did:key - ed25519
0xd1d | 0x00 | 0xed | <pubkey-bytes>
// did:pkh
0xd1d | 0x00 | 0xca | <caip50-bytes>
// did:* - we use raw multicodec to indicate
0xd1d | 0x00 | 0x00 | <utf8-bytes>
A nice thing about this approach is that all DIDs will be prefixed by 0xd1d
nothing like looking into the binary for clues and seeing a D1D pop out right near the front 🤣
TBH I'm kind of a binary ignoramus and defer to people with binary buidling/sniffing/needing experience but at least from my safe perch miles above the binary it seems elegant?
Following up from https://github.com/ucan-wg/ucan-cacao/issues/2:
Currently Prinicipal is defined as follows:
A few observations:
did:key
special treatment here. Ideally I'd like a completely self describing byte level description formats for DIDs that can be used anywhereI would suggest we do something like this:
did:*
:0xd1d
followed by utf8 encoded string as suggested abovedid:key
:0xd1e
followed by public key multicodec + raw public key bytesdid:pkh
:0xd1f
followed by ...something...This would allow us to have a generalizable approach to representing a DID as a bytestring.
Note however that ideally we'd also include a generalizable way to represent an entire DID URL