w3c-ccg / did-method-key

DID (Decentralized Identifier) did:key method for embedding keys in DID urls
https://w3c-ccg.github.io/did-method-key
Other
19 stars 12 forks source link

Support for did param "transform-keys" #16

Closed OR13 closed 3 years ago

OR13 commented 4 years ago

In order to discourage forks / implementations of did:key that are identical in every way but key representation, support for key transformation SHOULD be provided by the did key resolver, and they spec should call this out directly.

https://github.com/decentralized-identity/did-spec-extensions/blob/master/parameters/transform-keys.md

This would allow a did key to produce a JWK directly =>

did:key:z6Mkf5rGMoatrSj1f4CyvuHBeXJELe9RPdzo2PKGNCKVtZxP?transform-keys=jwk

{
    crv: 'Ed25519',
    kid: 'ovsDKYBjFemIy8DVhc-w2LSi8CvXMw2AYDzHj04yxkc',
    kty: 'OKP',
    x: 'CV-aGlld3nVdgnhoZK0D36Wk-9aIMlZjZOK2XhPMnkQ',
    kid: 'did:key:z6Mkf5rGMoatrSj1f4CyvuHBeXJELe9RPdzo2PKGNCKVtZxP#z6Mkf5rGMoatrSj1f4CyvuHBeXJELe9RPdzo2PKGNCKVtZxP'
}

Or a JWKs =>

did:key:z6Mkf5rGMoatrSj1f4CyvuHBeXJELe9RPdzo2PKGNCKVtZxP?transform-keys=jwks

[{
    crv: 'Ed25519',
    kid: 'ovsDKYBjFemIy8DVhc-w2LSi8CvXMw2AYDzHj04yxkc',
    kty: 'OKP',
    x: 'CV-aGlld3nVdgnhoZK0D36Wk-9aIMlZjZOK2XhPMnkQ',
    kid: 'did:key:z6Mkf5rGMoatrSj1f4CyvuHBeXJELe9RPdzo2PKGNCKVtZxP#z6Mkf5rGMoatrSj1f4CyvuHBeXJELe9RPdzo2PKGNCKVtZxP'
},{
    kty: 'OKP',
    crv: 'X25519',
    x: 'pE_mG098rdQjY3MKK2D5SUQ6ZOEW3a6Z6T7Z4SgnzCE',
    kid: ''did:key:z6Mkf5rGMoatrSj1f4CyvuHBeXJELe9RPdzo2PKGNCKVtZxP#z6LSnjagzhe8Df6gZmroW3wjDd7XQLwAuYfwa4ZeTBCGFoYc'',
  }]
OR13 commented 3 years ago

just use did+json to get JWK formatted keys.