@learncard/didkit-plugin 1.1.2 → 1.2.0
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.
- package/dist/didkit/didkit_wasm.d.ts +15 -10
- package/dist/didkit/didkit_wasm.js +27 -12
- package/dist/didkit/didkit_wasm_bg.wasm +0 -0
- package/dist/didkit/didkit_wasm_bg.wasm.d.ts +5 -5
- package/dist/didkit-plugin.cjs.development.js +76 -17
- package/dist/didkit-plugin.cjs.development.js.map +3 -3
- package/dist/didkit-plugin.cjs.production.min.js +2 -2
- package/dist/didkit-plugin.cjs.production.min.js.map +3 -3
- package/dist/didkit-plugin.esm.js +76 -17
- package/dist/didkit-plugin.esm.js.map +3 -3
- package/dist/didkit_wasm.d.ts +15 -10
- package/dist/didkit_wasm.js +27 -12
- package/dist/didkit_wasm_bg.wasm +0 -0
- package/dist/didkit_wasm_bg.wasm.d.ts +5 -5
- package/dist/helpers.d.ts +3 -0
- package/dist/plugin.d.ts +2 -2
- package/dist/types.d.ts +1 -1
- package/package.json +2 -2
@@ -55,9 +55,10 @@ export function didToVerificationMethod(did: string): Promise<any>;
|
|
55
55
|
* @param {string} credential
|
56
56
|
* @param {string} proof_options
|
57
57
|
* @param {string} key
|
58
|
+
* @param {string} context_map
|
58
59
|
* @returns {Promise<any>}
|
59
60
|
*/
|
60
|
-
export function issueCredential(credential: string, proof_options: string, key: string): Promise<any>;
|
61
|
+
export function issueCredential(credential: string, proof_options: string, key: string, context_map: string): Promise<any>;
|
61
62
|
/**
|
62
63
|
* @param {string} credential
|
63
64
|
* @param {string} linked_data_proof_options
|
@@ -75,16 +76,18 @@ export function completeIssueCredential(credential: string, preparation: string,
|
|
75
76
|
/**
|
76
77
|
* @param {string} vc
|
77
78
|
* @param {string} proof_options
|
79
|
+
* @param {string} context_map
|
78
80
|
* @returns {Promise<any>}
|
79
81
|
*/
|
80
|
-
export function verifyCredential(vc: string, proof_options: string): Promise<any>;
|
82
|
+
export function verifyCredential(vc: string, proof_options: string, context_map: string): Promise<any>;
|
81
83
|
/**
|
82
84
|
* @param {string} presentation
|
83
85
|
* @param {string} proof_options
|
84
86
|
* @param {string} key
|
87
|
+
* @param {string} context_map
|
85
88
|
* @returns {Promise<any>}
|
86
89
|
*/
|
87
|
-
export function issuePresentation(presentation: string, proof_options: string, key: string): Promise<any>;
|
90
|
+
export function issuePresentation(presentation: string, proof_options: string, key: string, context_map: string): Promise<any>;
|
88
91
|
/**
|
89
92
|
* @param {string} presentation
|
90
93
|
* @param {string} linked_data_proof_options
|
@@ -102,16 +105,18 @@ export function completeIssuePresentation(presentation: string, preparation: str
|
|
102
105
|
/**
|
103
106
|
* @param {string} vp
|
104
107
|
* @param {string} proof_options
|
108
|
+
* @param {string} context_map
|
105
109
|
* @returns {Promise<any>}
|
106
110
|
*/
|
107
|
-
export function verifyPresentation(vp: string, proof_options: string): Promise<any>;
|
111
|
+
export function verifyPresentation(vp: string, proof_options: string, context_map: string): Promise<any>;
|
108
112
|
/**
|
109
113
|
* @param {string} holder
|
110
114
|
* @param {string} linked_data_proof_options
|
111
115
|
* @param {string} key
|
116
|
+
* @param {string} context_map
|
112
117
|
* @returns {Promise<any>}
|
113
118
|
*/
|
114
|
-
export function DIDAuth(holder: string, linked_data_proof_options: string, key: string): Promise<any>;
|
119
|
+
export function DIDAuth(holder: string, linked_data_proof_options: string, key: string, context_map: string): Promise<any>;
|
115
120
|
/**
|
116
121
|
* @param {string} tz
|
117
122
|
* @returns {Promise<any>}
|
@@ -199,15 +204,15 @@ export interface InitOutput {
|
|
199
204
|
readonly keyToDID: (a: number, b: number, c: number, d: number, e: number) => void;
|
200
205
|
readonly keyToVerificationMethod: (a: number, b: number, c: number, d: number) => number;
|
201
206
|
readonly didToVerificationMethod: (a: number, b: number) => number;
|
202
|
-
readonly issueCredential: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
207
|
+
readonly issueCredential: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
203
208
|
readonly prepareIssueCredential: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
204
209
|
readonly completeIssueCredential: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
205
|
-
readonly verifyCredential: (a: number, b: number, c: number, d: number) => number;
|
206
|
-
readonly issuePresentation: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
210
|
+
readonly verifyCredential: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
211
|
+
readonly issuePresentation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
207
212
|
readonly prepareIssuePresentation: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
208
213
|
readonly completeIssuePresentation: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
209
|
-
readonly verifyPresentation: (a: number, b: number, c: number, d: number) => number;
|
210
|
-
readonly DIDAuth: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
214
|
+
readonly verifyPresentation: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
215
|
+
readonly DIDAuth: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
211
216
|
readonly JWKFromTezos: (a: number, b: number) => number;
|
212
217
|
readonly delegateCapability: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
213
218
|
readonly prepareDelegateCapability: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
@@ -443,16 +443,19 @@ export function didToVerificationMethod(did) {
|
|
443
443
|
* @param {string} credential
|
444
444
|
* @param {string} proof_options
|
445
445
|
* @param {string} key
|
446
|
+
* @param {string} context_map
|
446
447
|
* @returns {Promise<any>}
|
447
448
|
*/
|
448
|
-
export function issueCredential(credential, proof_options, key) {
|
449
|
+
export function issueCredential(credential, proof_options, key, context_map) {
|
449
450
|
const ptr0 = passStringToWasm0(credential, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
450
451
|
const len0 = WASM_VECTOR_LEN;
|
451
452
|
const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
452
453
|
const len1 = WASM_VECTOR_LEN;
|
453
454
|
const ptr2 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
454
455
|
const len2 = WASM_VECTOR_LEN;
|
455
|
-
const
|
456
|
+
const ptr3 = passStringToWasm0(context_map, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
457
|
+
const len3 = WASM_VECTOR_LEN;
|
458
|
+
const ret = wasm.issueCredential(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
456
459
|
return takeObject(ret);
|
457
460
|
}
|
458
461
|
|
@@ -493,14 +496,17 @@ export function completeIssueCredential(credential, preparation, signature) {
|
|
493
496
|
/**
|
494
497
|
* @param {string} vc
|
495
498
|
* @param {string} proof_options
|
499
|
+
* @param {string} context_map
|
496
500
|
* @returns {Promise<any>}
|
497
501
|
*/
|
498
|
-
export function verifyCredential(vc, proof_options) {
|
502
|
+
export function verifyCredential(vc, proof_options, context_map) {
|
499
503
|
const ptr0 = passStringToWasm0(vc, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
500
504
|
const len0 = WASM_VECTOR_LEN;
|
501
505
|
const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
502
506
|
const len1 = WASM_VECTOR_LEN;
|
503
|
-
const
|
507
|
+
const ptr2 = passStringToWasm0(context_map, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
508
|
+
const len2 = WASM_VECTOR_LEN;
|
509
|
+
const ret = wasm.verifyCredential(ptr0, len0, ptr1, len1, ptr2, len2);
|
504
510
|
return takeObject(ret);
|
505
511
|
}
|
506
512
|
|
@@ -508,16 +514,19 @@ export function verifyCredential(vc, proof_options) {
|
|
508
514
|
* @param {string} presentation
|
509
515
|
* @param {string} proof_options
|
510
516
|
* @param {string} key
|
517
|
+
* @param {string} context_map
|
511
518
|
* @returns {Promise<any>}
|
512
519
|
*/
|
513
|
-
export function issuePresentation(presentation, proof_options, key) {
|
520
|
+
export function issuePresentation(presentation, proof_options, key, context_map) {
|
514
521
|
const ptr0 = passStringToWasm0(presentation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
515
522
|
const len0 = WASM_VECTOR_LEN;
|
516
523
|
const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
517
524
|
const len1 = WASM_VECTOR_LEN;
|
518
525
|
const ptr2 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
519
526
|
const len2 = WASM_VECTOR_LEN;
|
520
|
-
const
|
527
|
+
const ptr3 = passStringToWasm0(context_map, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
528
|
+
const len3 = WASM_VECTOR_LEN;
|
529
|
+
const ret = wasm.issuePresentation(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
521
530
|
return takeObject(ret);
|
522
531
|
}
|
523
532
|
|
@@ -558,14 +567,17 @@ export function completeIssuePresentation(presentation, preparation, signature)
|
|
558
567
|
/**
|
559
568
|
* @param {string} vp
|
560
569
|
* @param {string} proof_options
|
570
|
+
* @param {string} context_map
|
561
571
|
* @returns {Promise<any>}
|
562
572
|
*/
|
563
|
-
export function verifyPresentation(vp, proof_options) {
|
573
|
+
export function verifyPresentation(vp, proof_options, context_map) {
|
564
574
|
const ptr0 = passStringToWasm0(vp, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
565
575
|
const len0 = WASM_VECTOR_LEN;
|
566
576
|
const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
567
577
|
const len1 = WASM_VECTOR_LEN;
|
568
|
-
const
|
578
|
+
const ptr2 = passStringToWasm0(context_map, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
579
|
+
const len2 = WASM_VECTOR_LEN;
|
580
|
+
const ret = wasm.verifyPresentation(ptr0, len0, ptr1, len1, ptr2, len2);
|
569
581
|
return takeObject(ret);
|
570
582
|
}
|
571
583
|
|
@@ -573,16 +585,19 @@ export function verifyPresentation(vp, proof_options) {
|
|
573
585
|
* @param {string} holder
|
574
586
|
* @param {string} linked_data_proof_options
|
575
587
|
* @param {string} key
|
588
|
+
* @param {string} context_map
|
576
589
|
* @returns {Promise<any>}
|
577
590
|
*/
|
578
|
-
export function DIDAuth(holder, linked_data_proof_options, key) {
|
591
|
+
export function DIDAuth(holder, linked_data_proof_options, key, context_map) {
|
579
592
|
const ptr0 = passStringToWasm0(holder, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
580
593
|
const len0 = WASM_VECTOR_LEN;
|
581
594
|
const ptr1 = passStringToWasm0(linked_data_proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
582
595
|
const len1 = WASM_VECTOR_LEN;
|
583
596
|
const ptr2 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
584
597
|
const len2 = WASM_VECTOR_LEN;
|
585
|
-
const
|
598
|
+
const ptr3 = passStringToWasm0(context_map, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
599
|
+
const len3 = WASM_VECTOR_LEN;
|
600
|
+
const ret = wasm.DIDAuth(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
586
601
|
return takeObject(ret);
|
587
602
|
}
|
588
603
|
|
@@ -1123,8 +1138,8 @@ function __wbg_get_imports() {
|
|
1123
1138
|
const ret = wasm.memory;
|
1124
1139
|
return addHeapObject(ret);
|
1125
1140
|
};
|
1126
|
-
imports.wbg.
|
1127
|
-
const ret = makeMutClosure(arg0, arg1,
|
1141
|
+
imports.wbg.__wbindgen_closure_wrapper12794 = function(arg0, arg1, arg2) {
|
1142
|
+
const ret = makeMutClosure(arg0, arg1, 3868, __wbg_adapter_26);
|
1128
1143
|
return addHeapObject(ret);
|
1129
1144
|
};
|
1130
1145
|
|
Binary file
|
@@ -11,15 +11,15 @@ export function generateSecp256k1KeyFromBytes(a: number, b: number, c: number):
|
|
11
11
|
export function keyToDID(a: number, b: number, c: number, d: number, e: number): void;
|
12
12
|
export function keyToVerificationMethod(a: number, b: number, c: number, d: number): number;
|
13
13
|
export function didToVerificationMethod(a: number, b: number): number;
|
14
|
-
export function issueCredential(a: number, b: number, c: number, d: number, e: number, f: number): number;
|
14
|
+
export function issueCredential(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
15
15
|
export function prepareIssueCredential(a: number, b: number, c: number, d: number, e: number, f: number): number;
|
16
16
|
export function completeIssueCredential(a: number, b: number, c: number, d: number, e: number, f: number): number;
|
17
|
-
export function verifyCredential(a: number, b: number, c: number, d: number): number;
|
18
|
-
export function issuePresentation(a: number, b: number, c: number, d: number, e: number, f: number): number;
|
17
|
+
export function verifyCredential(a: number, b: number, c: number, d: number, e: number, f: number): number;
|
18
|
+
export function issuePresentation(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
19
19
|
export function prepareIssuePresentation(a: number, b: number, c: number, d: number, e: number, f: number): number;
|
20
20
|
export function completeIssuePresentation(a: number, b: number, c: number, d: number, e: number, f: number): number;
|
21
|
-
export function verifyPresentation(a: number, b: number, c: number, d: number): number;
|
22
|
-
export function DIDAuth(a: number, b: number, c: number, d: number, e: number, f: number): number;
|
21
|
+
export function verifyPresentation(a: number, b: number, c: number, d: number, e: number, f: number): number;
|
22
|
+
export function DIDAuth(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
23
23
|
export function JWKFromTezos(a: number, b: number): number;
|
24
24
|
export function delegateCapability(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
25
25
|
export function prepareDelegateCapability(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
@@ -340,43 +340,51 @@ function didToVerificationMethod(did) {
|
|
340
340
|
return takeObject(ret);
|
341
341
|
}
|
342
342
|
__name(didToVerificationMethod, "didToVerificationMethod");
|
343
|
-
function issueCredential(credential, proof_options, key) {
|
343
|
+
function issueCredential(credential, proof_options, key, context_map) {
|
344
344
|
const ptr0 = passStringToWasm0(credential, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
345
345
|
const len0 = WASM_VECTOR_LEN;
|
346
346
|
const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
347
347
|
const len1 = WASM_VECTOR_LEN;
|
348
348
|
const ptr2 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
349
349
|
const len2 = WASM_VECTOR_LEN;
|
350
|
-
const
|
350
|
+
const ptr3 = passStringToWasm0(context_map, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
351
|
+
const len3 = WASM_VECTOR_LEN;
|
352
|
+
const ret = wasm.issueCredential(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
351
353
|
return takeObject(ret);
|
352
354
|
}
|
353
355
|
__name(issueCredential, "issueCredential");
|
354
|
-
function verifyCredential(vc, proof_options) {
|
356
|
+
function verifyCredential(vc, proof_options, context_map) {
|
355
357
|
const ptr0 = passStringToWasm0(vc, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
356
358
|
const len0 = WASM_VECTOR_LEN;
|
357
359
|
const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
358
360
|
const len1 = WASM_VECTOR_LEN;
|
359
|
-
const
|
361
|
+
const ptr2 = passStringToWasm0(context_map, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
362
|
+
const len2 = WASM_VECTOR_LEN;
|
363
|
+
const ret = wasm.verifyCredential(ptr0, len0, ptr1, len1, ptr2, len2);
|
360
364
|
return takeObject(ret);
|
361
365
|
}
|
362
366
|
__name(verifyCredential, "verifyCredential");
|
363
|
-
function issuePresentation(presentation, proof_options, key) {
|
367
|
+
function issuePresentation(presentation, proof_options, key, context_map) {
|
364
368
|
const ptr0 = passStringToWasm0(presentation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
365
369
|
const len0 = WASM_VECTOR_LEN;
|
366
370
|
const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
367
371
|
const len1 = WASM_VECTOR_LEN;
|
368
372
|
const ptr2 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
369
373
|
const len2 = WASM_VECTOR_LEN;
|
370
|
-
const
|
374
|
+
const ptr3 = passStringToWasm0(context_map, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
375
|
+
const len3 = WASM_VECTOR_LEN;
|
376
|
+
const ret = wasm.issuePresentation(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
371
377
|
return takeObject(ret);
|
372
378
|
}
|
373
379
|
__name(issuePresentation, "issuePresentation");
|
374
|
-
function verifyPresentation(vp, proof_options) {
|
380
|
+
function verifyPresentation(vp, proof_options, context_map) {
|
375
381
|
const ptr0 = passStringToWasm0(vp, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
376
382
|
const len0 = WASM_VECTOR_LEN;
|
377
383
|
const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
378
384
|
const len1 = WASM_VECTOR_LEN;
|
379
|
-
const
|
385
|
+
const ptr2 = passStringToWasm0(context_map, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
386
|
+
const len2 = WASM_VECTOR_LEN;
|
387
|
+
const ret = wasm.verifyPresentation(ptr0, len0, ptr1, len1, ptr2, len2);
|
380
388
|
return takeObject(ret);
|
381
389
|
}
|
382
390
|
__name(verifyPresentation, "verifyPresentation");
|
@@ -787,8 +795,8 @@ function __wbg_get_imports() {
|
|
787
795
|
const ret = wasm.memory;
|
788
796
|
return addHeapObject(ret);
|
789
797
|
};
|
790
|
-
imports.wbg.
|
791
|
-
const ret = makeMutClosure(arg0, arg1,
|
798
|
+
imports.wbg.__wbindgen_closure_wrapper12794 = function(arg0, arg1, arg2) {
|
799
|
+
const ret = makeMutClosure(arg0, arg1, 3868, __wbg_adapter_26);
|
792
800
|
return addHeapObject(ret);
|
793
801
|
};
|
794
802
|
return imports;
|
@@ -825,7 +833,7 @@ var didkit_wasm_default = __wbg_init;
|
|
825
833
|
// src/didkit/index.ts
|
826
834
|
var initialized = false;
|
827
835
|
var generating = false;
|
828
|
-
var init = /* @__PURE__ */ __name(async (arg = "https://cdn.filestackcontent.com/
|
836
|
+
var init = /* @__PURE__ */ __name(async (arg = "https://cdn.filestackcontent.com/H678qYhTQLK7BPiqglZK") => {
|
829
837
|
while (generating)
|
830
838
|
await new Promise((res) => setTimeout(res, 250));
|
831
839
|
if (initialized)
|
@@ -842,14 +850,54 @@ var init = /* @__PURE__ */ __name(async (arg = "https://cdn.filestackcontent.com
|
|
842
850
|
}, "init");
|
843
851
|
var didkit_default = init;
|
844
852
|
|
853
|
+
// src/helpers.ts
|
854
|
+
var getContextURIs = /* @__PURE__ */ __name((jsonld) => {
|
855
|
+
const contexts = [];
|
856
|
+
const traverse = /* @__PURE__ */ __name((obj) => {
|
857
|
+
if (typeof obj !== "object" || obj === null)
|
858
|
+
return;
|
859
|
+
if (obj["@context"]) {
|
860
|
+
if (Array.isArray(obj["@context"]))
|
861
|
+
contexts.push(...obj["@context"]);
|
862
|
+
else
|
863
|
+
contexts.push(obj["@context"]);
|
864
|
+
}
|
865
|
+
Object.keys(obj).forEach((key) => {
|
866
|
+
traverse(obj[key]);
|
867
|
+
});
|
868
|
+
}, "traverse");
|
869
|
+
traverse(jsonld);
|
870
|
+
return contexts;
|
871
|
+
}, "getContextURIs");
|
872
|
+
var getDocumentMap = /* @__PURE__ */ __name(async (learnCard, obj, allowRemoteContexts = false) => {
|
873
|
+
const uris = getContextURIs(obj);
|
874
|
+
const resolvedDocs = await Promise.all(uris.map(async (uri) => learnCard.context.resolveDocument(uri, allowRemoteContexts)));
|
875
|
+
return uris.reduce((acc, cur, index) => {
|
876
|
+
const resolvedDoc = resolvedDocs[index];
|
877
|
+
if (resolvedDoc)
|
878
|
+
acc[cur] = JSON.stringify(resolvedDoc);
|
879
|
+
return acc;
|
880
|
+
}, {});
|
881
|
+
}, "getDocumentMap");
|
882
|
+
|
845
883
|
// src/plugin.ts
|
846
|
-
var getDidKitPlugin = /* @__PURE__ */ __name(async (input) => {
|
884
|
+
var getDidKitPlugin = /* @__PURE__ */ __name(async (input, allowRemoteContexts = false) => {
|
847
885
|
await didkit_default(input);
|
848
886
|
const memoizedDids = {};
|
849
887
|
return {
|
850
888
|
name: "DIDKit",
|
851
889
|
displayName: "DIDKit",
|
852
890
|
description: "Provides an interface to DIDKit, which allows for the generation of key material, as well as signing and verifying credentials and presentations",
|
891
|
+
context: {
|
892
|
+
resolveStaticDocument: async (_learnCard, url) => {
|
893
|
+
try {
|
894
|
+
return JSON.parse(await contextLoader(url) ?? "") || void 0;
|
895
|
+
} catch (error) {
|
896
|
+
_learnCard.debug?.(error);
|
897
|
+
return void 0;
|
898
|
+
}
|
899
|
+
}
|
900
|
+
},
|
853
901
|
methods: {
|
854
902
|
generateEd25519KeyFromBytes: (_learnCard, bytes) => JSON.parse(generateEd25519KeyFromBytes(bytes)),
|
855
903
|
generateSecp256k1KeyFromBytes: (_learnCard, bytes) => JSON.parse(generateSecp256k1KeyFromBytes(bytes)),
|
@@ -864,18 +912,29 @@ var getDidKitPlugin = /* @__PURE__ */ __name(async (input) => {
|
|
864
912
|
},
|
865
913
|
keyToVerificationMethod: async (_learnCard, type, keypair) => keyToVerificationMethod(type, JSON.stringify(keypair)),
|
866
914
|
didToVerificationMethod: async (_learnCard, did) => didToVerificationMethod(did),
|
867
|
-
issueCredential: async (_learnCard, credential, options, keypair) =>
|
868
|
-
|
915
|
+
issueCredential: async (_learnCard, credential, options, keypair) => {
|
916
|
+
return JSON.parse(await issueCredential(JSON.stringify(credential), JSON.stringify(options), JSON.stringify(keypair), JSON.stringify(await getDocumentMap(_learnCard, credential, allowRemoteContexts))));
|
917
|
+
},
|
918
|
+
verifyCredential: async (_learnCard, credential, options = {}) => {
|
919
|
+
return JSON.parse(await verifyCredential(JSON.stringify(credential), JSON.stringify(options), JSON.stringify(await getDocumentMap(_learnCard, credential, allowRemoteContexts))));
|
920
|
+
},
|
869
921
|
issuePresentation: async (_learnCard, presentation, options, keypair) => {
|
870
922
|
const isJwt = options.proofFormat === "jwt";
|
871
|
-
const result = await issuePresentation(JSON.stringify(presentation), JSON.stringify(options), JSON.stringify(keypair));
|
923
|
+
const result = await issuePresentation(JSON.stringify(presentation), JSON.stringify(options), JSON.stringify(keypair), JSON.stringify(await getDocumentMap(_learnCard, presentation, allowRemoteContexts)));
|
872
924
|
return isJwt ? result : JSON.parse(result);
|
873
925
|
},
|
874
926
|
verifyPresentation: async (_learnCard, presentation, options = {}) => {
|
875
927
|
const isJwt = typeof presentation === "string";
|
876
|
-
return JSON.parse(await verifyPresentation(isJwt ? presentation : JSON.stringify(presentation), JSON.stringify(options)));
|
928
|
+
return JSON.parse(await verifyPresentation(isJwt ? presentation : JSON.stringify(presentation), JSON.stringify(options), isJwt ? "{}" : JSON.stringify(await getDocumentMap(_learnCard, presentation, allowRemoteContexts))));
|
929
|
+
},
|
930
|
+
contextLoader: async (_learnCard, url) => {
|
931
|
+
try {
|
932
|
+
return JSON.parse(await contextLoader(url) ?? "") || void 0;
|
933
|
+
} catch (error) {
|
934
|
+
_learnCard.debug?.(error);
|
935
|
+
return void 0;
|
936
|
+
}
|
877
937
|
},
|
878
|
-
contextLoader: async (_learnCard, url) => JSON.parse(await contextLoader(url)),
|
879
938
|
resolveDid: async (_learnCard, did, inputMetadata = {}) => JSON.parse(await resolveDID(did, JSON.stringify(inputMetadata))),
|
880
939
|
didResolver: async (_learnCard, did, inputMetadata = {}) => JSON.parse(await didResolver(did, JSON.stringify(inputMetadata)))
|
881
940
|
}
|