From 78620bda34a37fa2b0b82d82b5dc0f33eefa6730 Mon Sep 17 00:00:00 2001 From: Frank Hinek Date: Thu, 15 Feb 2024 09:46:43 -0500 Subject: [PATCH] Update JWK Verification Method Schema to support `JsonWebKey` (#689) 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](https://github.com/TBD54566975/web5-spec/issues/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 --- json-schemas/jwk-verification-method.json | 5 ++++- .../json-schemas/jwk-verification-method.spec.ts | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/json-schemas/jwk-verification-method.json b/json-schemas/jwk-verification-method.json index d18353b33..25d41c947 100644 --- a/json-schemas/jwk-verification-method.json +++ b/json-schemas/jwk-verification-method.json @@ -14,7 +14,10 @@ "type": "string" }, "type": { - "const": "JsonWebKey2020" + "enum": [ + "JsonWebKey", + "JsonWebKey2020" + ] }, "controller": { "$ref": "https://identity.foundation/dwn/json-schemas/defs.json#/definitions/did" diff --git a/tests/validation/json-schemas/jwk-verification-method.spec.ts b/tests/validation/json-schemas/jwk-verification-method.spec.ts index cfa074386..70a0add4e 100644 --- a/tests/validation/json-schemas/jwk-verification-method.spec.ts +++ b/tests/validation/json-schemas/jwk-verification-method.spec.ts @@ -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', {