@learncard/vc-templates-plugin 1.0.52 → 1.0.54

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.
@@ -2,6 +2,6 @@ import { UnsignedVC } from '@learncard/types';
2
2
  import { VcTemplates } from './types';
3
3
  /** @group VC Templates Plugin */
4
4
  export declare const VC_TEMPLATES: {
5
- [Key in keyof VcTemplates]: (args: VcTemplates[Key]) => UnsignedVC;
5
+ [Key in keyof VcTemplates]: (args: VcTemplates[Key], crypto: Crypto) => UnsignedVC;
6
6
  };
7
7
  //# sourceMappingURL=templates.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiC,MAAM,kBAAkB,CAAC;AAE7E,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,iCAAiC;AACjC,eAAO,MAAM,YAAY,EAAE;KAAG,GAAG,IAAI,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC,KAAK,UAAU;CA4kB9F,CAAC"}
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiC,MAAM,kBAAkB,CAAC;AAE7E,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,iCAAiC;AACjC,eAAO,MAAM,YAAY,EAAE;KACtB,GAAG,IAAI,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,KAAK,UAAU;CA+OrF,CAAC"}
package/dist/types.d.ts CHANGED
@@ -6,6 +6,9 @@ export type BoostAttachment = {
6
6
  type?: string;
7
7
  title?: string;
8
8
  url?: string;
9
+ fileName?: string;
10
+ fileSize?: string;
11
+ fileType?: string;
9
12
  };
10
13
  export type BoostSkills = {
11
14
  category: string;
@@ -117,6 +120,7 @@ export type NewCredentialFunction = (args?: DiscriminatedUnionize<VcTemplates>)
117
120
  /** @group VC Templates Plugin */
118
121
  export type VCTemplatePluginDependentMethods = {
119
122
  getSubjectDid?: (type: 'key') => string;
123
+ crypto: () => Crypto;
120
124
  };
121
125
  /** @group VC Templates Plugin */
122
126
  export type VCTemplatePluginMethods = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,iCAAiC;AACjC,MAAM,MAAM,eAAe,GAAG;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF,iCAAiC;AACjC,MAAM,MAAM,YAAY,GAAG;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC,KAAK,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC5B,SAAS,EAAE,sBAAsB,EAAE,CAAC;IACpC,UAAU,EAA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CAAC,KAAK,UAAU,CAAC;AAE9F,iCAAiC;AACjC,MAAM,MAAM,gCAAgC,GAAG;IAC3C,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAC;IACxC,MAAM,EAAE,MAAM,MAAM,CAAC;CACxB,CAAC;AAEF,iCAAiC;AACjC,MAAM,MAAM,uBAAuB,GAAG;IAClC,aAAa,EAAE,qBAAqB,CAAC;IACrC,eAAe,EAAE,CAAC,UAAU,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACrF,CAAC;AAEF,iCAAiC;AACjC,MAAM,MAAM,gBAAgB,GAAG,MAAM,CACjC,cAAc,EACd,GAAG,EACH,uBAAuB,EACvB,IAAI,EACJ,gCAAgC,CACnC,CAAC"}
@@ -31,9 +31,9 @@ var VC_TEMPLATES = {
31
31
  did = "did:example:d23dd687a7dc6787646f2eb98d0",
32
32
  subject = "did:example:d23dd687a7dc6787646f2eb98d0",
33
33
  issuanceDate = "2020-08-19T21:41:50Z"
34
- } = {}) => ({
34
+ } = {}, crypto) => ({
35
35
  "@context": ["https://www.w3.org/2018/credentials/v1"],
36
- id: "http://example.org/credentials/3731",
36
+ id: `urn:uuid:${crypto.randomUUID()}`,
37
37
  type: ["VerifiableCredential"],
38
38
  issuer: did,
39
39
  issuanceDate,
@@ -47,21 +47,21 @@ var VC_TEMPLATES = {
47
47
  description = "This badge recognizes the development of the capacity to collaborate within a group environment.",
48
48
  criteriaNarrative = "Team members are nominated for this badge by their peers and recognized upon review by Example Corp management.",
49
49
  issuanceDate = "2020-08-19T21:41:50Z"
50
- } = {}) => ({
50
+ } = {}, crypto) => ({
51
51
  "@context": [
52
- "https://www.w3.org/2018/credentials/v1",
53
- "https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.2.json"
52
+ "https://www.w3.org/ns/credentials/v2",
53
+ "https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json"
54
54
  ],
55
- id: "http://example.com/credentials/3527",
55
+ id: `urn:uuid:${crypto.randomUUID()}`,
56
56
  type: ["VerifiableCredential", "OpenBadgeCredential"],
57
- issuer: did,
58
- issuanceDate,
57
+ issuer: { id: did },
58
+ validFrom: issuanceDate,
59
59
  name,
60
60
  credentialSubject: {
61
61
  id: subject,
62
62
  type: ["AchievementSubject"],
63
63
  achievement: {
64
- id: "https://example.com/achievements/21st-century-skills/teamwork",
64
+ id: `urn:uuid:${crypto.randomUUID()}`,
65
65
  type: ["Achievement"],
66
66
  criteria: { narrative: criteriaNarrative },
67
67
  description,
@@ -73,13 +73,13 @@ var VC_TEMPLATES = {
73
73
  did = "did:example:d23dd687a7dc6787646f2eb98d0",
74
74
  subject = "did:example:d23dd687a7dc6787646f2eb98d0",
75
75
  issuanceDate = "2020-08-19T21:41:50Z"
76
- } = {}) => ({
76
+ } = {}, crypto) => ({
77
77
  "@context": [
78
78
  "https://www.w3.org/2018/credentials/v1",
79
79
  "https://purl.imsglobal.org/spec/ob/v3p0/context.json",
80
80
  "https://w3id.org/security/suites/ed25519-2020/v1"
81
81
  ],
82
- id: "urn:uuid:a63a60be-f4af-491c-87fc-2c8fd3007a58",
82
+ id: `urn:uuid:${crypto.randomUUID()}`,
83
83
  type: ["VerifiableCredential", "OpenBadgeCredential"],
84
84
  name: "JFF x vc-edu PlugFest 2 Interoperability",
85
85
  issuer: {
@@ -96,7 +96,7 @@ var VC_TEMPLATES = {
96
96
  type: ["AchievementSubject"],
97
97
  id: subject,
98
98
  achievement: {
99
- id: "urn:uuid:bd6d9316-f7ae-4073-a1e5-2f7f5bd22922",
99
+ id: `urn:uuid:${crypto.randomUUID()}`,
100
100
  type: ["Achievement"],
101
101
  name: "JFF x vc-edu PlugFest 2 Interoperability",
102
102
  description: "This credential solution supports the use of OBv3 and w3c Verifiable Credentials and is interoperable with at least two other solutions. This was demonstrated successfully during JFF x vc-edu PlugFest 2.",
@@ -116,9 +116,8 @@ var VC_TEMPLATES = {
116
116
  issuanceDate = "2020-08-19T21:41:50Z",
117
117
  expirationDate,
118
118
  boostName = "Example Boost",
119
- boostId = "urn:uuid:boost:example:555",
120
119
  boostImage,
121
- achievementId = "urn:uuid:123",
120
+ achievementId,
122
121
  achievementType = "Influencer",
123
122
  achievementName = "Awesome Badge",
124
123
  achievementDescription = "Awesome People Earn Awesome Badge",
@@ -129,163 +128,23 @@ var VC_TEMPLATES = {
129
128
  familyTitles,
130
129
  skills,
131
130
  groupID = ""
132
- } = {}) => ({
131
+ } = {}, crypto) => ({
133
132
  "@context": [
134
- "https://www.w3.org/2018/credentials/v1",
135
- "https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.2.json",
136
- {
137
- type: "@type",
138
- xsd: "https://www.w3.org/2001/XMLSchema#",
139
- lcn: "https://docs.learncard.com/definitions#",
140
- BoostCredential: {
141
- "@id": "lcn:boostCredential",
142
- "@context": {
143
- boostId: {
144
- "@id": "lcn:boostId",
145
- "@type": "xsd:string"
146
- },
147
- display: {
148
- "@id": "lcn:boostDisplay",
149
- "@context": {
150
- backgroundImage: {
151
- "@id": "lcn:boostBackgroundImage",
152
- "@type": "xsd:string"
153
- },
154
- backgroundColor: {
155
- "@id": "lcn:boostBackgroundColor",
156
- "@type": "xsd:string"
157
- },
158
- displayType: {
159
- "@id": "lcn:boostDisplayType",
160
- "@type": "xsd:string"
161
- },
162
- fadeBackgroundImage: {
163
- "@id": "lcn:boostFadeBackgroundImage",
164
- "@type": "xsd:boolean"
165
- },
166
- repeatBackgroundImage: {
167
- "@id": "lcn:boostRepeatBackgroundImage",
168
- "@type": "xsd:boolean"
169
- },
170
- emoji: {
171
- "@id": "lcn:boostEmoji",
172
- "@context": {
173
- activeSkinTone: {
174
- "@id": "lcn:boostEmojiActiveSkinTone",
175
- "@type": "xsd:string"
176
- },
177
- unified: {
178
- "@id": "lcn:boostEmojiUnified",
179
- "@type": "xsd:string"
180
- },
181
- unifiedWithoutSkinTone: {
182
- "@id": "lcn:boostEmojiUnifiedWithoutSkinTone",
183
- "@type": "xsd:string"
184
- },
185
- names: {
186
- "@id": "lcn:boostEmojiNames",
187
- "@container": "@set",
188
- "@type": "xsd:string"
189
- },
190
- imageUrl: {
191
- "@id": "lcn:boostEmojiImageUrl",
192
- "@type": "xsd:string"
193
- }
194
- }
195
- }
196
- }
197
- },
198
- familyTitles: {
199
- "@id": "lcn:familyTitles",
200
- "@context": {
201
- guardians: {
202
- "@id": "lcn:guardians",
203
- "@container": "@set",
204
- "@context": {
205
- plural: {
206
- "@id": "lcn:plural",
207
- "@type": "xsd:string"
208
- },
209
- singular: {
210
- "@id": "lcn:singular",
211
- "@type": "xsd:string"
212
- }
213
- }
214
- },
215
- dependents: {
216
- "@id": "lcn:dependents",
217
- "@container": "@set",
218
- "@context": {
219
- plural: {
220
- "@id": "lcn:plural",
221
- "@type": "xsd:string"
222
- },
223
- singular: {
224
- "@id": "lcn:singular",
225
- "@type": "xsd:string"
226
- }
227
- }
228
- }
229
- }
230
- },
231
- attachments: {
232
- "@id": "lcn:boostAttachments",
233
- "@container": "@set",
234
- "@context": {
235
- type: {
236
- "@id": "lcn:boostAttachmentType",
237
- "@type": "xsd:string"
238
- },
239
- title: {
240
- "@id": "lcn:boostAttachmentTitle",
241
- "@type": "xsd:string"
242
- },
243
- url: {
244
- "@id": "lcn:boostAttachmentUrl",
245
- "@type": "xsd:string"
246
- }
247
- }
248
- },
249
- address: {
250
- "@id": "https://purl.imsglobal.org/spec/vc/ob/vocab.html#Address"
251
- },
252
- skills: {
253
- "@id": "lcn:boostSkills",
254
- "@container": "@set",
255
- "@context": {
256
- category: {
257
- "@id": "lcn:boostSkillCategory",
258
- "@type": "xsd:string"
259
- },
260
- skill: {
261
- "@id": "lcn:boostSkill",
262
- "@type": "xsd:string"
263
- },
264
- subskills: {
265
- "@id": "lcn:boostSubskills",
266
- "@container": "@set",
267
- "@type": "xsd:string"
268
- }
269
- }
270
- },
271
- groupID: {
272
- "@id": "lcn:groupID",
273
- "@type": "xsd:string"
274
- }
275
- }
276
- }
277
- }
133
+ "https://www.w3.org/ns/credentials/v2",
134
+ "https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json",
135
+ "https://ctx.learncard.com/boosts/1.0.0.json"
278
136
  ],
279
137
  type: ["VerifiableCredential", "OpenBadgeCredential", "BoostCredential"],
280
- issuer: did,
281
- issuanceDate,
138
+ id: `urn:uuid:${crypto.randomUUID()}`,
139
+ issuer: { id: did },
140
+ validFrom: issuanceDate,
141
+ ...expirationDate && { validUntil: expirationDate },
282
142
  name: boostName,
283
- expirationDate,
284
143
  credentialSubject: {
285
144
  id: subject,
286
145
  type: ["AchievementSubject"],
287
146
  achievement: {
288
- id: achievementId,
147
+ id: achievementId ?? `urn:uuid:${crypto.randomUUID()}`,
289
148
  type: ["Achievement"],
290
149
  achievementType,
291
150
  name: achievementName,
@@ -309,9 +168,8 @@ var VC_TEMPLATES = {
309
168
  issuanceDate = "2020-08-19T21:41:50Z",
310
169
  expirationDate,
311
170
  boostName = "Example Boost",
312
- boostId = "urn:uuid:boost:example:555",
313
171
  boostImage,
314
- achievementId = "urn:uuid:123",
172
+ achievementId,
315
173
  achievementType = "Influencer",
316
174
  achievementName = "Awesome Badge",
317
175
  achievementDescription = "Awesome People Earn Awesome Badge",
@@ -324,226 +182,24 @@ var VC_TEMPLATES = {
324
182
  familyTitles,
325
183
  boostID,
326
184
  groupID = ""
327
- } = {}) => ({
185
+ } = {}, crypto) => ({
328
186
  "@context": [
329
- "https://www.w3.org/2018/credentials/v1",
330
- "https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.2.json",
331
- {
332
- type: "@type",
333
- xsd: "https://www.w3.org/2001/XMLSchema#",
334
- lcn: "https://docs.learncard.com/definitions#",
335
- BoostCredential: {
336
- "@id": "lcn:boostCredential",
337
- "@context": {
338
- boostId: {
339
- "@id": "lcn:boostId",
340
- "@type": "xsd:string"
341
- },
342
- display: {
343
- "@id": "lcn:boostDisplay",
344
- "@context": {
345
- backgroundImage: {
346
- "@id": "lcn:boostBackgroundImage",
347
- "@type": "xsd:string"
348
- },
349
- backgroundColor: {
350
- "@id": "lcn:boostBackgroundColor",
351
- "@type": "xsd:string"
352
- },
353
- displayType: {
354
- "@id": "lcn:boostDisplayType",
355
- "@type": "xsd:string"
356
- },
357
- fadeBackgroundImage: {
358
- "@id": "lcn:boostFadeBackgroundImage",
359
- "@type": "xsd:boolean"
360
- },
361
- repeatBackgroundImage: {
362
- "@id": "lcn:boostRepeatBackgroundImage",
363
- "@type": "xsd:boolean"
364
- },
365
- emoji: {
366
- "@id": "lcn:boostEmoji",
367
- "@context": {
368
- activeSkinTone: {
369
- "@id": "lcn:boostEmojiActiveSkinTone",
370
- "@type": "xsd:string"
371
- },
372
- unified: {
373
- "@id": "lcn:boostEmojiUnified",
374
- "@type": "xsd:string"
375
- },
376
- unifiedWithoutSkinTone: {
377
- "@id": "lcn:boostEmojiUnifiedWithoutSkinTone",
378
- "@type": "xsd:string"
379
- },
380
- names: {
381
- "@id": "lcn:boostEmojiNames",
382
- "@container": "@set",
383
- "@type": "xsd:string"
384
- },
385
- imageUrl: {
386
- "@id": "lcn:boostEmojiImageUrl",
387
- "@type": "xsd:string"
388
- }
389
- }
390
- }
391
- }
392
- },
393
- familyTitles: {
394
- "@id": "lcn:familyTitles",
395
- "@context": {
396
- guardians: {
397
- "@id": "lcn:guardians",
398
- "@container": "@set",
399
- "@context": {
400
- plural: {
401
- "@id": "lcn:plural",
402
- "@type": "xsd:string"
403
- },
404
- singular: {
405
- "@id": "lcn:singular",
406
- "@type": "xsd:string"
407
- }
408
- }
409
- },
410
- dependents: {
411
- "@id": "lcn:dependents",
412
- "@container": "@set",
413
- "@context": {
414
- plural: {
415
- "@id": "lcn:plural",
416
- "@type": "xsd:string"
417
- },
418
- singular: {
419
- "@id": "lcn:singular",
420
- "@type": "xsd:string"
421
- }
422
- }
423
- }
424
- }
425
- },
426
- attachments: {
427
- "@id": "lcn:boostAttachments",
428
- "@container": "@set",
429
- "@context": {
430
- type: {
431
- "@id": "lcn:boostAttachmentType",
432
- "@type": "xsd:string"
433
- },
434
- title: {
435
- "@id": "lcn:boostAttachmentTitle",
436
- "@type": "xsd:string"
437
- },
438
- url: {
439
- "@id": "lcn:boostAttachmentUrl",
440
- "@type": "xsd:string"
441
- }
442
- }
443
- },
444
- skills: {
445
- "@id": "lcn:boostSkills",
446
- "@container": "@set",
447
- "@context": {
448
- category: {
449
- "@id": "lcn:boostSkillCategory",
450
- "@type": "xsd:string"
451
- },
452
- skill: {
453
- "@id": "lcn:boostSkill",
454
- "@type": "xsd:string"
455
- },
456
- subskills: {
457
- "@id": "lcn:boostSubskills",
458
- "@container": "@set",
459
- "@type": "xsd:string"
460
- }
461
- }
462
- },
463
- groupID: {
464
- "@id": "lcn:groupID",
465
- "@type": "xsd:string"
466
- },
467
- address: {
468
- "@id": "https://purl.imsglobal.org/spec/vc/ob/vocab.html#Address"
469
- }
470
- }
471
- }
472
- },
473
- {
474
- type: "@type",
475
- xsd: "https://www.w3.org/2001/XMLSchema#",
476
- lcn: "https://docs.learncard.com/definitions#",
477
- BoostID: {
478
- "@id": "lcn:boostID",
479
- "@context": {
480
- boostID: {
481
- "@id": "lcn:boostIDField",
482
- "@context": {
483
- fontColor: {
484
- "@id": "lcn:boostIDFontColor",
485
- "@type": "xsd:string"
486
- },
487
- accentColor: {
488
- "@id": "lcn:boostIDAccentColor",
489
- "@type": "xsd:string"
490
- },
491
- backgroundImage: {
492
- "@id": "lcn:boostIDBackgroundImage",
493
- "@type": "xsd:string"
494
- },
495
- dimBackgroundImage: {
496
- "@id": "lcn:boostIDDimBackgroundImage",
497
- "@type": "xsd:boolean"
498
- },
499
- issuerThumbnail: {
500
- "@id": "lcn:boostIDIssuerThumbnail",
501
- "@type": "xsd:string"
502
- },
503
- showIssuerThumbnail: {
504
- "@id": "lcn:boostIDShowIssuerThumbnail",
505
- "@type": "xsd:boolean"
506
- },
507
- IDIssuerName: {
508
- "@id": "lcn:boostIDIssuerName",
509
- "@type": "xsd:string"
510
- },
511
- idThumbnail: {
512
- "@id": "lcn:boostIDThumbnail",
513
- "@type": "xsd:string"
514
- },
515
- accentFontColor: {
516
- "@id": "lcn:boostIDFontColor",
517
- "@type": "xsd:string"
518
- },
519
- idBackgroundColor: {
520
- "@id": "lcn:boostIDBackgroundColor",
521
- "@type": "xsd:string"
522
- },
523
- repeatIdBackgroundImage: {
524
- "@id": "lcn:boostIDRepeatIdBackgroundImage",
525
- "@type": "xsd:boolean"
526
- },
527
- idDescription: {
528
- "@id": "lcn:boostIDDescription",
529
- "@type": "xsd:string"
530
- }
531
- }
532
- }
533
- }
534
- }
535
- }
187
+ "https://www.w3.org/ns/credentials/v2",
188
+ "https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json",
189
+ "https://ctx.learncard.com/boosts/1.0.0.json",
190
+ "https://ctx.learncard.com/boostIDs/1.0.0.json"
536
191
  ],
537
192
  type: ["VerifiableCredential", "OpenBadgeCredential", "BoostCredential", "BoostID"],
538
- issuer: did,
539
- issuanceDate,
193
+ id: `urn:uuid:${crypto.randomUUID()}`,
194
+ issuer: { id: did },
195
+ validFrom: issuanceDate,
196
+ ...expirationDate && { validUntil: expirationDate },
540
197
  name: boostName,
541
- expirationDate,
542
198
  credentialSubject: {
543
199
  id: subject,
544
200
  type: ["AchievementSubject"],
545
201
  achievement: {
546
- id: achievementId,
202
+ id: achievementId ?? `urn:uuid:${crypto.randomUUID()}`,
547
203
  type: ["Achievement"],
548
204
  achievementType,
549
205
  name: achievementName,
@@ -574,33 +230,15 @@ var VC_TEMPLATES = {
574
230
  subject = "did:example:d23dd687a7dc6787646f2eb98d0",
575
231
  issuanceDate = new Date().toISOString(),
576
232
  access = ["read"]
577
- } = {}) => ({
233
+ } = {}, crypto) => ({
578
234
  "@context": [
579
- "https://www.w3.org/2018/credentials/v1",
580
- {
581
- type: "@type",
582
- xsd: "https://www.w3.org/2001/XMLSchema#",
583
- lcn: "https://docs.learncard.com/definitions#",
584
- DelegateCredential: {
585
- "@id": "lcn:delegateCredential",
586
- "@context": {
587
- permissions: {
588
- "@id": "lcn:delegateAccess",
589
- "@context": {
590
- statementAccess: {
591
- "@id": "lcn:delegateAccess",
592
- "@container": "@set",
593
- "@type": "xsd:string"
594
- }
595
- }
596
- }
597
- }
598
- }
599
- }
235
+ "https://www.w3.org/ns/credentials/v2",
236
+ "https://ctx.learncard.com/delegates/1.0.0.json"
600
237
  ],
601
238
  type: ["VerifiableCredential", "DelegateCredential"],
602
- issuer: did,
603
- issuanceDate,
239
+ id: `urn:uuid:${crypto.randomUUID()}`,
240
+ issuer: { id: did },
241
+ validFrom: issuanceDate,
604
242
  credentialSubject: { id: subject },
605
243
  permissions: { statementAccess: access }
606
244
  })
@@ -625,14 +263,17 @@ var getVCTemplatesPlugin = /* @__PURE__ */ __name(() => {
625
263
  const { type = "basic", ...functionArgs } = args;
626
264
  if (!(type in VC_TEMPLATES))
627
265
  throw new Error("Invalid Test VC Type!");
628
- return VC_TEMPLATES[type]({ ...defaults, ...functionArgs });
266
+ return VC_TEMPLATES[type](
267
+ { ...defaults, ...functionArgs },
268
+ _learnCard.invoke.crypto()
269
+ );
629
270
  },
630
271
  newPresentation: async (_learnCard, credential, args = {}) => {
631
272
  const did = args?.did || _learnCard.id.did();
632
273
  if (!did)
633
274
  throw new Error("Could not get issuer did!");
634
275
  return {
635
- "@context": ["https://www.w3.org/2018/credentials/v1"],
276
+ "@context": ["https://www.w3.org/ns/credentials/v2"],
636
277
  type: ["VerifiablePresentation"],
637
278
  holder: did,
638
279
  verifiableCredential: credential