@learncard/core 8.4.2 → 8.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. package/dist/core.cjs.development.js +2277 -1682
  2. package/dist/core.cjs.development.js.map +4 -4
  3. package/dist/core.cjs.production.min.js +117 -111
  4. package/dist/core.cjs.production.min.js.map +4 -4
  5. package/dist/core.esm.js +2277 -1682
  6. package/dist/core.esm.js.map +4 -4
  7. package/dist/didkit/didkit_wasm.d.ts +15 -2
  8. package/dist/didkit/didkit_wasm.js +44 -19
  9. package/dist/didkit/didkit_wasm_bg.wasm +0 -0
  10. package/dist/didkit/didkit_wasm_bg.wasm.d.ts +4 -2
  11. package/dist/didkit/index.d.ts +4 -0
  12. package/dist/didkit_wasm.d.ts +15 -2
  13. package/dist/didkit_wasm.js +44 -19
  14. package/dist/didkit_wasm_bg.wasm +0 -0
  15. package/dist/didkit_wasm_bg.wasm.d.ts +4 -2
  16. package/dist/index.d.ts +7 -0
  17. package/dist/polyfills.d.ts +2 -0
  18. package/dist/types/LearnCard.d.ts +63 -0
  19. package/dist/types/helpers.d.ts +18 -0
  20. package/dist/types/planes.d.ts +77 -0
  21. package/dist/types/utilities.d.ts +14 -0
  22. package/dist/types/wallet.d.ts +52 -0
  23. package/dist/wallet/base/crypto.d.ts +2 -0
  24. package/dist/wallet/base/helpers.d.ts +16 -0
  25. package/dist/wallet/base/index.d.ts +2 -0
  26. package/dist/wallet/base/wallet.d.ts +15 -0
  27. package/dist/wallet/defaults.d.ts +5 -0
  28. package/dist/wallet/init.d.ts +29 -0
  29. package/dist/wallet/initializers/apiLearnCard.d.ts +14 -0
  30. package/dist/wallet/initializers/customLearnCard.d.ts +7 -0
  31. package/dist/wallet/initializers/emptyLearnCard.d.ts +7 -0
  32. package/dist/wallet/initializers/learnCardFromSeed.d.ts +7 -0
  33. package/dist/wallet/plugins/EthereumPlugin/hardcodedTokens.d.ts +22 -0
  34. package/dist/wallet/plugins/EthereumPlugin/helpers.d.ts +7 -0
  35. package/dist/wallet/plugins/EthereumPlugin/index.d.ts +7 -0
  36. package/dist/wallet/plugins/EthereumPlugin/types.d.ts +32 -0
  37. package/dist/wallet/plugins/ceramic/ceramic.d.ts +215 -0
  38. package/dist/wallet/plugins/ceramic/helpers.d.ts +3 -0
  39. package/dist/wallet/plugins/ceramic/index.d.ts +4 -0
  40. package/dist/wallet/plugins/ceramic/types.d.ts +43 -0
  41. package/dist/wallet/plugins/chapi/chapi.d.ts +5 -0
  42. package/dist/wallet/plugins/chapi/index.d.ts +2 -0
  43. package/dist/wallet/plugins/chapi/types.d.ts +88 -0
  44. package/dist/wallet/plugins/didkey/helpers.d.ts +4 -0
  45. package/dist/wallet/plugins/didkey/index.d.ts +217 -0
  46. package/dist/wallet/plugins/didkey/types.d.ts +18 -0
  47. package/dist/wallet/plugins/didkit/index.d.ts +8 -0
  48. package/dist/wallet/plugins/didkit/types.d.ts +40 -0
  49. package/dist/wallet/plugins/expiration/index.d.ts +7 -0
  50. package/dist/wallet/plugins/expiration/types.d.ts +3 -0
  51. package/dist/wallet/plugins/idx/idx.d.ts +6 -0
  52. package/dist/wallet/plugins/idx/index.d.ts +4 -0
  53. package/dist/wallet/plugins/idx/types.d.ts +54 -0
  54. package/dist/wallet/plugins/index.d.ts +14 -0
  55. package/dist/wallet/plugins/learn-card/index.d.ts +7 -0
  56. package/dist/wallet/plugins/learn-card/types.d.ts +17 -0
  57. package/dist/wallet/plugins/learn-card/verify.d.ts +215 -0
  58. package/dist/wallet/plugins/test-cache/index.d.ts +2 -0
  59. package/dist/wallet/plugins/test-cache/types.d.ts +2 -0
  60. package/dist/wallet/plugins/test-index/index.d.ts +2 -0
  61. package/dist/wallet/plugins/test-index/types.d.ts +2 -0
  62. package/dist/wallet/plugins/test-storage/index.d.ts +2 -0
  63. package/dist/wallet/plugins/test-storage/types.d.ts +2 -0
  64. package/dist/wallet/plugins/vc/index.d.ts +2 -0
  65. package/dist/wallet/plugins/vc/issueCredential.d.ts +98 -0
  66. package/dist/wallet/plugins/vc/issuePresentation.d.ts +220 -0
  67. package/dist/wallet/plugins/vc/types.d.ts +35 -0
  68. package/dist/wallet/plugins/vc/vc.d.ts +5 -0
  69. package/dist/wallet/plugins/vc/verifyCredential.d.ts +8 -0
  70. package/dist/wallet/plugins/vc/verifyPresentation.d.ts +8 -0
  71. package/dist/wallet/plugins/vc-api/helpers.d.ts +8 -0
  72. package/dist/wallet/plugins/vc-api/index.d.ts +8 -0
  73. package/dist/wallet/plugins/vc-api/types.d.ts +20 -0
  74. package/dist/wallet/plugins/vc-resolution/index.d.ts +6 -0
  75. package/dist/wallet/plugins/vc-resolution/types.d.ts +13 -0
  76. package/dist/wallet/plugins/vc-templates/index.d.ts +2 -0
  77. package/dist/wallet/plugins/vc-templates/templates.d.ts +6 -0
  78. package/dist/wallet/plugins/vc-templates/types.d.ts +68 -0
  79. package/dist/wallet/plugins/vc-templates/vc-templates.d.ts +5 -0
  80. package/dist/wallet/plugins/vpqr/index.d.ts +7 -0
  81. package/dist/wallet/plugins/vpqr/types.d.ts +12 -0
  82. package/package.json +13 -11
  83. package/dist/core.d.ts +0 -6009
@@ -9,6 +9,12 @@ export function getVersion(): string;
9
9
  * @param {string} input_metadata
10
10
  * @returns {Promise<any>}
11
11
  */
12
+ export function didResolver(did: string, input_metadata: string): Promise<any>;
13
+ /**
14
+ * @param {string} did
15
+ * @param {string} input_metadata
16
+ * @returns {Promise<any>}
17
+ */
12
18
  export function resolveDID(did: string, input_metadata: string): Promise<any>;
13
19
  /**
14
20
  * @returns {string}
@@ -41,6 +47,11 @@ export function keyToDID(method_pattern: string, jwk: string): string;
41
47
  */
42
48
  export function keyToVerificationMethod(method_pattern: string, jwk: string): Promise<any>;
43
49
  /**
50
+ * @param {string} did
51
+ * @returns {Promise<any>}
52
+ */
53
+ export function didToVerificationMethod(did: string): Promise<any>;
54
+ /**
44
55
  * @param {string} credential
45
56
  * @param {string} proof_options
46
57
  * @param {string} key
@@ -179,6 +190,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
179
190
  export interface InitOutput {
180
191
  readonly memory: WebAssembly.Memory;
181
192
  readonly getVersion: (a: number) => void;
193
+ readonly didResolver: (a: number, b: number, c: number, d: number) => number;
182
194
  readonly resolveDID: (a: number, b: number, c: number, d: number) => number;
183
195
  readonly generateEd25519Key: (a: number) => void;
184
196
  readonly generateEd25519KeyFromBytes: (a: number, b: number, c: number) => void;
@@ -186,6 +198,7 @@ export interface InitOutput {
186
198
  readonly generateSecp256k1KeyFromBytes: (a: number, b: number, c: number) => void;
187
199
  readonly keyToDID: (a: number, b: number, c: number, d: number, e: number) => void;
188
200
  readonly keyToVerificationMethod: (a: number, b: number, c: number, d: number) => number;
201
+ readonly didToVerificationMethod: (a: number, b: number) => number;
189
202
  readonly issueCredential: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
190
203
  readonly prepareIssueCredential: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
191
204
  readonly completeIssueCredential: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
@@ -211,11 +224,11 @@ export interface InitOutput {
211
224
  readonly __wbindgen_malloc: (a: number) => number;
212
225
  readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
213
226
  readonly __wbindgen_export_2: WebAssembly.Table;
214
- readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h93b9577b462bda3f: (a: number, b: number, c: number) => void;
227
+ readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf6251ee6687a20b8: (a: number, b: number, c: number) => void;
215
228
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
216
229
  readonly __wbindgen_free: (a: number, b: number) => void;
217
230
  readonly __wbindgen_exn_store: (a: number) => void;
218
- readonly wasm_bindgen__convert__closures__invoke2_mut__h5199611bd19f62fe: (a: number, b: number, c: number, d: number) => void;
231
+ readonly wasm_bindgen__convert__closures__invoke2_mut__h63ffd509f6690aab: (a: number, b: number, c: number, d: number) => void;
219
232
  }
220
233
 
221
234
  /**
@@ -205,7 +205,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
205
205
  return real;
206
206
  }
207
207
  function __wbg_adapter_26(arg0, arg1, arg2) {
208
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h93b9577b462bda3f(arg0, arg1, addHeapObject(arg2));
208
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf6251ee6687a20b8(arg0, arg1, addHeapObject(arg2));
209
209
  }
210
210
 
211
211
  /**
@@ -224,6 +224,20 @@ export function getVersion() {
224
224
  }
225
225
  }
226
226
 
227
+ /**
228
+ * @param {string} did
229
+ * @param {string} input_metadata
230
+ * @returns {Promise<any>}
231
+ */
232
+ export function didResolver(did, input_metadata) {
233
+ const ptr0 = passStringToWasm0(did, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
234
+ const len0 = WASM_VECTOR_LEN;
235
+ const ptr1 = passStringToWasm0(input_metadata, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
236
+ const len1 = WASM_VECTOR_LEN;
237
+ const ret = wasm.didResolver(ptr0, len0, ptr1, len1);
238
+ return takeObject(ret);
239
+ }
240
+
227
241
  /**
228
242
  * @param {string} did
229
243
  * @param {string} input_metadata
@@ -390,6 +404,17 @@ export function keyToVerificationMethod(method_pattern, jwk) {
390
404
  return takeObject(ret);
391
405
  }
392
406
 
407
+ /**
408
+ * @param {string} did
409
+ * @returns {Promise<any>}
410
+ */
411
+ export function didToVerificationMethod(did) {
412
+ const ptr0 = passStringToWasm0(did, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
413
+ const len0 = WASM_VECTOR_LEN;
414
+ const ret = wasm.didToVerificationMethod(ptr0, len0);
415
+ return takeObject(ret);
416
+ }
417
+
393
418
  /**
394
419
  * @param {string} credential
395
420
  * @param {string} proof_options
@@ -720,8 +745,8 @@ function handleError(f, args) {
720
745
  function getArrayU8FromWasm0(ptr, len) {
721
746
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
722
747
  }
723
- function __wbg_adapter_131(arg0, arg1, arg2, arg3) {
724
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h5199611bd19f62fe(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
748
+ function __wbg_adapter_133(arg0, arg1, arg2, arg3) {
749
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h63ffd509f6690aab(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
725
750
  }
726
751
 
727
752
  async function load(module, imports) {
@@ -828,6 +853,12 @@ function getImports() {
828
853
  const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
829
854
  return addHeapObject(ret);
830
855
  }, arguments) };
856
+ imports.wbg.__wbg_randomFillSync_91e2b39becca6147 = function() { return handleError(function (arg0, arg1, arg2) {
857
+ getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
858
+ }, arguments) };
859
+ imports.wbg.__wbg_getRandomValues_b14734aa289bc356 = function() { return handleError(function (arg0, arg1) {
860
+ getObject(arg0).getRandomValues(getObject(arg1));
861
+ }, arguments) };
831
862
  imports.wbg.__wbg_process_e56fd54cf6319b6c = function(arg0) {
832
863
  const ret = getObject(arg0).process;
833
864
  return addHeapObject(ret);
@@ -849,14 +880,6 @@ function getImports() {
849
880
  const ret = typeof(getObject(arg0)) === 'string';
850
881
  return ret;
851
882
  };
852
- imports.wbg.__wbg_static_accessor_NODE_MODULE_26b231378c1be7dd = function() {
853
- const ret = module;
854
- return addHeapObject(ret);
855
- };
856
- imports.wbg.__wbg_require_0db1598d9ccecb30 = function() { return handleError(function (arg0, arg1, arg2) {
857
- const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
858
- return addHeapObject(ret);
859
- }, arguments) };
860
883
  imports.wbg.__wbg_crypto_b95d7173266618a9 = function(arg0) {
861
884
  const ret = getObject(arg0).crypto;
862
885
  return addHeapObject(ret);
@@ -865,11 +888,13 @@ function getImports() {
865
888
  const ret = getObject(arg0).msCrypto;
866
889
  return addHeapObject(ret);
867
890
  };
868
- imports.wbg.__wbg_getRandomValues_b14734aa289bc356 = function() { return handleError(function (arg0, arg1) {
869
- getObject(arg0).getRandomValues(getObject(arg1));
870
- }, arguments) };
871
- imports.wbg.__wbg_randomFillSync_91e2b39becca6147 = function() { return handleError(function (arg0, arg1, arg2) {
872
- getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
891
+ imports.wbg.__wbg_static_accessor_NODE_MODULE_26b231378c1be7dd = function() {
892
+ const ret = module;
893
+ return addHeapObject(ret);
894
+ };
895
+ imports.wbg.__wbg_require_0db1598d9ccecb30 = function() { return handleError(function (arg0, arg1, arg2) {
896
+ const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
897
+ return addHeapObject(ret);
873
898
  }, arguments) };
874
899
  imports.wbg.__wbg_randomFillSync_d2ba53160aec6aba = function(arg0, arg1, arg2) {
875
900
  getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
@@ -980,7 +1005,7 @@ function getImports() {
980
1005
  const a = state0.a;
981
1006
  state0.a = 0;
982
1007
  try {
983
- return __wbg_adapter_131(a, state0.b, arg0, arg1);
1008
+ return __wbg_adapter_133(a, state0.b, arg0, arg1);
984
1009
  } finally {
985
1010
  state0.a = a;
986
1011
  }
@@ -1056,8 +1081,8 @@ function getImports() {
1056
1081
  const ret = wasm.memory;
1057
1082
  return addHeapObject(ret);
1058
1083
  };
1059
- imports.wbg.__wbindgen_closure_wrapper11031 = function(arg0, arg1, arg2) {
1060
- const ret = makeMutClosure(arg0, arg1, 3193, __wbg_adapter_26);
1084
+ imports.wbg.__wbindgen_closure_wrapper9508 = function(arg0, arg1, arg2) {
1085
+ const ret = makeMutClosure(arg0, arg1, 2773, __wbg_adapter_26);
1061
1086
  return addHeapObject(ret);
1062
1087
  };
1063
1088
 
Binary file
@@ -2,6 +2,7 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export function getVersion(a: number): void;
5
+ export function didResolver(a: number, b: number, c: number, d: number): number;
5
6
  export function resolveDID(a: number, b: number, c: number, d: number): number;
6
7
  export function generateEd25519Key(a: number): void;
7
8
  export function generateEd25519KeyFromBytes(a: number, b: number, c: number): void;
@@ -9,6 +10,7 @@ export function generateSecp256k1Key(a: number): void;
9
10
  export function generateSecp256k1KeyFromBytes(a: number, b: number, c: number): void;
10
11
  export function keyToDID(a: number, b: number, c: number, d: number, e: number): void;
11
12
  export function keyToVerificationMethod(a: number, b: number, c: number, d: number): number;
13
+ export function didToVerificationMethod(a: number, b: number): number;
12
14
  export function issueCredential(a: number, b: number, c: number, d: number, e: number, f: number): number;
13
15
  export function prepareIssueCredential(a: number, b: number, c: number, d: number, e: number, f: number): number;
14
16
  export function completeIssueCredential(a: number, b: number, c: number, d: number, e: number, f: number): number;
@@ -34,8 +36,8 @@ export function didkit_error_code(): number;
34
36
  export function __wbindgen_malloc(a: number): number;
35
37
  export function __wbindgen_realloc(a: number, b: number, c: number): number;
36
38
  export const __wbindgen_export_2: WebAssembly.Table;
37
- export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h93b9577b462bda3f(a: number, b: number, c: number): void;
39
+ export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf6251ee6687a20b8(a: number, b: number, c: number): void;
38
40
  export function __wbindgen_add_to_stack_pointer(a: number): number;
39
41
  export function __wbindgen_free(a: number, b: number): void;
40
42
  export function __wbindgen_exn_store(a: number): void;
41
- export function wasm_bindgen__convert__closures__invoke2_mut__h5199611bd19f62fe(a: number, b: number, c: number, d: number): void;
43
+ export function wasm_bindgen__convert__closures__invoke2_mut__h63ffd509f6690aab(a: number, b: number, c: number, d: number): void;
@@ -0,0 +1,4 @@
1
+ import { InitInput } from './pkg/didkit_wasm';
2
+ export * from './pkg/didkit_wasm';
3
+ export declare const init: (arg?: InitInput | Promise<InitInput>) => Promise<import("./pkg/didkit_wasm").InitOutput | undefined>;
4
+ export default init;
@@ -9,6 +9,12 @@ export function getVersion(): string;
9
9
  * @param {string} input_metadata
10
10
  * @returns {Promise<any>}
11
11
  */
12
+ export function didResolver(did: string, input_metadata: string): Promise<any>;
13
+ /**
14
+ * @param {string} did
15
+ * @param {string} input_metadata
16
+ * @returns {Promise<any>}
17
+ */
12
18
  export function resolveDID(did: string, input_metadata: string): Promise<any>;
13
19
  /**
14
20
  * @returns {string}
@@ -41,6 +47,11 @@ export function keyToDID(method_pattern: string, jwk: string): string;
41
47
  */
42
48
  export function keyToVerificationMethod(method_pattern: string, jwk: string): Promise<any>;
43
49
  /**
50
+ * @param {string} did
51
+ * @returns {Promise<any>}
52
+ */
53
+ export function didToVerificationMethod(did: string): Promise<any>;
54
+ /**
44
55
  * @param {string} credential
45
56
  * @param {string} proof_options
46
57
  * @param {string} key
@@ -179,6 +190,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
179
190
  export interface InitOutput {
180
191
  readonly memory: WebAssembly.Memory;
181
192
  readonly getVersion: (a: number) => void;
193
+ readonly didResolver: (a: number, b: number, c: number, d: number) => number;
182
194
  readonly resolveDID: (a: number, b: number, c: number, d: number) => number;
183
195
  readonly generateEd25519Key: (a: number) => void;
184
196
  readonly generateEd25519KeyFromBytes: (a: number, b: number, c: number) => void;
@@ -186,6 +198,7 @@ export interface InitOutput {
186
198
  readonly generateSecp256k1KeyFromBytes: (a: number, b: number, c: number) => void;
187
199
  readonly keyToDID: (a: number, b: number, c: number, d: number, e: number) => void;
188
200
  readonly keyToVerificationMethod: (a: number, b: number, c: number, d: number) => number;
201
+ readonly didToVerificationMethod: (a: number, b: number) => number;
189
202
  readonly issueCredential: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
190
203
  readonly prepareIssueCredential: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
191
204
  readonly completeIssueCredential: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
@@ -211,11 +224,11 @@ export interface InitOutput {
211
224
  readonly __wbindgen_malloc: (a: number) => number;
212
225
  readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
213
226
  readonly __wbindgen_export_2: WebAssembly.Table;
214
- readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h93b9577b462bda3f: (a: number, b: number, c: number) => void;
227
+ readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf6251ee6687a20b8: (a: number, b: number, c: number) => void;
215
228
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
216
229
  readonly __wbindgen_free: (a: number, b: number) => void;
217
230
  readonly __wbindgen_exn_store: (a: number) => void;
218
- readonly wasm_bindgen__convert__closures__invoke2_mut__h5199611bd19f62fe: (a: number, b: number, c: number, d: number) => void;
231
+ readonly wasm_bindgen__convert__closures__invoke2_mut__h63ffd509f6690aab: (a: number, b: number, c: number, d: number) => void;
219
232
  }
220
233
 
221
234
  /**
@@ -205,7 +205,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
205
205
  return real;
206
206
  }
207
207
  function __wbg_adapter_26(arg0, arg1, arg2) {
208
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h93b9577b462bda3f(arg0, arg1, addHeapObject(arg2));
208
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf6251ee6687a20b8(arg0, arg1, addHeapObject(arg2));
209
209
  }
210
210
 
211
211
  /**
@@ -224,6 +224,20 @@ export function getVersion() {
224
224
  }
225
225
  }
226
226
 
227
+ /**
228
+ * @param {string} did
229
+ * @param {string} input_metadata
230
+ * @returns {Promise<any>}
231
+ */
232
+ export function didResolver(did, input_metadata) {
233
+ const ptr0 = passStringToWasm0(did, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
234
+ const len0 = WASM_VECTOR_LEN;
235
+ const ptr1 = passStringToWasm0(input_metadata, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
236
+ const len1 = WASM_VECTOR_LEN;
237
+ const ret = wasm.didResolver(ptr0, len0, ptr1, len1);
238
+ return takeObject(ret);
239
+ }
240
+
227
241
  /**
228
242
  * @param {string} did
229
243
  * @param {string} input_metadata
@@ -390,6 +404,17 @@ export function keyToVerificationMethod(method_pattern, jwk) {
390
404
  return takeObject(ret);
391
405
  }
392
406
 
407
+ /**
408
+ * @param {string} did
409
+ * @returns {Promise<any>}
410
+ */
411
+ export function didToVerificationMethod(did) {
412
+ const ptr0 = passStringToWasm0(did, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
413
+ const len0 = WASM_VECTOR_LEN;
414
+ const ret = wasm.didToVerificationMethod(ptr0, len0);
415
+ return takeObject(ret);
416
+ }
417
+
393
418
  /**
394
419
  * @param {string} credential
395
420
  * @param {string} proof_options
@@ -720,8 +745,8 @@ function handleError(f, args) {
720
745
  function getArrayU8FromWasm0(ptr, len) {
721
746
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
722
747
  }
723
- function __wbg_adapter_131(arg0, arg1, arg2, arg3) {
724
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h5199611bd19f62fe(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
748
+ function __wbg_adapter_133(arg0, arg1, arg2, arg3) {
749
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h63ffd509f6690aab(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
725
750
  }
726
751
 
727
752
  async function load(module, imports) {
@@ -828,6 +853,12 @@ function getImports() {
828
853
  const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
829
854
  return addHeapObject(ret);
830
855
  }, arguments) };
856
+ imports.wbg.__wbg_randomFillSync_91e2b39becca6147 = function() { return handleError(function (arg0, arg1, arg2) {
857
+ getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
858
+ }, arguments) };
859
+ imports.wbg.__wbg_getRandomValues_b14734aa289bc356 = function() { return handleError(function (arg0, arg1) {
860
+ getObject(arg0).getRandomValues(getObject(arg1));
861
+ }, arguments) };
831
862
  imports.wbg.__wbg_process_e56fd54cf6319b6c = function(arg0) {
832
863
  const ret = getObject(arg0).process;
833
864
  return addHeapObject(ret);
@@ -849,14 +880,6 @@ function getImports() {
849
880
  const ret = typeof(getObject(arg0)) === 'string';
850
881
  return ret;
851
882
  };
852
- imports.wbg.__wbg_static_accessor_NODE_MODULE_26b231378c1be7dd = function() {
853
- const ret = module;
854
- return addHeapObject(ret);
855
- };
856
- imports.wbg.__wbg_require_0db1598d9ccecb30 = function() { return handleError(function (arg0, arg1, arg2) {
857
- const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
858
- return addHeapObject(ret);
859
- }, arguments) };
860
883
  imports.wbg.__wbg_crypto_b95d7173266618a9 = function(arg0) {
861
884
  const ret = getObject(arg0).crypto;
862
885
  return addHeapObject(ret);
@@ -865,11 +888,13 @@ function getImports() {
865
888
  const ret = getObject(arg0).msCrypto;
866
889
  return addHeapObject(ret);
867
890
  };
868
- imports.wbg.__wbg_getRandomValues_b14734aa289bc356 = function() { return handleError(function (arg0, arg1) {
869
- getObject(arg0).getRandomValues(getObject(arg1));
870
- }, arguments) };
871
- imports.wbg.__wbg_randomFillSync_91e2b39becca6147 = function() { return handleError(function (arg0, arg1, arg2) {
872
- getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
891
+ imports.wbg.__wbg_static_accessor_NODE_MODULE_26b231378c1be7dd = function() {
892
+ const ret = module;
893
+ return addHeapObject(ret);
894
+ };
895
+ imports.wbg.__wbg_require_0db1598d9ccecb30 = function() { return handleError(function (arg0, arg1, arg2) {
896
+ const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
897
+ return addHeapObject(ret);
873
898
  }, arguments) };
874
899
  imports.wbg.__wbg_randomFillSync_d2ba53160aec6aba = function(arg0, arg1, arg2) {
875
900
  getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
@@ -980,7 +1005,7 @@ function getImports() {
980
1005
  const a = state0.a;
981
1006
  state0.a = 0;
982
1007
  try {
983
- return __wbg_adapter_131(a, state0.b, arg0, arg1);
1008
+ return __wbg_adapter_133(a, state0.b, arg0, arg1);
984
1009
  } finally {
985
1010
  state0.a = a;
986
1011
  }
@@ -1056,8 +1081,8 @@ function getImports() {
1056
1081
  const ret = wasm.memory;
1057
1082
  return addHeapObject(ret);
1058
1083
  };
1059
- imports.wbg.__wbindgen_closure_wrapper11031 = function(arg0, arg1, arg2) {
1060
- const ret = makeMutClosure(arg0, arg1, 3193, __wbg_adapter_26);
1084
+ imports.wbg.__wbindgen_closure_wrapper9508 = function(arg0, arg1, arg2) {
1085
+ const ret = makeMutClosure(arg0, arg1, 2773, __wbg_adapter_26);
1061
1086
  return addHeapObject(ret);
1062
1087
  };
1063
1088
 
Binary file
@@ -2,6 +2,7 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export function getVersion(a: number): void;
5
+ export function didResolver(a: number, b: number, c: number, d: number): number;
5
6
  export function resolveDID(a: number, b: number, c: number, d: number): number;
6
7
  export function generateEd25519Key(a: number): void;
7
8
  export function generateEd25519KeyFromBytes(a: number, b: number, c: number): void;
@@ -9,6 +10,7 @@ export function generateSecp256k1Key(a: number): void;
9
10
  export function generateSecp256k1KeyFromBytes(a: number, b: number, c: number): void;
10
11
  export function keyToDID(a: number, b: number, c: number, d: number, e: number): void;
11
12
  export function keyToVerificationMethod(a: number, b: number, c: number, d: number): number;
13
+ export function didToVerificationMethod(a: number, b: number): number;
12
14
  export function issueCredential(a: number, b: number, c: number, d: number, e: number, f: number): number;
13
15
  export function prepareIssueCredential(a: number, b: number, c: number, d: number, e: number, f: number): number;
14
16
  export function completeIssueCredential(a: number, b: number, c: number, d: number, e: number, f: number): number;
@@ -34,8 +36,8 @@ export function didkit_error_code(): number;
34
36
  export function __wbindgen_malloc(a: number): number;
35
37
  export function __wbindgen_realloc(a: number, b: number, c: number): number;
36
38
  export const __wbindgen_export_2: WebAssembly.Table;
37
- export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h93b9577b462bda3f(a: number, b: number, c: number): void;
39
+ export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf6251ee6687a20b8(a: number, b: number, c: number): void;
38
40
  export function __wbindgen_add_to_stack_pointer(a: number): number;
39
41
  export function __wbindgen_free(a: number, b: number): void;
40
42
  export function __wbindgen_exn_store(a: number): void;
41
- export function wasm_bindgen__convert__closures__invoke2_mut__h5199611bd19f62fe(a: number, b: number, c: number, d: number): void;
43
+ export function wasm_bindgen__convert__closures__invoke2_mut__h63ffd509f6690aab(a: number, b: number, c: number, d: number): void;
@@ -0,0 +1,7 @@
1
+ /// <reference types="types/global" />
2
+ import './polyfills';
3
+ export * from './wallet/init';
4
+ export { LearnCard, Plugin } from './types/wallet';
5
+ export * from './types/LearnCard';
6
+ export * from './wallet/base';
7
+ export * from './wallet/plugins';
@@ -0,0 +1,2 @@
1
+ import 'core-js/actual/promise';
2
+ import 'isomorphic-fetch';
@@ -0,0 +1,63 @@
1
+ import { InitInput } from '../didkit/index';
2
+ import { DIDKitPlugin, DidMethod } from '../wallet/plugins/didkit/types';
3
+ import { DidKeyPlugin } from '../wallet/plugins/didkey/types';
4
+ import { VCPlugin } from '../wallet/plugins/vc/types';
5
+ import { VCTemplatePlugin } from '../wallet/plugins/vc-templates';
6
+ import { VCResolutionPluginType } from '../wallet/plugins/vc-resolution';
7
+ import { CeramicPlugin, CeramicArgs } from '../wallet/plugins/ceramic/types';
8
+ import { IDXPlugin, IDXArgs } from '../wallet/plugins/idx/types';
9
+ import { ExpirationPlugin } from '../wallet/plugins/expiration/types';
10
+ import { EthereumPlugin, EthereumConfig } from '../wallet/plugins/EthereumPlugin/types';
11
+ import { VpqrPlugin } from '../wallet/plugins/vpqr/types';
12
+ import { CHAPIPlugin } from '../wallet/plugins/chapi';
13
+ import { VCAPIPlugin } from '../wallet/plugins/vc-api/types';
14
+ import { LearnCardPlugin } from '../wallet/plugins/learn-card';
15
+ import { InitFunction, GenericInitFunction } from './helpers';
16
+ import { LearnCard, Plugin } from './wallet';
17
+ /** @group LearnCard */
18
+ export type LearnCardConfig = {
19
+ ceramicIdx: CeramicArgs & IDXArgs;
20
+ didkit: InitInput | Promise<InitInput>;
21
+ ethereumConfig: EthereumConfig;
22
+ debug?: typeof console.log;
23
+ };
24
+ /** @group Init Functions */
25
+ export type EmptyLearnCard = InitFunction<{}, 'didkit' | 'debug', LearnCard<[DIDKitPlugin, ExpirationPlugin, VCTemplatePlugin, CHAPIPlugin, LearnCardPlugin]>>;
26
+ /** @group Init Functions */
27
+ export type LearnCardFromSeed = InitFunction<{
28
+ seed: string;
29
+ }, keyof LearnCardConfig, LearnCard<[
30
+ DIDKitPlugin,
31
+ DidKeyPlugin<DidMethod>,
32
+ VCPlugin,
33
+ VCTemplatePlugin,
34
+ VCResolutionPluginType,
35
+ CeramicPlugin,
36
+ IDXPlugin,
37
+ ExpirationPlugin,
38
+ EthereumPlugin,
39
+ VpqrPlugin,
40
+ CHAPIPlugin,
41
+ LearnCardPlugin
42
+ ]>>;
43
+ /** @group Init Functions */
44
+ export type LearnCardFromVcApi = InitFunction<{
45
+ vcApi: true | string;
46
+ did?: string;
47
+ }, 'debug', LearnCard<[VCAPIPlugin, ExpirationPlugin, VCTemplatePlugin, CHAPIPlugin, LearnCardPlugin]>>;
48
+ /** @group Init Functions */
49
+ export type CustomLearnCard = InitFunction<{
50
+ custom: true;
51
+ }, 'debug', LearnCard<[]>>;
52
+ /** @group Init Functions */
53
+ export type InitLearnCard = GenericInitFunction<[
54
+ EmptyLearnCard,
55
+ LearnCardFromSeed,
56
+ LearnCardFromVcApi,
57
+ CustomLearnCard
58
+ ]>;
59
+ export type GetPlugins<LC extends LearnCard<any, any, any>> = LC['plugins'];
60
+ export type AddPlugin<LC extends LearnCard<any, any, any>, P extends Plugin> = LearnCard<[
61
+ ...GetPlugins<LC>,
62
+ P
63
+ ]>;
@@ -0,0 +1,18 @@
1
+ import { LearnCardConfig } from './LearnCard';
2
+ import { LearnCard } from './wallet';
3
+ export type InitFunction<Args extends Record<string, any> = Record<string, any>, Config extends keyof LearnCardConfig | undefined = keyof LearnCardConfig, ReturnValue extends LearnCard<any, any> = LearnCard<any, any>> = {
4
+ args: Args & (undefined extends Config ? {} : Partial<Pick<LearnCardConfig, NonNullable<Config>>>);
5
+ returnValue: ReturnValue;
6
+ };
7
+ export type GenericInitFunction<InitFunctions extends InitFunction<any, any, any>[]> = {
8
+ args: InitFunctions[number]['args'];
9
+ returnValue: Promise<InitFunctions[number]['returnValue']>;
10
+ };
11
+ export type DiscriminatedUnionize<T extends object = {}, K extends string = 'type'> = {
12
+ [Key in keyof T]: {
13
+ [Key2 in K]: Key;
14
+ } & T[Key];
15
+ }[keyof T];
16
+ export type OmitNevers<T extends Record<string, any>> = Omit<T, {
17
+ [Index in keyof T]: [T[Index]] extends [never] ? Index : never;
18
+ }[keyof T]>;
@@ -0,0 +1,77 @@
1
+ import { CredentialRecord, VC, VP, JWK } from '@learncard/types';
2
+ import { Plugin } from './wallet';
3
+ import { OmitNevers } from './helpers';
4
+ export type CacheStrategy = 'cache-only' | 'cache-first' | 'skip-cache';
5
+ export type PlaneOptions = {
6
+ cache?: CacheStrategy;
7
+ };
8
+ export type ControlPlane = 'read' | 'store' | 'index' | 'cache' | 'id';
9
+ export type FilterForPlane<Plugins extends Plugin[], Plane extends ControlPlane> = {
10
+ [Index in keyof Plugins]: undefined extends Plugins[Index][Plane] ? never : Plugins[Index]['name'];
11
+ }[number];
12
+ export type GetPlanesForPlugins<Plugins extends Plugin[]> = any[] extends Plugins ? never : {
13
+ [Index in keyof Plugins]: {
14
+ [Key in ControlPlane]: undefined extends Plugins[Index][Key] ? never : Key;
15
+ }[ControlPlane];
16
+ }[number];
17
+ export type GetPlaneProviders<Plugins extends Plugin[], Plane extends ControlPlane> = any[] extends Plugins ? any : {
18
+ [Index in keyof Plugins]: undefined extends Plugins[Index][Plane] ? never : OmitNevers<{
19
+ [Name in Plugins[number]['name']]: Name extends Plugins[Index]['name'] ? {
20
+ name: Name;
21
+ displayName?: string;
22
+ description?: string;
23
+ } : never;
24
+ }>;
25
+ }[number];
26
+ export type ReadPlane = {
27
+ get: (uri?: string, options?: PlaneOptions) => Promise<VC | VP | undefined>;
28
+ };
29
+ export type PluginReadPlane = ReadPlane;
30
+ export type LearnCardReadPlane<Plugins extends Plugin[]> = ReadPlane & {
31
+ providers: GetPlaneProviders<Plugins, 'read'>;
32
+ };
33
+ export type EncryptionParams = {
34
+ recipients: string[];
35
+ };
36
+ export type StorePlane = {
37
+ upload: (vc: VC | VP, options?: PlaneOptions) => Promise<string>;
38
+ uploadMany?: (vcs: (VC | VP)[], options?: PlaneOptions) => Promise<string[]>;
39
+ uploadEncrypted?: (vc: VC | VP, params?: EncryptionParams, options?: PlaneOptions) => Promise<string>;
40
+ };
41
+ export type PluginStorePlane = StorePlane;
42
+ export type LearnCardStorePlane<Plugins extends Plugin[]> = Record<FilterForPlane<Plugins, 'store'>, StorePlane> & {
43
+ providers: GetPlaneProviders<Plugins, 'store'>;
44
+ };
45
+ export type IndexPlane = {
46
+ get: <Metadata extends Record<string, any> = Record<never, never>>(query?: Record<string, any>, options?: PlaneOptions) => Promise<CredentialRecord<Metadata>[]>;
47
+ add: <Metadata extends Record<string, any> = Record<never, never>>(record: CredentialRecord<Metadata>, options?: PlaneOptions) => Promise<boolean>;
48
+ addMany?: <Metadata extends Record<string, any> = Record<never, never>>(records: CredentialRecord<Metadata>[], options?: PlaneOptions) => Promise<boolean>;
49
+ update: (id: string, updates: Record<string, any>, options?: PlaneOptions) => Promise<boolean>;
50
+ remove: (id: string, options?: PlaneOptions) => Promise<boolean>;
51
+ removeAll?: (options?: PlaneOptions) => Promise<boolean>;
52
+ };
53
+ export type PluginIndexPlane = IndexPlane;
54
+ export type LearnCardIndexPlane<Plugins extends Plugin[]> = {
55
+ all: Pick<IndexPlane, 'get'>;
56
+ providers: GetPlaneProviders<Plugins, 'index'>;
57
+ } & Record<FilterForPlane<Plugins, 'index'>, IndexPlane>;
58
+ export type CachePlane = {
59
+ getIndex: <Metadata extends Record<string, any> = Record<never, never>>(name: string, query: Record<string, any>) => Promise<CredentialRecord<Metadata>[] | undefined>;
60
+ setIndex: <Metadata extends Record<string, any> = Record<never, never>>(name: string, query: Record<string, any>, value: CredentialRecord<Metadata>[]) => Promise<boolean>;
61
+ flushIndex: () => Promise<boolean>;
62
+ getVc: (uri: string) => Promise<VC | VP | undefined>;
63
+ setVc: (uri: string, value: VC | VP | undefined) => Promise<boolean>;
64
+ flushVc: () => Promise<boolean>;
65
+ };
66
+ export type PluginCachePlane = CachePlane;
67
+ export type LearnCardCachePlane<Plugins extends Plugin[]> = CachePlane & {
68
+ providers: GetPlaneProviders<Plugins, 'cache'>;
69
+ };
70
+ export type IdPlane = {
71
+ did: (method?: string, options?: PlaneOptions) => string;
72
+ keypair: (algorithm?: string, options?: PlaneOptions) => JWK;
73
+ };
74
+ export type PluginIdPlane = IdPlane;
75
+ export type LearnCardIdPlane<Plugins extends Plugin[]> = IdPlane & {
76
+ providers: GetPlaneProviders<Plugins, 'id'>;
77
+ };
@@ -0,0 +1,14 @@
1
+ /** @group Utility Types */
2
+ export type Tail<T extends any[]> = T extends [any, ...infer R] ? R : never;
3
+ /** @group Utility Types */
4
+ export type Last<T extends any[]> = T extends [...any[], infer R] ? R : never;
5
+ /** @group Utility Types */
6
+ export type RemoveLast<T extends any[]> = T extends [...infer R, any] ? R : [];
7
+ /** @group Utility Types */
8
+ export type RemoveFirstArg<T extends (...args: any[]) => any> = (args: Tail<Parameters<T>>) => ReturnType<T>;
9
+ /** @group Utility Types */
10
+ export type RemoveLastArg<T extends (...args: any[]) => any> = (args: RemoveLast<Parameters<T>>) => ReturnType<T>;
11
+ /** @group Utility Types */
12
+ export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
13
+ /** @group Utility Types */
14
+ export type MergeObjects<Objects extends Record<string, any>[]> = undefined extends Objects[2] ? Omit<Objects[0], keyof Objects[1]> & Objects[1] : Omit<MergeObjects<RemoveLast<Objects>>, keyof Last<Objects>> & Last<Objects>;