Skip to content

Commit

Permalink
Update JWK Verification Method Schema to support JsonWebKey (#689)
Browse files Browse the repository at this point in the history
This PR will:
- Update the JWK verification method schema to support `JsonWebKey` in
addition to `JsonWebKey2020`.

### Context

- All Web5 SDKs use `JsonWebKey` when creating DHT DIDs
- `JsonWebKey` used by the [DID DHT method
specification](https://did-dht.com/#representing-keys)
- Eventually all Web5 SDKs will use `JsonWebKey` for DIDs per [this open
issue](decentralized-identity/web5-spec#73).

> JsonWebKey2020 is deprecated, as it was published as a part of a
now-defunct [CCG draft
here](https://www.w3.org/community/reports/credentials/CG-FINAL-lds-jws2020-20220721/).
It has been replaced with the recommendation-track JsonWebKey defined in
[vc-jose-cose](https://w3c.github.io/vc-jose-cose/).

---------

Signed-off-by: Frank Hinek <[email protected]>
  • Loading branch information
frankhinek authored Feb 15, 2024
1 parent ab08dfd commit 78620bd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion json-schemas/jwk-verification-method.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
"type": "string"
},
"type": {
"const": "JsonWebKey2020"
"enum": [
"JsonWebKey",
"JsonWebKey2020"
]
},
"controller": {
"$ref": "https://identity.foundation/dwn/json-schemas/defs.json#/definitions/did"
Expand Down
11 changes: 11 additions & 0 deletions tests/validation/json-schemas/jwk-verification-method.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ describe('JwkVerificationMethod', async () => {
).to.not.throw();
});

it('should not throw an exception if verificationMethod uses \'JsonWebKey\' type', () => {
expect(
() => validateJsonSchema('JwkVerificationMethod', {
id : 'did:jank:alice#key1',
type : 'JsonWebKey',
controller : 'did:jank:alice',
publicKeyJwk : publicJwk
})
).to.not.throw();
});

it('should not throw if `id` does not have the DID as prefix', () => {
expect(
() => validateJsonSchema('JwkVerificationMethod', {
Expand Down

0 comments on commit 78620bd

Please sign in to comment.