From 3688a5dc4cce5f6e587f1c14edfda4403ab99f3b Mon Sep 17 00:00:00 2001 From: Jiyoon Koo Date: Wed, 27 Mar 2024 00:18:15 -0400 Subject: [PATCH] removing metadata key value from vc create.json, updating its readme. also adding portable_did parse.json --- test-vectors/credentials/README.md | 13 ++- test-vectors/credentials/create.json | 2 - test-vectors/portable_did/parse.json | 167 +++++++++++++++++++++++++++ 3 files changed, 174 insertions(+), 8 deletions(-) create mode 100644 test-vectors/portable_did/parse.json diff --git a/test-vectors/credentials/README.md b/test-vectors/credentials/README.md index 290e546..7af4877 100644 --- a/test-vectors/credentials/README.md +++ b/test-vectors/credentials/README.md @@ -12,17 +12,18 @@ Create test vectors are available in the [json file](./create.json), which conta The value of `input` is an object with the following properties. -| Property | Description | -|--------------------|--------------------------------------------------------------------------------------------------------------------------| -| `signerDidUri` | the did uri that will be used to sign the verifiable credential created. | -| `signerPrivateJwk` | Json Web Key object associated with the `signerDidUri` which will be used for signing `credential`. | -| `credential` | A JSON object that represents a Verifiable Credential 1.1 according to the [spec](https://www.w3.org/TR/vc-data-model/). | +| Property | Description | +|---------------|--------------------------------------------------------------------------------------------------------------------------| +| `uri` | the Did uri that will be used to sign the verifiable credential created. | +| `privateKeys` | the private keys that will be used to sign the verifiable credential created. | +| `document` | the DidDocument whose verificationMethod will be used to sign the verifiable credential created. | +| `credential` | A JSON object that represents a Verifiable Credential 1.1 according to the [spec](https://www.w3.org/TR/vc-data-model/). | ### Output The value of `output` is a Verifiable Credential 1.1 encoded as a JSON Web Token ( see [here](https://www.w3.org/TR/vc-data-model/#json-web-token) for more details). The signature is created using -the `signerPrivateJwk` private key. +the `privateKeys` private key. ### Reference implementations diff --git a/test-vectors/credentials/create.json b/test-vectors/credentials/create.json index 7689df2..6968780 100644 --- a/test-vectors/credentials/create.json +++ b/test-vectors/credentials/create.json @@ -582,7 +582,6 @@ } ] }, - "metadata": {}, "credential": { "@context": [ "https://www.w3.org/2018/credentials/v1" @@ -636,7 +635,6 @@ } ] }, - "metadata": {}, "credential": { "@context": [ "https://www.w3.org/2018/credentials/v1" diff --git a/test-vectors/portable_did/parse.json b/test-vectors/portable_did/parse.json new file mode 100644 index 0000000..25441f3 --- /dev/null +++ b/test-vectors/portable_did/parse.json @@ -0,0 +1,167 @@ +{ + "description": "PortableDid resolution", + "vectors": [ + { + "description": "Can be successfully parsed in as PortableDid", + "input": { + "uri": "did:key:z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY", + "privateKeys": [ + { + "kty": "OKP", + "crv": "Ed25519", + "use": "sig", + "alg": "EdDSA", + "kid": "c4IOrQdnehPwQZ6SyNLp9J942VCXrxgWw4zUxAHQXQE", + "d": "txnECNDxFc0gnD303qLJ6VfWJS8DkgpbxVbOkzzp_M4", + "x": "DzpSEyU0w1Myn3lA_piHAI6OrFAnZuEsTwMUPCTwMc8" + } + ], + "document": { + "id": "did:key:z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY", + "verificationMethod": [ + { + "id": "did:key:z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY#z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY", + "type": "JsonWebKey2020", + "controller": "did:key:z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY", + "publicKeyJwk": { + "kty": "OKP", + "crv": "Ed25519", + "use": "sig", + "alg": "EdDSA", + "kid": "c4IOrQdnehPwQZ6SyNLp9J942VCXrxgWw4zUxAHQXQE", + "x": "DzpSEyU0w1Myn3lA_piHAI6OrFAnZuEsTwMUPCTwMc8" + } + } + ] + }, + "metadata": { + "foo": "bar" + } + }, + "errors": false + }, + { + "description": "Bad PortabieDid - missing uri", + "input": { + "privateKeys": [ + { + "kty": "OKP", + "crv": "Ed25519", + "use": "sig", + "alg": "EdDSA", + "kid": "c4IOrQdnehPwQZ6SyNLp9J942VCXrxgWw4zUxAHQXQE", + "d": "txnECNDxFc0gnD303qLJ6VfWJS8DkgpbxVbOkzzp_M4", + "x": "DzpSEyU0w1Myn3lA_piHAI6OrFAnZuEsTwMUPCTwMc8" + } + ], + "document": { + "id": "did:key:z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY", + "verificationMethod": [ + { + "id": "did:key:z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY#z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY", + "type": "JsonWebKey2020", + "controller": "did:key:z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY", + "publicKeyJwk": { + "kty": "OKP", + "crv": "Ed25519", + "use": "sig", + "alg": "EdDSA", + "kid": "c4IOrQdnehPwQZ6SyNLp9J942VCXrxgWw4zUxAHQXQE", + "x": "DzpSEyU0w1Myn3lA_piHAI6OrFAnZuEsTwMUPCTwMc8" + } + } + ] + }, + "metadata": { + "foo": "bar" + } + }, + "errors": true + }, + { + "description": "Bad PortableDid - missing privateKeys", + "input": { + "uri": "did:key:z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY", + "document": { + "id": "did:key:z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY", + "verificationMethod": [ + { + "id": "did:key:z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY#z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY", + "type": "JsonWebKey2020", + "controller": "did:key:z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY", + "publicKeyJwk": { + "kty": "OKP", + "crv": "Ed25519", + "use": "sig", + "alg": "EdDSA", + "kid": "c4IOrQdnehPwQZ6SyNLp9J942VCXrxgWw4zUxAHQXQE", + "x": "DzpSEyU0w1Myn3lA_piHAI6OrFAnZuEsTwMUPCTwMc8" + } + } + ] + }, + "metadata": { + "foo": "bar" + } + }, + "errors": true + }, + { + "description": "Bad PortableDid - missing document", + "input": { + "uri": "did:key:z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY", + "privateKeys": [ + { + "kty": "OKP", + "crv": "Ed25519", + "use": "sig", + "alg": "EdDSA", + "kid": "c4IOrQdnehPwQZ6SyNLp9J942VCXrxgWw4zUxAHQXQE", + "d": "txnECNDxFc0gnD303qLJ6VfWJS8DkgpbxVbOkzzp_M4", + "x": "DzpSEyU0w1Myn3lA_piHAI6OrFAnZuEsTwMUPCTwMc8" + } + ], + "metadata": { + "foo": "bar" + } + }, + "errors": true + }, + { + "description": "Bad PortableDid - missing metadata", + "input": { + "uri": "did:key:z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY", + "privateKeys": [ + { + "kty": "OKP", + "crv": "Ed25519", + "use": "sig", + "alg": "EdDSA", + "kid": "c4IOrQdnehPwQZ6SyNLp9J942VCXrxgWw4zUxAHQXQE", + "d": "txnECNDxFc0gnD303qLJ6VfWJS8DkgpbxVbOkzzp_M4", + "x": "DzpSEyU0w1Myn3lA_piHAI6OrFAnZuEsTwMUPCTwMc8" + } + ], + "document": { + "id": "did:key:z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY", + "verificationMethod": [ + { + "id": "did:key:z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY#z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY", + "type": "JsonWebKey2020", + "controller": "did:key:z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY", + "publicKeyJwk": { + "kty": "OKP", + "crv": "Ed25519", + "use": "sig", + "alg": "EdDSA", + "kid": "c4IOrQdnehPwQZ6SyNLp9J942VCXrxgWw4zUxAHQXQE", + "x": "DzpSEyU0w1Myn3lA_piHAI6OrFAnZuEsTwMUPCTwMc8" + } + } + ] + } + }, + "errors": true + } + ] +} \ No newline at end of file