git ssb

0+

Spruce git-ssb bridge / ssi



Commit ab332d1438fc53dff107020977d176c12899daf4

Require credentialSubject to be non-empty (#409)

- Require credentialSubject to be non-empty
- Use blank node instead of empty credentialSubject for existing
  RDF-based credential test vectors
- Reissue vc-poly-eip712sig with non-empty credentialSubject
Charles E. Lehner authored on 3/29/2022, 1:25:50 PM
GitHub committed on 3/29/2022, 1:25:50 PM
Parent: 4c30f1a49459aadbce7abc3e7ac6786c257c7d99

Files changed

did-ethr/tests/vc.jsonldchanged
did-pkh/tests/vc-eth-eip712vm.jsonldchanged
did-pkh/tests/vc-eth-epsig.jsonldchanged
did-pkh/tests/vc-poly-eip712sig.jsonldchanged
did-pkh/tests/vc-poly-epsig.jsonldchanged
src/error.rschanged
src/vc.rschanged
tests/lds-aleo2021-vc0.jsonldchanged
did-ethr/tests/vc.jsonldView
@@ -4,9 +4,11 @@
44 ],
55 "type": [
66 "VerifiableCredential"
77 ],
8- "credentialSubject": {},
8 + "credentialSubject": {
9 + "id": "_:1"
10 + },
911 "issuer": "did:ethr:0xdebee5349ba59faa2b9831f108a0f712d8ab26bb",
1012 "issuanceDate": "2021-06-16T21:16:03.362Z",
1113 "proof": {
1214 "@context": [
did-pkh/tests/vc-eth-eip712vm.jsonldView
@@ -4,9 +4,11 @@
44 ],
55 "type": [
66 "VerifiableCredential"
77 ],
8- "credentialSubject": {},
8 + "credentialSubject": {
9 + "id": "_:1"
10 + },
911 "issuer": "did:pkh:eth:0xdebee5349ba59faa2b9831f108a0f712d8ab26bb",
1012 "issuanceDate": "2021-06-16T20:55:45.850Z",
1113 "proof": {
1214 "@context": [
did-pkh/tests/vc-eth-epsig.jsonldView
@@ -4,9 +4,11 @@
44 ],
55 "type": [
66 "VerifiableCredential"
77 ],
8- "credentialSubject": {},
8 + "credentialSubject": {
9 + "id": "_:1"
10 + },
911 "issuer": "did:pkh:eth:0xdebee5349ba59faa2b9831f108a0f712d8ab26bb",
1012 "issuanceDate": "2021-06-15T19:10:36.479Z",
1113 "proof": {
1214 "@context": [
did-pkh/tests/vc-poly-eip712sig.jsonldView
@@ -1,82 +1,89 @@
11 {
22 "@context": [
33 "https://www.w3.org/2018/credentials/v1"
44 ],
5- "credentialSubject": {},
6- "issuanceDate": "2021-06-15T19:10:36.479Z",
7- "issuer": "did:pkh:poly:0x4e90e8a8191c1c23a24a598c3ab4fb47ce926ff5",
5 + "type": [
6 + "VerifiableCredential"
7 + ],
8 + "credentialSubject": {
9 + "id": "did:pkh:eip155:137:0x3a692a1a163657a0f53bc5c9f1d284b3ce2f4941"
10 + },
11 + "issuer": "did:pkh:eip155:137:0x3a692a1a163657a0f53bc5c9f1d284b3ce2f4941",
12 + "issuanceDate": "2022-03-21T20:16:09.281Z",
813 "proof": {
9- "@context": "https://demo.spruceid.com/ld/eip712sig-2021/v0.1.jsonld",
10- "created": "2021-08-11T18:27:11.735Z",
14 + "@context": "https://w3id.org/security/suites/eip712sig-2021/v1",
15 + "type": "EthereumEip712Signature2021",
16 + "proofPurpose": "assertionMethod",
17 + "proofValue": "0x1902d56716f6ef4c79935e0ac85acc6fdf21c4df1711183a037e3b3a0193e5ca149e42764ff7f9990c6b9c2b11f57d5d7f3e48be0fd80d477480d57f959c89c11b",
18 + "verificationMethod": "did:pkh:eip155:137:0x3a692a1a163657a0f53bc5c9f1d284b3ce2f4941#blockchainAccountId",
19 + "created": "2022-03-21T20:16:09.284Z",
1120 "eip712Domain": {
1221 "domain": {
1322 "name": "Polygon Example Credential"
1423 },
15- "messageSchema": {
16- "CredentialSubject": [],
24 + "types": {
25 + "CredentialSubject": [
26 + {
27 + "name": "id",
28 + "type": "string"
29 + }
30 + ],
1731 "EIP712Domain": [
18- {
19- "name": "name",
20- "type": "string"
21- }
32 + {
33 + "name": "name",
34 + "type": "string"
35 + }
2236 ],
2337 "Proof": [
24- {
25- "name": "@context",
26- "type": "string"
27- },
28- {
29- "name": "verificationMethod",
30- "type": "string"
31- },
32- {
33- "name": "created",
34- "type": "string"
35- },
36- {
37- "name": "proofPurpose",
38- "type": "string"
39- },
40- {
41- "name": "type",
42- "type": "string"
43- }
38 + {
39 + "name": "@context",
40 + "type": "string"
41 + },
42 + {
43 + "name": "verificationMethod",
44 + "type": "string"
45 + },
46 + {
47 + "name": "created",
48 + "type": "string"
49 + },
50 + {
51 + "name": "proofPurpose",
52 + "type": "string"
53 + },
54 + {
55 + "name": "type",
56 + "type": "string"
57 + }
4458 ],
4559 "VerifiableCredential": [
46- {
47- "name": "@context",
48- "type": "string[]"
49- },
50- {
51- "name": "type",
52- "type": "string[]"
53- },
54- {
55- "name": "issuer",
56- "type": "string"
57- },
58- {
59- "name": "issuanceDate",
60- "type": "string"
61- },
62- {
63- "name": "credentialSubject",
64- "type": "CredentialSubject"
65- },
66- {
67- "name": "proof",
68- "type": "Proof"
69- }
60 + {
61 + "name": "@context",
62 + "type": "string[]"
63 + },
64 + {
65 + "name": "type",
66 + "type": "string[]"
67 + },
68 + {
69 + "name": "issuer",
70 + "type": "string"
71 + },
72 + {
73 + "name": "issuanceDate",
74 + "type": "string"
75 + },
76 + {
77 + "name": "credentialSubject",
78 + "type": "CredentialSubject"
79 + },
80 + {
81 + "name": "proof",
82 + "type": "Proof"
83 + }
7084 ]
7185 },
7286 "primaryType": "VerifiableCredential"
73- },
74- "proofPurpose": "assertionMethod",
75- "proofValue": "0xfb9a723fea057f3a7bbfde5097b8b6dd2922017a4f46f51c8999d7420ef08a9f138f1bfc2ea6678751d2bb3870ae2b90b0a57149835bb06edc34f1fc863771991c",
76- "type": "EthereumEip712Signature2021",
77- "verificationMethod": "did:pkh:poly:0x4e90e8a8191c1c23a24a598c3ab4fb47ce926ff5#Recovery2020"
78- },
79- "type": [
80- "VerifiableCredential"
81- ]
87 + }
88 + }
8289 }
did-pkh/tests/vc-poly-epsig.jsonldView
@@ -1,9 +1,11 @@
11 {
22 "@context": [
33 "https://www.w3.org/2018/credentials/v1"
44 ],
5- "credentialSubject": {},
5 + "credentialSubject": {
6 + "id": "_:1"
7 + },
68 "issuanceDate": "2021-06-15T19:10:36.479Z",
79 "issuer": "did:pkh:poly:0x4e90e8a8191c1c23a24a598c3ab4fb47ce926ff5",
810 "proof": {
911 "@context": [
src/error.rsView
@@ -141,8 +141,14 @@
141141 /// Missing proof property
142142 MissingProof,
143143 /// Missing issuance date
144144 MissingIssuanceDate,
145 + /// Credential subject must be non-empty
146 + ///
147 + /// [Verifiable credential subject](crate::vc::CredentialSubject) arity must be positive
148 + /// and value must be non-empty, per [VC
149 + /// Data Model](https://www.w3.org/TR/vc-data-model/#credential-subject).
150 + EmptyCredentialSubject,
145151 /// Missing type VerifiableCredential
146152 MissingTypeVerifiableCredential,
147153 /// Missing type VerifiablePresentation
148154 MissingTypeVerifiablePresentation,
@@ -410,8 +416,9 @@
410416 Error::MissingExponent => write!(f, "Missing exponent in RSA key"),
411417 Error::MissingPrime => write!(f, "Missing prime factor in RSA key"),
412418 Error::MissingKeyParameters => write!(f, "JWT key parameters not found"),
413419 Error::MissingProof => write!(f, "Missing proof property"),
420 + Error::EmptyCredentialSubject => write!(f, "Credential subject must be non-empty"),
414421 Error::MissingIssuanceDate => write!(f, "Missing issuance date"),
415422 Error::MissingTypeVerifiableCredential => {
416423 write!(f, "Missing type VerifiableCredential")
417424 }
src/vc.rsView
The diff is too large to show. Use a local git client to view these changes.
Old file size: 118640 bytes
New file size: 119931 bytes
tests/lds-aleo2021-vc0.jsonldView
@@ -4,9 +4,11 @@
44 ],
55 "type": [
66 "VerifiableCredential"
77 ],
8- "credentialSubject": {},
8 + "credentialSubject": {
9 + "id": "_:1"
10 + },
911 "issuer": "did:example:aleovm2021",
1012 "issuanceDate": "2021-11-23T20:08:36Z",
1113 "proof": [
1214 {

Built with git-ssb-web