@veramo/credential-ld 5.0.1-next.11 → 5.0.1-next.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -50,10 +50,7 @@ export declare class CredentialIssuerLD implements IAgentPlugin {
50
50
  };
51
51
  };
52
52
  "@context": {
53
- type: string;
54
- items: {
55
- type: string;
56
- };
53
+ $ref: string;
57
54
  };
58
55
  issuanceDate: {
59
56
  $ref: string;
@@ -96,6 +93,20 @@ export declare class CredentialIssuerLD implements IAgentPlugin {
96
93
  };
97
94
  description: string;
98
95
  };
96
+ ContextType: {
97
+ anyOf: ({
98
+ type: string; /** {@inheritdoc ICredentialIssuerLD.createVerifiableCredentialLD} */
99
+ items?: undefined;
100
+ } | {
101
+ type: string;
102
+ items: {
103
+ anyOf: {
104
+ type: string;
105
+ }[];
106
+ };
107
+ })[];
108
+ description: string;
109
+ };
99
110
  DateType: {
100
111
  type: string;
101
112
  description: string;
@@ -137,21 +148,13 @@ export declare class CredentialIssuerLD implements IAgentPlugin {
137
148
  })[];
138
149
  };
139
150
  "@context": {
140
- anyOf: ({
141
- type: string;
142
- items: {
143
- type: string;
144
- };
145
- } | {
146
- type: string;
147
- items?: undefined;
148
- })[];
151
+ $ref: string;
149
152
  };
150
153
  issuanceDate: {
151
154
  type: string;
152
155
  };
153
156
  expirationDate: {
154
- type: string; /** {@inheritdoc ICredentialIssuerLD.verifyPresentationLD} */
157
+ type: string;
155
158
  };
156
159
  credentialStatus: {
157
160
  $ref: string;
@@ -221,10 +224,7 @@ export declare class CredentialIssuerLD implements IAgentPlugin {
221
224
  };
222
225
  };
223
226
  "@context": {
224
- type: string;
225
- items: {
226
- type: string;
227
- };
227
+ $ref: string;
228
228
  };
229
229
  verifier: {
230
230
  type: string;
@@ -282,15 +282,7 @@ export declare class CredentialIssuerLD implements IAgentPlugin {
282
282
  })[];
283
283
  };
284
284
  "@context": {
285
- anyOf: ({
286
- type: string;
287
- items: {
288
- type: string;
289
- };
290
- } | {
291
- type: string;
292
- items?: undefined;
293
- })[];
285
+ $ref: string;
294
286
  };
295
287
  verifier: {
296
288
  type: string;
@@ -1 +1 @@
1
- {"version":3,"file":"action-handler.d.ts","sourceRoot":"","sources":["../src/action-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EAKZ,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAI9C,OAAO,EAML,SAAS,EAET,UAAU,EACX,MAAM,eAAe,CAAA;AAItB,OAAO,EACL,UAAU,EACV,iCAAiC,EACjC,mCAAmC,EACnC,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,yBAAyB,EAC1B,MAAM,YAAY,CAAA;AAInB;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IACrD,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAA;IACrC,QAAQ,CAAC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CAgKf,6DAA6D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAhKjB;IAE5C,OAAO,CAAC,kBAAkB,CAAoB;gBAElC,OAAO,EAAE;QAAE,WAAW,EAAE,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAvFzB;IAE5C,OAAO,CAAC,kBAAkB,CAAoB;gBAElC,OAAO,EAAE;QAAE,WAAW,EAAE,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QAAC,MAAM,EAAE,iBAAiB,EAAE,CAAA;KAAE;IActG,uEAAuE;IAC1D,8BAA8B,CACzC,IAAI,EAAE,mCAAmC,EACzC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,sBAAsB,CAAC;IAiElC,qEAAqE;IACxD,4BAA4B,CACvC,IAAI,EAAE,iCAAiC,EACvC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,oBAAoB,CAAC;IAiDhC,2DAA2D;IAC9C,kBAAkB,CAC7B,IAAI,EAAE,uBAAuB,EAC7B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,OAAO,CAAC;IAgBnB,6DAA6D;IAChD,oBAAoB,CAC/B,IAAI,EAAE,yBAAyB,EAC/B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,OAAO,CAAC;YAgBL,oBAAoB;CAgCnC"}
@@ -42,10 +42,7 @@
42
42
  }
43
43
  },
44
44
  "@context": {
45
- "type": "array",
46
- "items": {
47
- "type": "string"
48
- }
45
+ "$ref": "#/components/schemas/ContextType"
49
46
  },
50
47
  "issuanceDate": {
51
48
  "$ref": "#/components/schemas/DateType"
@@ -93,6 +90,30 @@
93
90
  },
94
91
  "description": "The value of the credentialSubject property is defined as a set of objects that contain one or more properties that are each related to a subject of the verifiable credential. Each object MAY contain an id.\n\nSee {@link https://www.w3.org/TR/vc-data-model/#credential-subject | Credential Subject }"
95
92
  },
93
+ "ContextType": {
94
+ "anyOf": [
95
+ {
96
+ "type": "string"
97
+ },
98
+ {
99
+ "type": "object"
100
+ },
101
+ {
102
+ "type": "array",
103
+ "items": {
104
+ "anyOf": [
105
+ {
106
+ "type": "string"
107
+ },
108
+ {
109
+ "type": "object"
110
+ }
111
+ ]
112
+ }
113
+ }
114
+ ],
115
+ "description": "The data type for `@context` properties of credentials, presentations, etc."
116
+ },
96
117
  "DateType": {
97
118
  "type": "string",
98
119
  "description": "Represents an issuance or expiration date for Credentials / Presentations. This is used as input when creating them."
@@ -139,17 +160,7 @@
139
160
  ]
140
161
  },
141
162
  "@context": {
142
- "anyOf": [
143
- {
144
- "type": "array",
145
- "items": {
146
- "type": "string"
147
- }
148
- },
149
- {
150
- "type": "string"
151
- }
152
- ]
163
+ "$ref": "#/components/schemas/ContextType"
153
164
  },
154
165
  "issuanceDate": {
155
166
  "type": "string"
@@ -233,10 +244,7 @@
233
244
  }
234
245
  },
235
246
  "@context": {
236
- "type": "array",
237
- "items": {
238
- "type": "string"
239
- }
247
+ "$ref": "#/components/schemas/ContextType"
240
248
  },
241
249
  "verifier": {
242
250
  "type": "array",
@@ -303,17 +311,7 @@
303
311
  ]
304
312
  },
305
313
  "@context": {
306
- "anyOf": [
307
- {
308
- "type": "array",
309
- "items": {
310
- "type": "string"
311
- }
312
- },
313
- {
314
- "type": "string"
315
- }
316
- ]
314
+ "$ref": "#/components/schemas/ContextType"
317
315
  },
318
316
  "verifier": {
319
317
  "type": "array",
@@ -1 +1 @@
1
- {"version":3,"file":"JsonWebSignature2020.d.ts","sourceRoot":"","sources":["../../src/suites/JsonWebSignature2020.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnG,OAAO,EAAE,oBAAoB,EAAE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ld-suites.js";
2
2
  import * as u8a from "uint8arrays";
3
3
  import { JsonWebKey, JsonWebSignature } from "@transmute/json-web-signature";
4
- import { encodeJoseBlob } from "@veramo/utils";
4
+ import { asArray, encodeJoseBlob } from "@veramo/utils";
5
5
  /**
6
6
  * Veramo wrapper for the JsonWebSignature2020 suite by Transmute Industries
7
7
  *
@@ -52,13 +52,16 @@ export class VeramoJsonWebSignature2020 extends VeramoLdSignature {
52
52
  const suite = new JsonWebSignature({
53
53
  key: verificationKey,
54
54
  });
55
+ suite.ensureSuiteContext = ({ document }) => {
56
+ document['@context'] = [...asArray(document['@context'] || []), 'https://w3id.org/security/suites/jws-2020/v1'];
57
+ };
55
58
  return suite;
56
59
  }
57
60
  getSuiteForVerification() {
58
61
  return new JsonWebSignature();
59
62
  }
60
63
  preSigningCredModification(credential) {
61
- credential['@context'] = [...credential['@context'] || [], 'https://w3id.org/security/suites/jws-2020/v1'];
64
+ // nop
62
65
  }
63
66
  preDidResolutionModification(didUrl, didDoc) {
64
67
  // do nothing
@@ -1 +1 @@
1
- {"version":3,"file":"JsonWebSignature2020.js","sourceRoot":"","sources":["../../src/suites/JsonWebSignature2020.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C;;;;GAIG;AACH,MAAM,OAAO,0BAA2B,SAAQ,iBAAiB;IAC7D,4BAA4B;QACxB,OAAO,gBAAgB,CAAA;IAC3B,CAAC;IAED,yBAAyB;QACrB,OAAO,SAAS,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,kBAAkB,CACpB,GAAS,EACT,SAAiB,EACjB,oBAA4B,EAC5B,OAA4C;QAE5C,MAAM,UAAU,GAAG,SAAS,CAAA;QAE5B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AC,GAAG,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,EAAE,8CAA8C,CAAC,CAAA;QACnH,CAAC,CAAA;QAED,OAAO,KAAK,CAAA;IAChB,CAAC;IAED,uBAAuB;QACnB,OAAO,IAAI,gBAAgB,EAAE,CAAA;IACjC,CAAC;IAED,0BAA0B,CAAC,UAA6B;QACpD,MAAM;IACV,CAAC;IAED,4BAA4B,CAAC,MAAc,EAAE,MAAmB;QAC5D,aAAa;IACjB,CAAC;CAEJ"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@veramo/credential-ld",
3
3
  "description": "Veramo plugin for working with W3C JSON-LD Verifiable Credentials & Presentations.",
4
- "version": "5.0.1-next.11+672f92b1",
4
+ "version": "5.0.1-next.12+44bb3650",
5
5
  "main": "build/index.js",
6
6
  "exports": {
7
7
  ".": "./build/index.js",
@@ -27,8 +27,8 @@
27
27
  "@transmute/ed25519-signature-2018": "^0.7.0-unstable.79",
28
28
  "@transmute/json-web-signature": "^0.7.0-unstable.79",
29
29
  "@veramo-community/lds-ecdsa-secp256k1-recovery2020": "uport-project/EcdsaSecp256k1RecoverySignature2020",
30
- "@veramo/core-types": "^5.0.1-next.11+672f92b1",
31
- "@veramo/utils": "^5.0.1-next.11+672f92b1",
30
+ "@veramo/core-types": "^5.0.1-next.12+44bb3650",
31
+ "@veramo/utils": "^5.0.1-next.12+44bb3650",
32
32
  "cross-fetch": "^3.1.5",
33
33
  "debug": "^4.3.3",
34
34
  "did-resolver": "^4.0.1",
@@ -63,5 +63,5 @@
63
63
  "node_modules",
64
64
  "src"
65
65
  ],
66
- "gitHead": "672f92b1bd3850c369cbef646c8ece8a58fafc16"
66
+ "gitHead": "44bb36503b635ee1f5431cb4bf28c7a9ba111156"
67
67
  }
@@ -80,6 +80,34 @@ describe('credential-LD full flow', () => {
80
80
  didEthrIdentifier = await agent.didManagerCreate({ provider: 'did:ethr:goerli' })
81
81
  })
82
82
 
83
+ it('create credential with inline context', async () => {
84
+ const credential: CredentialPayload = {
85
+ issuer: didKeyIdentifier.did,
86
+ '@context': [
87
+ {
88
+ '@context': {
89
+ nothing: 'custom:example.context#blank',
90
+ },
91
+ },
92
+ ],
93
+ credentialSubject: {
94
+ nothing: 'else matters',
95
+ },
96
+ }
97
+ const verifiableCredential = await agent.createVerifiableCredential({
98
+ credential,
99
+ proofFormat: 'lds',
100
+ })
101
+
102
+ expect(verifiableCredential).toBeDefined()
103
+
104
+ const result = await agent.verifyCredential({
105
+ credential: verifiableCredential,
106
+ })
107
+
108
+ expect(result.verified).toBe(true)
109
+ })
110
+
83
111
  it('works with Ed25519Signature2018 credential', async () => {
84
112
  const credential: CredentialPayload = {
85
113
  issuer: didKeyIdentifier.did,
@@ -42,10 +42,7 @@
42
42
  }
43
43
  },
44
44
  "@context": {
45
- "type": "array",
46
- "items": {
47
- "type": "string"
48
- }
45
+ "$ref": "#/components/schemas/ContextType"
49
46
  },
50
47
  "issuanceDate": {
51
48
  "$ref": "#/components/schemas/DateType"
@@ -93,6 +90,30 @@
93
90
  },
94
91
  "description": "The value of the credentialSubject property is defined as a set of objects that contain one or more properties that are each related to a subject of the verifiable credential. Each object MAY contain an id.\n\nSee {@link https://www.w3.org/TR/vc-data-model/#credential-subject | Credential Subject }"
95
92
  },
93
+ "ContextType": {
94
+ "anyOf": [
95
+ {
96
+ "type": "string"
97
+ },
98
+ {
99
+ "type": "object"
100
+ },
101
+ {
102
+ "type": "array",
103
+ "items": {
104
+ "anyOf": [
105
+ {
106
+ "type": "string"
107
+ },
108
+ {
109
+ "type": "object"
110
+ }
111
+ ]
112
+ }
113
+ }
114
+ ],
115
+ "description": "The data type for `@context` properties of credentials, presentations, etc."
116
+ },
96
117
  "DateType": {
97
118
  "type": "string",
98
119
  "description": "Represents an issuance or expiration date for Credentials / Presentations. This is used as input when creating them."
@@ -139,17 +160,7 @@
139
160
  ]
140
161
  },
141
162
  "@context": {
142
- "anyOf": [
143
- {
144
- "type": "array",
145
- "items": {
146
- "type": "string"
147
- }
148
- },
149
- {
150
- "type": "string"
151
- }
152
- ]
163
+ "$ref": "#/components/schemas/ContextType"
153
164
  },
154
165
  "issuanceDate": {
155
166
  "type": "string"
@@ -233,10 +244,7 @@
233
244
  }
234
245
  },
235
246
  "@context": {
236
- "type": "array",
237
- "items": {
238
- "type": "string"
239
- }
247
+ "$ref": "#/components/schemas/ContextType"
240
248
  },
241
249
  "verifier": {
242
250
  "type": "array",
@@ -303,17 +311,7 @@
303
311
  ]
304
312
  },
305
313
  "@context": {
306
- "anyOf": [
307
- {
308
- "type": "array",
309
- "items": {
310
- "type": "string"
311
- }
312
- },
313
- {
314
- "type": "string"
315
- }
316
- ]
314
+ "$ref": "#/components/schemas/ContextType"
317
315
  },
318
316
  "verifier": {
319
317
  "type": "array",
@@ -2,19 +2,19 @@ import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from "@
2
2
  import { RequiredAgentMethods, VeramoLdSignature } from "../ld-suites.js";
3
3
  import * as u8a from "uint8arrays";
4
4
  import { JsonWebKey, JsonWebSignature } from "@transmute/json-web-signature";
5
- import { encodeJoseBlob } from "@veramo/utils";
5
+ import { asArray, encodeJoseBlob } from "@veramo/utils";
6
6
 
7
7
 
8
8
  /**
9
9
  * Veramo wrapper for the JsonWebSignature2020 suite by Transmute Industries
10
- *
10
+ *
11
11
  * @alpha This API is experimental and is very likely to change or disappear in future releases without notice.
12
12
  */
13
13
  export class VeramoJsonWebSignature2020 extends VeramoLdSignature {
14
14
  getSupportedVerificationType(): 'JsonWebKey2020' {
15
15
  return 'JsonWebKey2020'
16
16
  }
17
-
17
+
18
18
  getSupportedVeramoKeyType(): TKeyType {
19
19
  return 'Ed25519'
20
20
  }
@@ -68,6 +68,10 @@ export class VeramoJsonWebSignature2020 extends VeramoLdSignature {
68
68
  key: verificationKey,
69
69
  })
70
70
 
71
+ suite.ensureSuiteContext = ({ document }: { document: any, addSuiteContext: boolean }) => {
72
+ document['@context'] = [...asArray(document['@context'] || []), 'https://w3id.org/security/suites/jws-2020/v1']
73
+ }
74
+
71
75
  return suite
72
76
  }
73
77
 
@@ -76,10 +80,11 @@ export class VeramoJsonWebSignature2020 extends VeramoLdSignature {
76
80
  }
77
81
 
78
82
  preSigningCredModification(credential: CredentialPayload): void {
79
- credential['@context'] = [...credential['@context'] || [], 'https://w3id.org/security/suites/jws-2020/v1']
83
+ // nop
80
84
  }
81
85
 
82
86
  preDidResolutionModification(didUrl: string, didDoc: DIDDocument): void {
83
87
  // do nothing
84
88
  }
85
- }
89
+
90
+ }