@learncard/core 8.0.3 → 8.0.5

Sign up to get free protection for your applications and to get access to all the features.
package/dist/core.d.ts CHANGED
@@ -1136,7 +1136,7 @@ declare const UnsignedVPValidator: z.ZodObject<{
1136
1136
  "@context": z.ZodArray<z.ZodString, "many">;
1137
1137
  id: z.ZodOptional<z.ZodString>;
1138
1138
  type: z.ZodArray<z.ZodString, "atleastone">;
1139
- verifiableCredential: z.ZodUnion<[
1139
+ verifiableCredential: z.ZodOptional<z.ZodUnion<[
1140
1140
  z.ZodObject<z.extendShape<{
1141
1141
  "@context": z.ZodArray<z.ZodString, "many">;
1142
1142
  id: z.ZodOptional<z.ZodString>;
@@ -2367,18 +2367,12 @@ declare const UnsignedVPValidator: z.ZodObject<{
2367
2367
  verificationMethod: string;
2368
2368
  }[];
2369
2369
  }>, "many">
2370
- ]>;
2370
+ ]>>;
2371
2371
  holder: z.ZodOptional<z.ZodString>;
2372
2372
  }, "strip", z.ZodAny, {
2373
2373
  [x: string]: any;
2374
2374
  id?: string | undefined;
2375
- holder?: string | undefined;
2376
- type: [
2377
- string,
2378
- ...string[]
2379
- ];
2380
- "@context": string[];
2381
- verifiableCredential: {
2375
+ verifiableCredential?: {
2382
2376
  [x: string]: any;
2383
2377
  id?: string | undefined;
2384
2378
  expirationDate?: string | undefined;
@@ -2596,17 +2590,17 @@ declare const UnsignedVPValidator: z.ZodObject<{
2596
2590
  proofPurpose: string;
2597
2591
  verificationMethod: string;
2598
2592
  }[];
2599
- }[];
2600
- }, {
2601
- [x: string]: any;
2602
- id?: string | undefined;
2593
+ }[] | undefined;
2603
2594
  holder?: string | undefined;
2604
2595
  type: [
2605
2596
  string,
2606
2597
  ...string[]
2607
2598
  ];
2608
2599
  "@context": string[];
2609
- verifiableCredential: {
2600
+ }, {
2601
+ [x: string]: any;
2602
+ id?: string | undefined;
2603
+ verifiableCredential?: {
2610
2604
  [x: string]: any;
2611
2605
  id?: string | undefined;
2612
2606
  expirationDate?: string | undefined;
@@ -2824,14 +2818,20 @@ declare const UnsignedVPValidator: z.ZodObject<{
2824
2818
  proofPurpose: string;
2825
2819
  verificationMethod: string;
2826
2820
  }[];
2827
- }[];
2821
+ }[] | undefined;
2822
+ holder?: string | undefined;
2823
+ type: [
2824
+ string,
2825
+ ...string[]
2826
+ ];
2827
+ "@context": string[];
2828
2828
  }>;
2829
2829
  export declare type UnsignedVP = z.infer<typeof UnsignedVPValidator>;
2830
2830
  declare const VPValidator: z.ZodObject<z.extendShape<{
2831
2831
  "@context": z.ZodArray<z.ZodString, "many">;
2832
2832
  id: z.ZodOptional<z.ZodString>;
2833
2833
  type: z.ZodArray<z.ZodString, "atleastone">;
2834
- verifiableCredential: z.ZodUnion<[
2834
+ verifiableCredential: z.ZodOptional<z.ZodUnion<[
2835
2835
  z.ZodObject<z.extendShape<{
2836
2836
  "@context": z.ZodArray<z.ZodString, "many">;
2837
2837
  id: z.ZodOptional<z.ZodString>;
@@ -4062,7 +4062,7 @@ declare const VPValidator: z.ZodObject<z.extendShape<{
4062
4062
  verificationMethod: string;
4063
4063
  }[];
4064
4064
  }>, "many">
4065
- ]>;
4065
+ ]>>;
4066
4066
  holder: z.ZodOptional<z.ZodString>;
4067
4067
  }, {
4068
4068
  proof: z.ZodUnion<[
@@ -4130,34 +4130,7 @@ declare const VPValidator: z.ZodObject<z.extendShape<{
4130
4130
  }>, "strip", z.ZodAny, {
4131
4131
  [x: string]: any;
4132
4132
  id?: string | undefined;
4133
- holder?: string | undefined;
4134
- type: [
4135
- string,
4136
- ...string[]
4137
- ];
4138
- "@context": string[];
4139
- proof: {
4140
- [x: string]: any;
4141
- challenge?: string | undefined;
4142
- domain?: string | undefined;
4143
- nonce?: string | undefined;
4144
- jws?: string | undefined;
4145
- type: string;
4146
- created: string;
4147
- proofPurpose: string;
4148
- verificationMethod: string;
4149
- } | {
4150
- [x: string]: any;
4151
- challenge?: string | undefined;
4152
- domain?: string | undefined;
4153
- nonce?: string | undefined;
4154
- jws?: string | undefined;
4155
- type: string;
4156
- created: string;
4157
- proofPurpose: string;
4158
- verificationMethod: string;
4159
- }[];
4160
- verifiableCredential: {
4133
+ verifiableCredential?: {
4161
4134
  [x: string]: any;
4162
4135
  id?: string | undefined;
4163
4136
  expirationDate?: string | undefined;
@@ -4375,10 +4348,7 @@ declare const VPValidator: z.ZodObject<z.extendShape<{
4375
4348
  proofPurpose: string;
4376
4349
  verificationMethod: string;
4377
4350
  }[];
4378
- }[];
4379
- }, {
4380
- [x: string]: any;
4381
- id?: string | undefined;
4351
+ }[] | undefined;
4382
4352
  holder?: string | undefined;
4383
4353
  type: [
4384
4354
  string,
@@ -4406,7 +4376,10 @@ declare const VPValidator: z.ZodObject<z.extendShape<{
4406
4376
  proofPurpose: string;
4407
4377
  verificationMethod: string;
4408
4378
  }[];
4409
- verifiableCredential: {
4379
+ }, {
4380
+ [x: string]: any;
4381
+ id?: string | undefined;
4382
+ verifiableCredential?: {
4410
4383
  [x: string]: any;
4411
4384
  id?: string | undefined;
4412
4385
  expirationDate?: string | undefined;
@@ -4624,6 +4597,33 @@ declare const VPValidator: z.ZodObject<z.extendShape<{
4624
4597
  proofPurpose: string;
4625
4598
  verificationMethod: string;
4626
4599
  }[];
4600
+ }[] | undefined;
4601
+ holder?: string | undefined;
4602
+ type: [
4603
+ string,
4604
+ ...string[]
4605
+ ];
4606
+ "@context": string[];
4607
+ proof: {
4608
+ [x: string]: any;
4609
+ challenge?: string | undefined;
4610
+ domain?: string | undefined;
4611
+ nonce?: string | undefined;
4612
+ jws?: string | undefined;
4613
+ type: string;
4614
+ created: string;
4615
+ proofPurpose: string;
4616
+ verificationMethod: string;
4617
+ } | {
4618
+ [x: string]: any;
4619
+ challenge?: string | undefined;
4620
+ domain?: string | undefined;
4621
+ nonce?: string | undefined;
4622
+ jws?: string | undefined;
4623
+ type: string;
4624
+ created: string;
4625
+ proofPurpose: string;
4626
+ verificationMethod: string;
4627
4627
  }[];
4628
4628
  }>;
4629
4629
  export declare type VP = z.infer<typeof VPValidator>;
@@ -4954,6 +4954,11 @@ export declare type VcTemplates = {
4954
4954
  criteriaNarrative?: string;
4955
4955
  issuanceDate?: string;
4956
4956
  };
4957
+ jff2: {
4958
+ did?: string;
4959
+ subject?: string;
4960
+ issuanceDate?: string;
4961
+ };
4957
4962
  };
4958
4963
  /** @group VC Templates Plugin */
4959
4964
  export declare type NewCredentialFunction = (args?: DiscriminatedUnionize<VcTemplates>) => UnsignedVC;
package/dist/core.esm.js CHANGED
@@ -40618,6 +40618,26 @@ var customLearnCard = /* @__PURE__ */ __name(async ({ debug } = {}) => generateL
40618
40618
 
40619
40619
  // src/didkit/pkg/didkit_wasm.js
40620
40620
  var wasm;
40621
+ var heap = new Array(32).fill(void 0);
40622
+ heap.push(void 0, null, true, false);
40623
+ function getObject(idx) {
40624
+ return heap[idx];
40625
+ }
40626
+ __name(getObject, "getObject");
40627
+ var heap_next = heap.length;
40628
+ function dropObject(idx) {
40629
+ if (idx < 36)
40630
+ return;
40631
+ heap[idx] = heap_next;
40632
+ heap_next = idx;
40633
+ }
40634
+ __name(dropObject, "dropObject");
40635
+ function takeObject(idx) {
40636
+ const ret = getObject(idx);
40637
+ dropObject(idx);
40638
+ return ret;
40639
+ }
40640
+ __name(takeObject, "takeObject");
40621
40641
  var cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
40622
40642
  cachedTextDecoder.decode();
40623
40643
  var cachedUint8Memory0 = new Uint8Array();
@@ -40632,9 +40652,6 @@ function getStringFromWasm0(ptr, len) {
40632
40652
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
40633
40653
  }
40634
40654
  __name(getStringFromWasm0, "getStringFromWasm0");
40635
- var heap = new Array(32).fill(void 0);
40636
- heap.push(void 0, null, true, false);
40637
- var heap_next = heap.length;
40638
40655
  function addHeapObject(obj) {
40639
40656
  if (heap_next === heap.length)
40640
40657
  heap.push(heap.length + 1);
@@ -40644,23 +40661,6 @@ function addHeapObject(obj) {
40644
40661
  return idx;
40645
40662
  }
40646
40663
  __name(addHeapObject, "addHeapObject");
40647
- function getObject(idx) {
40648
- return heap[idx];
40649
- }
40650
- __name(getObject, "getObject");
40651
- function dropObject(idx) {
40652
- if (idx < 36)
40653
- return;
40654
- heap[idx] = heap_next;
40655
- heap_next = idx;
40656
- }
40657
- __name(dropObject, "dropObject");
40658
- function takeObject(idx) {
40659
- const ret = getObject(idx);
40660
- dropObject(idx);
40661
- return ret;
40662
- }
40663
- __name(takeObject, "takeObject");
40664
40664
  var WASM_VECTOR_LEN = 0;
40665
40665
  var cachedTextEncoder = new TextEncoder("utf-8");
40666
40666
  var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
@@ -40793,14 +40793,10 @@ function makeMutClosure(arg0, arg1, dtor, f) {
40793
40793
  return real;
40794
40794
  }
40795
40795
  __name(makeMutClosure, "makeMutClosure");
40796
- function __wbg_adapter_24(arg0, arg1, arg2) {
40797
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf93d85b78df19dde(
40798
- arg0,
40799
- arg1,
40800
- addHeapObject(arg2)
40801
- );
40796
+ function __wbg_adapter_26(arg0, arg1, arg2) {
40797
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h93b9577b462bda3f(arg0, arg1, addHeapObject(arg2));
40802
40798
  }
40803
- __name(__wbg_adapter_24, "__wbg_adapter_24");
40799
+ __name(__wbg_adapter_26, "__wbg_adapter_26");
40804
40800
  function resolveDID(did, input_metadata) {
40805
40801
  const ptr0 = passStringToWasm0(did, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
40806
40802
  const len0 = WASM_VECTOR_LEN;
@@ -40868,11 +40864,7 @@ __name(generateSecp256k1KeyFromBytes, "generateSecp256k1KeyFromBytes");
40868
40864
  function keyToDID(method_pattern, jwk) {
40869
40865
  try {
40870
40866
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
40871
- const ptr0 = passStringToWasm0(
40872
- method_pattern,
40873
- wasm.__wbindgen_malloc,
40874
- wasm.__wbindgen_realloc
40875
- );
40867
+ const ptr0 = passStringToWasm0(method_pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
40876
40868
  const len0 = WASM_VECTOR_LEN;
40877
40869
  const ptr1 = passStringToWasm0(jwk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
40878
40870
  const len1 = WASM_VECTOR_LEN;
@@ -40963,15 +40955,10 @@ function getArrayU8FromWasm0(ptr, len) {
40963
40955
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
40964
40956
  }
40965
40957
  __name(getArrayU8FromWasm0, "getArrayU8FromWasm0");
40966
- function __wbg_adapter_111(arg0, arg1, arg2, arg3) {
40967
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h4d6f2a8364143373(
40968
- arg0,
40969
- arg1,
40970
- addHeapObject(arg2),
40971
- addHeapObject(arg3)
40972
- );
40958
+ function __wbg_adapter_131(arg0, arg1, arg2, arg3) {
40959
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h5199611bd19f62fe(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
40973
40960
  }
40974
- __name(__wbg_adapter_111, "__wbg_adapter_111");
40961
+ __name(__wbg_adapter_131, "__wbg_adapter_131");
40975
40962
  async function load(module2, imports) {
40976
40963
  if (typeof Response === "function" && module2 instanceof Response) {
40977
40964
  if (typeof WebAssembly.instantiateStreaming === "function") {
@@ -40979,10 +40966,7 @@ async function load(module2, imports) {
40979
40966
  return await WebAssembly.instantiateStreaming(module2, imports);
40980
40967
  } catch (e2) {
40981
40968
  if (module2.headers.get("Content-Type") != "application/wasm") {
40982
- console.warn(
40983
- "`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",
40984
- e2
40985
- );
40969
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e2);
40986
40970
  } else {
40987
40971
  throw e2;
40988
40972
  }
@@ -41003,13 +40987,13 @@ __name(load, "load");
41003
40987
  function getImports() {
41004
40988
  const imports = {};
41005
40989
  imports.wbg = {};
40990
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
40991
+ takeObject(arg0);
40992
+ };
41006
40993
  imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
41007
40994
  const ret = getStringFromWasm0(arg0, arg1);
41008
40995
  return addHeapObject(ret);
41009
40996
  };
41010
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
41011
- takeObject(arg0);
41012
- };
41013
40997
  imports.wbg.__wbindgen_cb_drop = function(arg0) {
41014
40998
  const obj = takeObject(arg0).original;
41015
40999
  if (obj.cnt-- == 1) {
@@ -41081,11 +41065,55 @@ function getImports() {
41081
41065
  return addHeapObject(ret);
41082
41066
  }, arguments);
41083
41067
  };
41068
+ imports.wbg.__wbg_process_e56fd54cf6319b6c = function(arg0) {
41069
+ const ret = getObject(arg0).process;
41070
+ return addHeapObject(ret);
41071
+ };
41084
41072
  imports.wbg.__wbindgen_is_object = function(arg0) {
41085
41073
  const val = getObject(arg0);
41086
41074
  const ret = typeof val === "object" && val !== null;
41087
41075
  return ret;
41088
41076
  };
41077
+ imports.wbg.__wbg_versions_77e21455908dad33 = function(arg0) {
41078
+ const ret = getObject(arg0).versions;
41079
+ return addHeapObject(ret);
41080
+ };
41081
+ imports.wbg.__wbg_node_0dd25d832e4785d5 = function(arg0) {
41082
+ const ret = getObject(arg0).node;
41083
+ return addHeapObject(ret);
41084
+ };
41085
+ imports.wbg.__wbindgen_is_string = function(arg0) {
41086
+ const ret = typeof getObject(arg0) === "string";
41087
+ return ret;
41088
+ };
41089
+ imports.wbg.__wbg_static_accessor_NODE_MODULE_26b231378c1be7dd = function() {
41090
+ const ret = module;
41091
+ return addHeapObject(ret);
41092
+ };
41093
+ imports.wbg.__wbg_require_0db1598d9ccecb30 = function() {
41094
+ return handleError(function(arg0, arg1, arg2) {
41095
+ const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
41096
+ return addHeapObject(ret);
41097
+ }, arguments);
41098
+ };
41099
+ imports.wbg.__wbg_crypto_b95d7173266618a9 = function(arg0) {
41100
+ const ret = getObject(arg0).crypto;
41101
+ return addHeapObject(ret);
41102
+ };
41103
+ imports.wbg.__wbg_msCrypto_5a86d77a66230f81 = function(arg0) {
41104
+ const ret = getObject(arg0).msCrypto;
41105
+ return addHeapObject(ret);
41106
+ };
41107
+ imports.wbg.__wbg_getRandomValues_b14734aa289bc356 = function() {
41108
+ return handleError(function(arg0, arg1) {
41109
+ getObject(arg0).getRandomValues(getObject(arg1));
41110
+ }, arguments);
41111
+ };
41112
+ imports.wbg.__wbg_randomFillSync_91e2b39becca6147 = function() {
41113
+ return handleError(function(arg0, arg1, arg2) {
41114
+ getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
41115
+ }, arguments);
41116
+ };
41089
41117
  imports.wbg.__wbg_randomFillSync_d2ba53160aec6aba = function(arg0, arg1, arg2) {
41090
41118
  getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
41091
41119
  };
@@ -41213,7 +41241,7 @@ function getImports() {
41213
41241
  const a3 = state0.a;
41214
41242
  state0.a = 0;
41215
41243
  try {
41216
- return __wbg_adapter_111(a3, state0.b, arg02, arg12);
41244
+ return __wbg_adapter_131(a3, state0.b, arg02, arg12);
41217
41245
  } finally {
41218
41246
  state0.a = a3;
41219
41247
  }
@@ -41295,12 +41323,8 @@ function getImports() {
41295
41323
  const ret = wasm.memory;
41296
41324
  return addHeapObject(ret);
41297
41325
  };
41298
- imports.wbg.__wbindgen_closure_wrapper9983 = function(arg0, arg1, arg2) {
41299
- const ret = makeMutClosure(arg0, arg1, 3544, __wbg_adapter_24);
41300
- return addHeapObject(ret);
41301
- };
41302
- imports.wbg.__wbindgen_closure_wrapper9985 = function(arg0, arg1, arg2) {
41303
- const ret = makeMutClosure(arg0, arg1, 3544, __wbg_adapter_24);
41326
+ imports.wbg.__wbindgen_closure_wrapper11031 = function(arg0, arg1, arg2) {
41327
+ const ret = makeMutClosure(arg0, arg1, 3193, __wbg_adapter_26);
41304
41328
  return addHeapObject(ret);
41305
41329
  };
41306
41330
  return imports;
@@ -41334,7 +41358,7 @@ var didkit_wasm_default = init;
41334
41358
 
41335
41359
  // src/didkit/index.ts
41336
41360
  var initialized = false;
41337
- var init2 = /* @__PURE__ */ __name(async (arg = "https://cdn.filestackcontent.com/haoSPuEQnqrKwBACgH0D") => {
41361
+ var init2 = /* @__PURE__ */ __name(async (arg = "https://cdn.filestackcontent.com/0ExKghPQTFGXxgM6BKvC") => {
41338
41362
  if (initialized)
41339
41363
  return;
41340
41364
  initialized = true;
@@ -41450,6 +41474,47 @@ var VC_TEMPLATES = {
41450
41474
  name: achievementName
41451
41475
  }
41452
41476
  }
41477
+ }),
41478
+ jff2: ({
41479
+ did = "did:example:d23dd687a7dc6787646f2eb98d0",
41480
+ subject = "did:example:d23dd687a7dc6787646f2eb98d0",
41481
+ issuanceDate = "2020-08-19T21:41:50Z"
41482
+ } = {}) => ({
41483
+ "@context": [
41484
+ "https://www.w3.org/2018/credentials/v1",
41485
+ "https://purl.imsglobal.org/spec/ob/v3p0/context.json",
41486
+ "https://w3id.org/security/suites/ed25519-2020/v1"
41487
+ ],
41488
+ id: "urn:uuid:a63a60be-f4af-491c-87fc-2c8fd3007a58",
41489
+ type: ["VerifiableCredential", "OpenBadgeCredential"],
41490
+ name: "JFF x vc-edu PlugFest 2 Interoperability",
41491
+ issuer: {
41492
+ type: ["Profile"],
41493
+ id: did,
41494
+ name: "Jobs for the Future (JFF)",
41495
+ image: {
41496
+ id: "https://w3c-ccg.github.io/vc-ed/plugfest-1-2022/images/JFF_LogoLockup.png",
41497
+ type: "Image"
41498
+ }
41499
+ },
41500
+ issuanceDate,
41501
+ credentialSubject: {
41502
+ type: ["AchievementSubject"],
41503
+ id: subject,
41504
+ achievement: {
41505
+ id: "urn:uuid:bd6d9316-f7ae-4073-a1e5-2f7f5bd22922",
41506
+ type: ["Achievement"],
41507
+ name: "JFF x vc-edu PlugFest 2 Interoperability",
41508
+ 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.",
41509
+ criteria: {
41510
+ narrative: "Solutions providers earned this badge by demonstrating interoperability between multiple providers based on the OBv3 candidate final standard, with some additional required fields. Credential issuers earning this badge successfully issued a credential into at least two wallets. Wallet implementers earning this badge successfully displayed credentials issued by at least two different credential issuers."
41511
+ },
41512
+ image: {
41513
+ id: "https://w3c-ccg.github.io/vc-ed/plugfest-2-2022/images/JFF-VC-EDU-PLUGFEST2-badge-image.png",
41514
+ type: "Image"
41515
+ }
41516
+ }
41517
+ }
41453
41518
  })
41454
41519
  };
41455
41520
 
@@ -46053,7 +46118,7 @@ var UnsignedVPValidator = mod.object({
46053
46118
  "@context": ContextValidator,
46054
46119
  id: mod.string().optional(),
46055
46120
  type: mod.string().array().nonempty(),
46056
- verifiableCredential: VCValidator.or(VCValidator.array()),
46121
+ verifiableCredential: VCValidator.or(VCValidator.array()).optional(),
46057
46122
  holder: mod.string().optional()
46058
46123
  }).catchall(mod.any());
46059
46124
  var VPValidator = UnsignedVPValidator.extend({