Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using PortableDid to import did to sign VC, removing kid as default value #130

Merged
merged 14 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions test-vectors/credentials/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
82 changes: 60 additions & 22 deletions test-vectors/credentials/create.json
Original file line number Diff line number Diff line change
Expand Up @@ -552,16 +552,35 @@
{
"description": "creates a verifiable credential as a jwt with a did:key",
"input": {
"signerDidUri": "did:key:zQ3shNLt1aMWPbWRGa8VoeEbJofJ7xJe4FCPpDKxq1NZygpiy",
"signerPrivateJwk": {
"kty": "EC",
"d": "OeBCt3M8roz9F9Ny192TtZXf_-qPzAkwSM6ep7QdSO4",
"use": "sig",
"crv": "secp256k1",
"kid": "NB_qlUIr06-AikVVMFreq0lc-omQtzc6lwhhcvgO6r4",
"x": "DdtN8W6x_34pB_nkxR0e1tmDkNnsJeusBAEPzKWgf_Y",
"y": "u3W135inodLqtcEb9jNGS3JsM_uFKmkJSb8Trc9luWI",
"alg": "ES256K"
"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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it too much to ask to use a did:jwk instead? since we deprecated did:key

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test vector specifically tests for creating a VC as a jwt with a did:key so i'd like to keep it here :)

"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_piHAI6OrFAnZuEsTwMUPCT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
"output": "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZDI1NTE5Iiwia2lkIjoiZGlkOmtleTp6Nk1rZlVoanNaVUpremlvR0RVTHBjcXhYRlNOczZNY01KbzMxdHhZbkVhcW45ZFkjejZNa2ZVaGpzWlVKa3ppb0dEVUxwY3F4WEZTTnM2TWNNSm8zMXR4WW5FYXFuOWRZIn0.eyJpc3MiOiJkaWQ6a2V5OnpRM3NoTkx0MWFNV1BiV1JHYThWb2VFYkpvZko3eEplNEZDUHBES3hxMU5aeWdwaXkiLCJzdWIiOiJkaWQ6a2V5OnpRM3Noa3BhdmpLUmV3b0JrNmFyUEpuaEE4N1p6aExERVdnVnZaS05ISzZRcVZKREIiLCJpYXQiOjE3MDEzMDI1OTMwMDAsInZjIjp7Imlzc3VhbmNlRGF0ZSI6IjIwMjMtMTEtMzBUMDA6MDM6MTNaIiwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6a2V5OnpRM3Noa3BhdmpLUmV3b0JrNmFyUEpuaEE4N1p6aExERVdnVnZaS05ISzZRcVZKREIiLCJsb2NhbFJlc3BlY3QiOiJoaWdoIiwibGVnaXQiOnRydWV9LCJpZCI6InVybjp1dWlkOjZjOGJiY2Y0LTg3YWYtNDQ5YS05YmZiLTMwYmYyOTk3NjIyNyIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJTdHJlZXRDcmVkIl0sIkBjb250ZXh0IjpbImh0dHBzOi8vd3d3LnczLm9yZy8yMDE4L2NyZWRlbnRpYWxzL3YxIl0sImlzc3VlciI6ImRpZDprZXk6elEzc2hOTHQxYU1XUGJXUkdhOFZvZUViSm9mSjd4SmU0RkNQcERLeHExTlp5Z3BpeSJ9fQ.EReoQz6gHHankRw32vIpwa3WFmw5rm-QedCH2Gca_8jm62UMMGiMpHH-woC_0NUVaKBBtYhfrbDSDWqT4OS4DQ"
},
{
"description": "creates a verifiable credential as a jwt with a did:jwk",
"input": {
"signerDidUri": "did:jwk:eyJrdHkiOiJFQyIsInVzZSI6InNpZyIsImNydiI6InNlY3AyNTZrMSIsImtpZCI6Ik5CX3FsVUlyMDYtQWlrVlZNRnJlcTBsYy1vbVF0emM2bHdoaGN2Z082cjQiLCJ4IjoiRGR0TjhXNnhfMzRwQl9ua3hSMGUxdG1Ea05uc0pldXNCQUVQektXZ2ZfWSIsInkiOiJ1M1cxMzVpbm9kTHF0Y0ViOWpOR1MzSnNNX3VGS21rSlNiOFRyYzlsdVdJIiwiYWxnIjoiRVMyNTZLIn0",
"signerPrivateJwk": {
"kty": "EC",
"d": "OeBCt3M8roz9F9Ny192TtZXf_-qPzAkwSM6ep7QdSO4",
"use": "sig",
"crv": "secp256k1",
"kid": "NB_qlUIr06-AikVVMFreq0lc-omQtzc6lwhhcvgO6r4",
"x": "DdtN8W6x_34pB_nkxR0e1tmDkNnsJeusBAEPzKWgf_Y",
"y": "u3W135inodLqtcEb9jNGS3JsM_uFKmkJSb8Trc9luWI",
"alg": "ES256K"
"uri": "did:jwk:eyJrdHkiOiJPS1AiLCJjcnYiOiJFZDI1NTE5IiwidXNlIjoic2lnIiwiYWxnIjoiRWREU0EiLCJraWQiOiJKUVYzQ0VaQ3BWWnBCWmQ0N0EzLWllTUM1T1BvOHJ5QlQ5cHdLX3NDLUtBIiwieCI6IlUzWXNDNjFJZnBxRjlqUHNRX01UMDBFTTRBQXVHYms0SDN1VVZRczBFelEifQ",
"privateKeys": [
{
"kty": "OKP",
"crv": "Ed25519",
"use": "sig",
"alg": "EdDSA",
"kid": "JQV3CEZCpVZpBZd47A3-ieMC5OPo8ryBT9pwK_sC-KA",
"d": "8L5Y7M4ZNc9Jy5IooJNFaRGatXHZzRRXxGsVidrAsfE",
"x": "U3YsC61IfpqF9jPsQ_MT00EM4AAuGbk4H3uUVQs0EzQ"
}
],
"document": {
"id": "did:jwk:eyJrdHkiOiJPS1AiLCJjcnYiOiJFZDI1NTE5IiwidXNlIjoic2lnIiwiYWxnIjoiRWREU0EiLCJraWQiOiJKUVYzQ0VaQ3BWWnBCWmQ0N0EzLWllTUM1T1BvOHJ5QlQ5cHdLX3NDLUtBIiwieCI6IlUzWXNDNjFJZnBxRjlqUHNRX01UMDBFTTRBQXVHYms0SDN1VVZRczBFelEifQ",
"verificationMethod": [
{
"id": "did:jwk:eyJrdHkiOiJPS1AiLCJjcnYiOiJFZDI1NTE5IiwidXNlIjoic2lnIiwiYWxnIjoiRWREU0EiLCJraWQiOiJKUVYzQ0VaQ3BWWnBCWmQ0N0EzLWllTUM1T1BvOHJ5QlQ5cHdLX3NDLUtBIiwieCI6IlUzWXNDNjFJZnBxRjlqUHNRX01UMDBFTTRBQXVHYms0SDN1VVZRczBFelEifQ#0",
"type": "JsonWebKey",
"controller": "did:jwk:eyJrdHkiOiJPS1AiLCJjcnYiOiJFZDI1NTE5IiwidXNlIjoic2lnIiwiYWxnIjoiRWREU0EiLCJraWQiOiJKUVYzQ0VaQ3BWWnBCWmQ0N0EzLWllTUM1T1BvOHJ5QlQ5cHdLX3NDLUtBIiwieCI6IlUzWXNDNjFJZnBxRjlqUHNRX01UMDBFTTRBQXVHYms0SDN1VVZRczBFelEifQ",
"publicKeyJwk": {
"kty": "OKP",
"crv": "Ed25519",
"use": "sig",
"alg": "EdDSA",
"kid": "JQV3CEZCpVZpBZd47A3-ieMC5OPo8ryBT9pwK_sC-KA",
"x": "U3YsC61IfpqF9jPsQ_MT00EM4AAuGbk4H3uUVQs0EzQ"
}
}
]
},
"credential": {
"@context": [
Expand All @@ -615,7 +653,7 @@
}
}
},
"output": "eyJraWQiOiJkaWQ6andrOmV5SnJkSGtpT2lKRlF5SXNJblZ6WlNJNkluTnBaeUlzSW1OeWRpSTZJbk5sWTNBeU5UWnJNU0lzSW10cFpDSTZJazVDWDNGc1ZVbHlNRFl0UVdsclZsWk5SbkpsY1RCc1l5MXZiVkYwZW1NMmJIZG9hR04yWjA4MmNqUWlMQ0o0SWpvaVJHUjBUamhYTm5oZk16UndRbDl1YTNoU01HVXh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m05a1RIRjBZMFZpT1dwT1IxTXpTbk5OWDNWR1MyMXJTbE5pT0ZSeVl6bHNkVmRKSWl3aVlXeG5Jam9pUlZNeU5UWkxJbjAifX0.AUnEvwXIGA0vnHVU69h0uk4gdEym34LdVjfw_-puj4NkZR427BDLYcLSFlm8PnTLJOJRH3r2XS36mrYjiWBLBg"
}
]
}
18 changes: 6 additions & 12 deletions test-vectors/did_dht/create.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"kty": "OKP",
"crv": "Ed25519",
"x": "YCcHYL2sYNPDlKaALcEmll2HHyT968M4UWbr-9CFGWE",
"alg": "EdDSA",
"kid": "0"
"alg": "EdDSA"
}
},
"output": {
Expand All @@ -23,8 +22,7 @@
"kty": "OKP",
"crv": "Ed25519",
"x": "YCcHYL2sYNPDlKaALcEmll2HHyT968M4UWbr-9CFGWE",
"alg": "EdDSA",
"kid": "0"
"alg": "EdDSA"
}
}
],
Expand All @@ -49,8 +47,7 @@
"kty": "OKP",
"crv": "Ed25519",
"x": "YCcHYL2sYNPDlKaALcEmll2HHyT968M4UWbr-9CFGWE",
"alg": "EdDSA",
"kid": "0"
"alg": "EdDSA"
},
"services": [
{
Expand All @@ -69,8 +66,7 @@
"crv": "secp256k1",
"x": "1_o0IKHGNamet8-3VYNUTiKlhVK-LilcKrhJSPHSNP0",
"y": "qzU8qqh0wKB6JC_9HCu8pHE-ZPkDpw4AdJ-MsV2InVY",
"alg": "ES256K",
"kid": "0GkvkdCGu3DL7Mkv0W1DhTMCBT9-z0CkFqZoJQtw7vw"
"alg": "ES256K"
},
"purposes": [
"assertionMethod",
Expand Down Expand Up @@ -104,8 +100,7 @@
"kty": "OKP",
"crv": "Ed25519",
"x": "YCcHYL2sYNPDlKaALcEmll2HHyT968M4UWbr-9CFGWE",
"alg": "EdDSA",
"kid": "0"
"alg": "EdDSA"
}
},
{
Expand All @@ -117,8 +112,7 @@
"crv": "secp256k1",
"x": "1_o0IKHGNamet8-3VYNUTiKlhVK-LilcKrhJSPHSNP0",
"y": "qzU8qqh0wKB6JC_9HCu8pHE-ZPkDpw4AdJ-MsV2InVY",
"alg": "ES256K",
"kid": "0GkvkdCGu3DL7Mkv0W1DhTMCBT9-z0CkFqZoJQtw7vw"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so what was the rationale for removing these kid's in this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the kid is now not populated by default and computed whenever it is necessary. the test vector (previously using JWK) assumed that it would be populated by default so the test would fail.

same for alg - alg also isn't populated by default, since crv (a required field) is more accurate anyway.

"alg": "ES256K"
}
}
],
Expand Down
167 changes: 167 additions & 0 deletions test-vectors/portable_did/parse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
{
"description": "PortableDid resolution",
"vectors": [
{
"description": "Can be successfully parsed in as PortableDid",
"input": {
"uri": "did:key:z6MkfUhjsZUJkzioGDULpcqxXFSNs6McMJo31txYnEaqn9dY",
KendallWeihe marked this conversation as resolved.
Show resolved Hide resolved
"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
}
]
}
Loading