@learncard/react 2.3.2 → 2.3.6

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.
Files changed (27) hide show
  1. package/dist/cjs/{LearnCardCreditCardBackFace-f1b96ce5.js → LearnCardCreditCardBackFace-ecb49e43.js} +5 -3
  2. package/dist/cjs/LearnCardCreditCardBackFace-ecb49e43.js.map +1 -0
  3. package/dist/cjs/{LearnCardCreditCardFrontFace-a7b89edc.js → LearnCardCreditCardFrontFace-7d383319.js} +9 -8
  4. package/dist/cjs/{LearnCardCreditCardFrontFace-a7b89edc.js.map → LearnCardCreditCardFrontFace-7d383319.js.map} +1 -1
  5. package/dist/cjs/{VCCard-5495759e.js → VCCard-37198c86.js} +1495 -1489
  6. package/dist/{esm/VCCard-e39551a6.js.map → cjs/VCCard-37198c86.js.map} +1 -1
  7. package/dist/cjs/index.js +3 -3
  8. package/dist/cjs/index14.js +1 -1
  9. package/dist/cjs/index5.js +3 -3
  10. package/dist/cjs/index6.js +1 -1
  11. package/dist/cjs/index7.js +1 -1
  12. package/dist/esm/{LearnCardCreditCardBackFace-5ecba121.js → LearnCardCreditCardBackFace-4f7eaaa9.js} +5 -3
  13. package/dist/esm/LearnCardCreditCardBackFace-4f7eaaa9.js.map +1 -0
  14. package/dist/esm/{LearnCardCreditCardFrontFace-0a843e76.js → LearnCardCreditCardFrontFace-269b2847.js} +9 -8
  15. package/dist/esm/{LearnCardCreditCardFrontFace-0a843e76.js.map → LearnCardCreditCardFrontFace-269b2847.js.map} +1 -1
  16. package/dist/esm/{VCCard-e39551a6.js → VCCard-27020ddd.js} +1495 -1489
  17. package/dist/{cjs/VCCard-5495759e.js.map → esm/VCCard-27020ddd.js.map} +1 -1
  18. package/dist/esm/index.js +3 -3
  19. package/dist/esm/index14.js +1 -1
  20. package/dist/esm/index5.js +3 -3
  21. package/dist/esm/index6.js +1 -1
  22. package/dist/esm/index7.js +1 -1
  23. package/dist/main.css +1 -1
  24. package/dist/main.js +1 -1
  25. package/package.json +2 -2
  26. package/dist/cjs/LearnCardCreditCardBackFace-f1b96ce5.js.map +0 -1
  27. package/dist/esm/LearnCardCreditCardBackFace-5ecba121.js.map +0 -1
@@ -119588,1129 +119588,481 @@ var require_src3 = __commonJS({
119588
119588
  };
119589
119589
  }
119590
119590
  });
119591
- var wasm;
119592
- var cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
119593
- cachedTextDecoder.decode();
119594
- var cachegetUint8Memory0 = null;
119595
- function getUint8Memory0() {
119596
- if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
119597
- cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
119598
- }
119599
- return cachegetUint8Memory0;
119600
- }
119601
- __name(getUint8Memory0, "getUint8Memory0");
119602
- function getStringFromWasm0(ptr, len) {
119603
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
119604
- }
119605
- __name(getStringFromWasm0, "getStringFromWasm0");
119606
- var heap = new Array(32).fill(void 0);
119607
- heap.push(void 0, null, true, false);
119608
- var heap_next = heap.length;
119609
- function addHeapObject(obj) {
119610
- if (heap_next === heap.length)
119611
- heap.push(heap.length + 1);
119612
- const idx = heap_next;
119613
- heap_next = heap[idx];
119614
- heap[idx] = obj;
119615
- return idx;
119616
- }
119617
- __name(addHeapObject, "addHeapObject");
119618
- function getObject(idx) {
119619
- return heap[idx];
119620
- }
119621
- __name(getObject, "getObject");
119622
- function dropObject(idx) {
119623
- if (idx < 36)
119624
- return;
119625
- heap[idx] = heap_next;
119626
- heap_next = idx;
119627
- }
119628
- __name(dropObject, "dropObject");
119629
- function takeObject(idx) {
119630
- const ret = getObject(idx);
119631
- dropObject(idx);
119632
- return ret;
119633
- }
119634
- __name(takeObject, "takeObject");
119635
- var WASM_VECTOR_LEN = 0;
119636
- var cachedTextEncoder = new TextEncoder("utf-8");
119637
- var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
119638
- return cachedTextEncoder.encodeInto(arg, view);
119639
- } : function(arg, view) {
119640
- const buf2 = cachedTextEncoder.encode(arg);
119641
- view.set(buf2);
119642
- return {
119643
- read: arg.length,
119644
- written: buf2.length
119591
+ if (typeof window === "undefined")
119592
+ globalThis.crypto = crypto2;
119593
+ var addPluginToWallet = /* @__PURE__ */ __name((wallet, plugin) => __async$1(void 0, null, function* () {
119594
+ return generateWallet(wallet.contents, {
119595
+ plugins: [...wallet.plugins, plugin]
119596
+ });
119597
+ }), "addPluginToWallet");
119598
+ var addToWallet = /* @__PURE__ */ __name((wallet, content) => __async$1(void 0, null, function* () {
119599
+ return generateWallet([...wallet.contents, content], wallet);
119600
+ }), "addToWallet");
119601
+ var removeFromWallet = /* @__PURE__ */ __name((wallet, contentId) => __async$1(void 0, null, function* () {
119602
+ const clonedContents = JSON.parse(JSON.stringify(wallet.contents));
119603
+ const content = clonedContents.find((c) => c.id === contentId);
119604
+ return generateWallet(clonedContents.filter((i) => i.id !== content.id), wallet);
119605
+ }), "removeFromWallet");
119606
+ var bindMethods = /* @__PURE__ */ __name((wallet, pluginMethods) => Object.fromEntries(Object.entries(pluginMethods).map(([key2, method]) => [key2, method.bind(wallet, wallet)])), "bindMethods");
119607
+ var generateWallet = /* @__PURE__ */ __name((..._0) => __async$1(void 0, [..._0], function* (contents = [], _wallet = {}) {
119608
+ const { plugins = [] } = _wallet;
119609
+ const pluginMethods = plugins.reduce((cumulativePluginMethods, plugin) => {
119610
+ const newPluginMethods = __spreadValues(__spreadValues({}, cumulativePluginMethods), plugin.pluginMethods);
119611
+ return newPluginMethods;
119612
+ }, {});
119613
+ const wallet = {
119614
+ contents: [...contents],
119615
+ add: function(content) {
119616
+ return addToWallet(this, content);
119617
+ },
119618
+ remove: function(contentId) {
119619
+ return removeFromWallet(this, contentId);
119620
+ },
119621
+ status: "UNLOCKED",
119622
+ plugins,
119623
+ pluginMethods,
119624
+ addPlugin: function(plugin) {
119625
+ return addPluginToWallet(this, plugin);
119626
+ }
119645
119627
  };
119646
- };
119647
- function passStringToWasm0(arg, malloc, realloc) {
119648
- if (realloc === void 0) {
119649
- const buf2 = cachedTextEncoder.encode(arg);
119650
- const ptr2 = malloc(buf2.length);
119651
- getUint8Memory0().subarray(ptr2, ptr2 + buf2.length).set(buf2);
119652
- WASM_VECTOR_LEN = buf2.length;
119653
- return ptr2;
119628
+ if (pluginMethods)
119629
+ wallet.pluginMethods = bindMethods(wallet, pluginMethods);
119630
+ return wallet;
119631
+ }), "generateWallet");
119632
+ function _catch(body, recover) {
119633
+ try {
119634
+ var result = body();
119635
+ } catch (e) {
119636
+ return recover(e);
119654
119637
  }
119655
- let len = arg.length;
119656
- let ptr = malloc(len);
119657
- const mem = getUint8Memory0();
119658
- let offset = 0;
119659
- for (; offset < len; offset++) {
119660
- const code5 = arg.charCodeAt(offset);
119661
- if (code5 > 127)
119662
- break;
119663
- mem[ptr + offset] = code5;
119638
+ if (result && result.then) {
119639
+ return result.then(void 0, recover);
119664
119640
  }
119665
- if (offset !== len) {
119666
- if (offset !== 0) {
119667
- arg = arg.slice(offset);
119641
+ return result;
119642
+ }
119643
+ __name(_catch, "_catch");
119644
+ function inMemoryCache() {
119645
+ const cache = /* @__PURE__ */ new Map();
119646
+ return function(parsed, resolve) {
119647
+ try {
119648
+ let _temp2 = function(_result) {
119649
+ if (_exit)
119650
+ return _result;
119651
+ const cached = cache.get(parsed.didUrl);
119652
+ return cached !== void 0 ? cached : Promise.resolve(resolve()).then(function(result) {
119653
+ var _result$didResolution;
119654
+ if (((_result$didResolution = result.didResolutionMetadata) == null ? void 0 : _result$didResolution.error) !== "notFound") {
119655
+ cache.set(parsed.didUrl, result);
119656
+ }
119657
+ return result;
119658
+ });
119659
+ };
119660
+ __name(_temp2, "_temp2");
119661
+ let _exit;
119662
+ const _temp = function() {
119663
+ if (parsed.params && parsed.params["no-cache"] === "true") {
119664
+ return Promise.resolve(resolve()).then(function(_await$resolve) {
119665
+ _exit = 1;
119666
+ return _await$resolve;
119667
+ });
119668
+ }
119669
+ }();
119670
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
119671
+ } catch (e) {
119672
+ return Promise.reject(e);
119668
119673
  }
119669
- ptr = realloc(ptr, len, len = offset + arg.length * 3);
119670
- const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
119671
- const ret = encodeString(arg, view);
119672
- offset += ret.written;
119673
- }
119674
- WASM_VECTOR_LEN = offset;
119675
- return ptr;
119674
+ };
119676
119675
  }
119677
- __name(passStringToWasm0, "passStringToWasm0");
119678
- function isLikeNone(x) {
119679
- return x === void 0 || x === null;
119676
+ __name(inMemoryCache, "inMemoryCache");
119677
+ function noCache(parsed, resolve) {
119678
+ return resolve();
119680
119679
  }
119681
- __name(isLikeNone, "isLikeNone");
119682
- var cachegetInt32Memory0 = null;
119683
- function getInt32Memory0() {
119684
- if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
119685
- cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
119680
+ __name(noCache, "noCache");
119681
+ var PCT_ENCODED = "(?:%[0-9a-fA-F]{2})";
119682
+ var ID_CHAR = `(?:[a-zA-Z0-9._-]|${PCT_ENCODED})`;
119683
+ var METHOD = "([a-z0-9]+)";
119684
+ var METHOD_ID = `((?:${ID_CHAR}*:)*(${ID_CHAR}+))`;
119685
+ var PARAM_CHAR = "[a-zA-Z0-9_.:%-]";
119686
+ var PARAM = `;${PARAM_CHAR}+=${PARAM_CHAR}*`;
119687
+ var PARAMS = `((${PARAM})*)`;
119688
+ var PATH = `(/[^#?]*)?`;
119689
+ var QUERY = `([?][^#]*)?`;
119690
+ var FRAGMENT = `(#.*)?`;
119691
+ var DID_MATCHER = new RegExp(`^did:${METHOD}:${METHOD_ID}${PARAMS}${PATH}${QUERY}${FRAGMENT}$`);
119692
+ function parse(didUrl) {
119693
+ if (didUrl === "" || !didUrl)
119694
+ return null;
119695
+ const sections = didUrl.match(DID_MATCHER);
119696
+ if (sections) {
119697
+ const parts = {
119698
+ did: `did:${sections[1]}:${sections[2]}`,
119699
+ method: sections[1],
119700
+ id: sections[2],
119701
+ didUrl
119702
+ };
119703
+ if (sections[4]) {
119704
+ const params = sections[4].slice(1).split(";");
119705
+ parts.params = {};
119706
+ for (const p of params) {
119707
+ const kv = p.split("=");
119708
+ parts.params[kv[0]] = kv[1];
119709
+ }
119710
+ }
119711
+ if (sections[6])
119712
+ parts.path = sections[6];
119713
+ if (sections[7])
119714
+ parts.query = sections[7].slice(1);
119715
+ if (sections[8])
119716
+ parts.fragment = sections[8].slice(1);
119717
+ return parts;
119686
119718
  }
119687
- return cachegetInt32Memory0;
119719
+ return null;
119688
119720
  }
119689
- __name(getInt32Memory0, "getInt32Memory0");
119690
- function debugString(val) {
119691
- const type = typeof val;
119692
- if (type == "number" || type == "boolean" || val == null) {
119693
- return `${val}`;
119694
- }
119695
- if (type == "string") {
119696
- return `"${val}"`;
119697
- }
119698
- if (type == "symbol") {
119699
- const description = val.description;
119700
- if (description == null) {
119701
- return "Symbol";
119702
- } else {
119703
- return `Symbol(${description})`;
119721
+ __name(parse, "parse");
119722
+ var EMPTY_RESULT = {
119723
+ didResolutionMetadata: {},
119724
+ didDocument: null,
119725
+ didDocumentMetadata: {}
119726
+ };
119727
+ function wrapLegacyResolver(resolve) {
119728
+ return function(did, parsed, resolver) {
119729
+ try {
119730
+ return Promise.resolve(_catch(function() {
119731
+ return Promise.resolve(resolve(did, parsed, resolver)).then(function(doc) {
119732
+ return __spreadProps(__spreadValues({}, EMPTY_RESULT), {
119733
+ didResolutionMetadata: {
119734
+ contentType: "application/did+ld+json"
119735
+ },
119736
+ didDocument: doc
119737
+ });
119738
+ });
119739
+ }, function(e) {
119740
+ return __spreadProps(__spreadValues({}, EMPTY_RESULT), {
119741
+ didResolutionMetadata: {
119742
+ error: "notFound",
119743
+ message: e.toString()
119744
+ }
119745
+ });
119746
+ }));
119747
+ } catch (e) {
119748
+ return Promise.reject(e);
119704
119749
  }
119705
- }
119706
- if (type == "function") {
119707
- const name5 = val.name;
119708
- if (typeof name5 == "string" && name5.length > 0) {
119709
- return `Function(${name5})`;
119710
- } else {
119711
- return "Function";
119712
- }
119713
- }
119714
- if (Array.isArray(val)) {
119715
- const length2 = val.length;
119716
- let debug = "[";
119717
- if (length2 > 0) {
119718
- debug += debugString(val[0]);
119719
- }
119720
- for (let i = 1; i < length2; i++) {
119721
- debug += ", " + debugString(val[i]);
119722
- }
119723
- debug += "]";
119724
- return debug;
119725
- }
119726
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
119727
- let className;
119728
- if (builtInMatches.length > 1) {
119729
- className = builtInMatches[1];
119730
- } else {
119731
- return toString.call(val);
119732
- }
119733
- if (className == "Object") {
119734
- try {
119735
- return "Object(" + JSON.stringify(val) + ")";
119736
- } catch (_) {
119737
- return "Object";
119750
+ };
119751
+ }
119752
+ __name(wrapLegacyResolver, "wrapLegacyResolver");
119753
+ var Resolver = class {
119754
+ constructor(registry2 = {}, options = {}) {
119755
+ this.registry = void 0;
119756
+ this.cache = void 0;
119757
+ this.registry = registry2;
119758
+ this.cache = options.cache === true ? inMemoryCache() : options.cache || noCache;
119759
+ if (options.legacyResolvers) {
119760
+ Object.keys(options.legacyResolvers).map((methodName) => {
119761
+ if (!this.registry[methodName]) {
119762
+ this.registry[methodName] = wrapLegacyResolver(options.legacyResolvers[methodName]);
119763
+ }
119764
+ });
119738
119765
  }
119739
119766
  }
119740
- if (val instanceof Error) {
119741
- return `${val.name}: ${val.message}
119742
- ${val.stack}`;
119743
- }
119744
- return className;
119745
- }
119746
- __name(debugString, "debugString");
119747
- function makeMutClosure(arg0, arg1, dtor, f) {
119748
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
119749
- const real = /* @__PURE__ */ __name((...args) => {
119750
- state.cnt++;
119751
- const a = state.a;
119752
- state.a = 0;
119767
+ resolve(didUrl, options = {}) {
119753
119768
  try {
119754
- return f(a, state.b, ...args);
119755
- } finally {
119756
- if (--state.cnt === 0) {
119757
- wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
119758
- } else {
119759
- state.a = a;
119769
+ const _this = this;
119770
+ const parsed = parse(didUrl);
119771
+ if (parsed === null) {
119772
+ return Promise.resolve(__spreadProps(__spreadValues({}, EMPTY_RESULT), {
119773
+ didResolutionMetadata: {
119774
+ error: "invalidDid"
119775
+ }
119776
+ }));
119777
+ }
119778
+ const resolver = _this.registry[parsed.method];
119779
+ if (!resolver) {
119780
+ return Promise.resolve(__spreadProps(__spreadValues({}, EMPTY_RESULT), {
119781
+ didResolutionMetadata: {
119782
+ error: "unsupportedDidMethod"
119783
+ }
119784
+ }));
119760
119785
  }
119786
+ return Promise.resolve(_this.cache(parsed, () => resolver(parsed.did, parsed, _this, options)));
119787
+ } catch (e) {
119788
+ return Promise.reject(e);
119761
119789
  }
119762
- }, "real");
119763
- real.original = state;
119764
- return real;
119765
- }
119766
- __name(makeMutClosure, "makeMutClosure");
119767
- function __wbg_adapter_24(arg0, arg1, arg2) {
119768
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h91a8814f66f14b17(arg0, arg1, addHeapObject(arg2));
119790
+ }
119791
+ };
119792
+ __name(Resolver, "Resolver");
119793
+ init_concat();
119794
+ init_from_string();
119795
+ init_to_string();
119796
+ init_basics();
119797
+ var import_sha256 = __toESM(require_sha256());
119798
+ var import_js_sha3 = __toESM(require_sha3());
119799
+ var import_elliptic = __toESM(require_elliptic());
119800
+ var import_ed25519 = __toESM(require_ed25519());
119801
+ var import_canonicalize = __toESM(require_canonicalize());
119802
+ var import_x25519 = __toESM(require_x25519());
119803
+ var import_xchacha20poly1305 = __toESM(require_xchacha20poly1305());
119804
+ var import_random = __toESM(require_random());
119805
+ function bytesToBase64url(b) {
119806
+ return toString3(b, "base64url");
119769
119807
  }
119770
- __name(__wbg_adapter_24, "__wbg_adapter_24");
119771
- function passArray8ToWasm0(arg, malloc) {
119772
- const ptr = malloc(arg.length * 1);
119773
- getUint8Memory0().set(arg, ptr / 1);
119774
- WASM_VECTOR_LEN = arg.length;
119775
- return ptr;
119808
+ __name(bytesToBase64url, "bytesToBase64url");
119809
+ function base64ToBytes(s) {
119810
+ const inputBase64Url = s.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
119811
+ return fromString2(inputBase64Url, "base64url");
119776
119812
  }
119777
- __name(passArray8ToWasm0, "passArray8ToWasm0");
119778
- function generateEd25519KeyFromBytes(bytes) {
119779
- try {
119780
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
119781
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
119782
- const len0 = WASM_VECTOR_LEN;
119783
- wasm.generateEd25519KeyFromBytes(retptr, ptr0, len0);
119784
- var r0 = getInt32Memory0()[retptr / 4 + 0];
119785
- var r1 = getInt32Memory0()[retptr / 4 + 1];
119786
- var r2 = getInt32Memory0()[retptr / 4 + 2];
119787
- var r3 = getInt32Memory0()[retptr / 4 + 3];
119788
- var ptr1 = r0;
119789
- var len1 = r1;
119790
- if (r3) {
119791
- ptr1 = 0;
119792
- len1 = 0;
119793
- throw takeObject(r2);
119794
- }
119795
- return getStringFromWasm0(ptr1, len1);
119796
- } finally {
119797
- wasm.__wbindgen_add_to_stack_pointer(16);
119798
- wasm.__wbindgen_free(ptr1, len1);
119799
- }
119813
+ __name(base64ToBytes, "base64ToBytes");
119814
+ function base58ToBytes(s) {
119815
+ return fromString2(s, "base58btc");
119800
119816
  }
119801
- __name(generateEd25519KeyFromBytes, "generateEd25519KeyFromBytes");
119802
- function keyToDID(method_pattern, jwk) {
119803
- try {
119804
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
119805
- const ptr0 = passStringToWasm0(method_pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
119806
- const len0 = WASM_VECTOR_LEN;
119807
- const ptr1 = passStringToWasm0(jwk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
119808
- const len1 = WASM_VECTOR_LEN;
119809
- wasm.keyToDID(retptr, ptr0, len0, ptr1, len1);
119810
- var r0 = getInt32Memory0()[retptr / 4 + 0];
119811
- var r1 = getInt32Memory0()[retptr / 4 + 1];
119812
- var r2 = getInt32Memory0()[retptr / 4 + 2];
119813
- var r3 = getInt32Memory0()[retptr / 4 + 3];
119814
- var ptr2 = r0;
119815
- var len2 = r1;
119816
- if (r3) {
119817
- ptr2 = 0;
119818
- len2 = 0;
119819
- throw takeObject(r2);
119820
- }
119821
- return getStringFromWasm0(ptr2, len2);
119822
- } finally {
119823
- wasm.__wbindgen_add_to_stack_pointer(16);
119824
- wasm.__wbindgen_free(ptr2, len2);
119825
- }
119817
+ __name(base58ToBytes, "base58ToBytes");
119818
+ function hexToBytes(s) {
119819
+ const input = s.startsWith("0x") ? s.substring(2) : s;
119820
+ return fromString2(input.toLowerCase(), "base16");
119826
119821
  }
119827
- __name(keyToDID, "keyToDID");
119828
- function keyToVerificationMethod(method_pattern, jwk) {
119829
- const ptr0 = passStringToWasm0(method_pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
119830
- const len0 = WASM_VECTOR_LEN;
119831
- const ptr1 = passStringToWasm0(jwk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
119832
- const len1 = WASM_VECTOR_LEN;
119833
- const ret = wasm.keyToVerificationMethod(ptr0, len0, ptr1, len1);
119834
- return takeObject(ret);
119822
+ __name(hexToBytes, "hexToBytes");
119823
+ function encodeBase64url(s) {
119824
+ return bytesToBase64url(fromString2(s));
119835
119825
  }
119836
- __name(keyToVerificationMethod, "keyToVerificationMethod");
119837
- function issueCredential(credential, proof_options, key2) {
119838
- const ptr0 = passStringToWasm0(credential, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
119839
- const len0 = WASM_VECTOR_LEN;
119840
- const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
119841
- const len1 = WASM_VECTOR_LEN;
119842
- const ptr2 = passStringToWasm0(key2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
119843
- const len2 = WASM_VECTOR_LEN;
119844
- const ret = wasm.issueCredential(ptr0, len0, ptr1, len1, ptr2, len2);
119845
- return takeObject(ret);
119826
+ __name(encodeBase64url, "encodeBase64url");
119827
+ function decodeBase64url(s) {
119828
+ return toString3(base64ToBytes(s));
119846
119829
  }
119847
- __name(issueCredential, "issueCredential");
119848
- function verifyCredential(vc, proof_options) {
119849
- const ptr0 = passStringToWasm0(vc, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
119850
- const len0 = WASM_VECTOR_LEN;
119851
- const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
119852
- const len1 = WASM_VECTOR_LEN;
119853
- const ret = wasm.verifyCredential(ptr0, len0, ptr1, len1);
119854
- return takeObject(ret);
119830
+ __name(decodeBase64url, "decodeBase64url");
119831
+ function bytesToHex(b) {
119832
+ return toString3(b, "base16");
119855
119833
  }
119856
- __name(verifyCredential, "verifyCredential");
119857
- function issuePresentation(presentation, proof_options, key2) {
119858
- const ptr0 = passStringToWasm0(presentation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
119859
- const len0 = WASM_VECTOR_LEN;
119860
- const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
119861
- const len1 = WASM_VECTOR_LEN;
119862
- const ptr2 = passStringToWasm0(key2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
119863
- const len2 = WASM_VECTOR_LEN;
119864
- const ret = wasm.issuePresentation(ptr0, len0, ptr1, len1, ptr2, len2);
119865
- return takeObject(ret);
119834
+ __name(bytesToHex, "bytesToHex");
119835
+ function stringToBytes(s) {
119836
+ return fromString2(s);
119866
119837
  }
119867
- __name(issuePresentation, "issuePresentation");
119868
- function verifyPresentation(vp, proof_options) {
119869
- const ptr0 = passStringToWasm0(vp, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
119870
- const len0 = WASM_VECTOR_LEN;
119871
- const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
119872
- const len1 = WASM_VECTOR_LEN;
119873
- const ret = wasm.verifyPresentation(ptr0, len0, ptr1, len1);
119874
- return takeObject(ret);
119838
+ __name(stringToBytes, "stringToBytes");
119839
+ function toJose({
119840
+ r,
119841
+ s,
119842
+ recoveryParam
119843
+ }, recoverable) {
119844
+ const jose = new Uint8Array(recoverable ? 65 : 64);
119845
+ jose.set(fromString2(r, "base16"), 0);
119846
+ jose.set(fromString2(s, "base16"), 32);
119847
+ if (recoverable) {
119848
+ if (typeof recoveryParam === "undefined") {
119849
+ throw new Error("Signer did not return a recoveryParam");
119850
+ }
119851
+ jose[64] = recoveryParam;
119852
+ }
119853
+ return bytesToBase64url(jose);
119875
119854
  }
119876
- __name(verifyPresentation, "verifyPresentation");
119877
- function handleError(f, args) {
119878
- try {
119879
- return f.apply(this, args);
119880
- } catch (e) {
119881
- wasm.__wbindgen_exn_store(addHeapObject(e));
119855
+ __name(toJose, "toJose");
119856
+ function fromJose(signature2) {
119857
+ const signatureBytes = base64ToBytes(signature2);
119858
+ if (signatureBytes.length < 64 || signatureBytes.length > 65) {
119859
+ throw new TypeError(`Wrong size for signature. Expected 64 or 65 bytes, but got ${signatureBytes.length}`);
119882
119860
  }
119861
+ const r = bytesToHex(signatureBytes.slice(0, 32));
119862
+ const s = bytesToHex(signatureBytes.slice(32, 64));
119863
+ const recoveryParam = signatureBytes.length === 65 ? signatureBytes[64] : void 0;
119864
+ return {
119865
+ r,
119866
+ s,
119867
+ recoveryParam
119868
+ };
119883
119869
  }
119884
- __name(handleError, "handleError");
119885
- function getArrayU8FromWasm0(ptr, len) {
119886
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
119870
+ __name(fromJose, "fromJose");
119871
+ function toSealed(ciphertext, tag) {
119872
+ return concat([base64ToBytes(ciphertext), base64ToBytes(tag)]);
119887
119873
  }
119888
- __name(getArrayU8FromWasm0, "getArrayU8FromWasm0");
119889
- function __wbg_adapter_108(arg0, arg1, arg2, arg3) {
119890
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h3ecfeb7a01c1be81(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
119874
+ __name(toSealed, "toSealed");
119875
+ var hexMatcher = /^(0x)?([a-fA-F0-9]{64}|[a-fA-F0-9]{128})$/;
119876
+ var base58Matcher = /^([1-9A-HJ-NP-Za-km-z]{44}|[1-9A-HJ-NP-Za-km-z]{88})$/;
119877
+ var base64Matcher = /^([0-9a-zA-Z=\-_+/]{43}|[0-9a-zA-Z=\-_+/]{86})(={0,2})$/;
119878
+ function parseKey(input) {
119879
+ if (typeof input === "string") {
119880
+ if (hexMatcher.test(input)) {
119881
+ return hexToBytes(input);
119882
+ } else if (base58Matcher.test(input)) {
119883
+ return base58ToBytes(input);
119884
+ } else if (base64Matcher.test(input)) {
119885
+ return base64ToBytes(input);
119886
+ } else {
119887
+ throw TypeError("bad_key: Invalid private key format");
119888
+ }
119889
+ } else if (input instanceof Uint8Array) {
119890
+ return input;
119891
+ } else {
119892
+ throw TypeError("bad_key: Invalid private key format");
119893
+ }
119891
119894
  }
119892
- __name(__wbg_adapter_108, "__wbg_adapter_108");
119893
- function load(module, imports) {
119894
- return __async$1(this, null, function* () {
119895
- if (typeof Response === "function" && module instanceof Response) {
119896
- if (typeof WebAssembly.instantiateStreaming === "function") {
119897
- try {
119898
- return yield WebAssembly.instantiateStreaming(module, imports);
119899
- } catch (e) {
119900
- if (module.headers.get("Content-Type") != "application/wasm") {
119901
- 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", e);
119902
- } else {
119903
- throw e;
119895
+ __name(parseKey, "parseKey");
119896
+ function sha2562(payload) {
119897
+ const data = typeof payload === "string" ? fromString2(payload) : payload;
119898
+ return (0, import_sha256.hash)(data);
119899
+ }
119900
+ __name(sha2562, "sha256");
119901
+ function keccak(data) {
119902
+ return new Uint8Array(import_js_sha3.keccak_256.arrayBuffer(data));
119903
+ }
119904
+ __name(keccak, "keccak");
119905
+ function toEthereumAddress(hexPublicKey) {
119906
+ const hashInput = fromString2(hexPublicKey.slice(2), "base16");
119907
+ return `0x${toString3(keccak(hashInput).slice(-20), "base16")}`;
119908
+ }
119909
+ __name(toEthereumAddress, "toEthereumAddress");
119910
+ function writeUint32BE(value, array = new Uint8Array(4)) {
119911
+ const encoded = fromString2(value.toString(), "base10");
119912
+ array.set(encoded, 4 - encoded.length);
119913
+ return array;
119914
+ }
119915
+ __name(writeUint32BE, "writeUint32BE");
119916
+ var lengthAndInput = /* @__PURE__ */ __name((input) => concat([writeUint32BE(input.length), input]), "lengthAndInput");
119917
+ function concatKDF(secret, keyLen, alg, producerInfo, consumerInfo) {
119918
+ if (keyLen !== 256)
119919
+ throw new Error(`Unsupported key length: ${keyLen}`);
119920
+ const value = concat([lengthAndInput(fromString2(alg)), lengthAndInput(typeof producerInfo === "undefined" ? new Uint8Array(0) : producerInfo), lengthAndInput(typeof consumerInfo === "undefined" ? new Uint8Array(0) : consumerInfo), writeUint32BE(keyLen)]);
119921
+ const roundNumber = 1;
119922
+ return (0, import_sha256.hash)(concat([writeUint32BE(roundNumber), secret, value]));
119923
+ }
119924
+ __name(concatKDF, "concatKDF");
119925
+ new import_elliptic.ec("secp256k1");
119926
+ function EdDSASigner(secretKey) {
119927
+ const privateKeyBytes = parseKey(secretKey);
119928
+ if (privateKeyBytes.length !== 64) {
119929
+ throw new Error(`bad_key: Invalid private key format. Expecting 64 bytes, but got ${privateKeyBytes.length}`);
119930
+ }
119931
+ return function(data) {
119932
+ try {
119933
+ const dataBytes = typeof data === "string" ? stringToBytes(data) : data;
119934
+ const sig = (0, import_ed25519.sign)(privateKeyBytes, dataBytes);
119935
+ return Promise.resolve(bytesToBase64url(sig));
119936
+ } catch (e) {
119937
+ return Promise.reject(e);
119938
+ }
119939
+ };
119940
+ }
119941
+ __name(EdDSASigner, "EdDSASigner");
119942
+ function instanceOfEcdsaSignature(object) {
119943
+ return typeof object === "object" && "r" in object && "s" in object;
119944
+ }
119945
+ __name(instanceOfEcdsaSignature, "instanceOfEcdsaSignature");
119946
+ function ES256KSignerAlg(recoverable) {
119947
+ return /* @__PURE__ */ __name(function sign5(payload, signer) {
119948
+ try {
119949
+ return Promise.resolve(signer(payload)).then(function(signature2) {
119950
+ if (instanceOfEcdsaSignature(signature2)) {
119951
+ return toJose(signature2, recoverable);
119952
+ } else {
119953
+ if (recoverable && typeof fromJose(signature2).recoveryParam === "undefined") {
119954
+ throw new Error(`not_supported: ES256K-R not supported when signer doesn't provide a recovery param`);
119904
119955
  }
119956
+ return signature2;
119905
119957
  }
119906
- }
119907
- const bytes = yield module.arrayBuffer();
119908
- return yield WebAssembly.instantiate(bytes, imports);
119909
- } else {
119910
- const instance = yield WebAssembly.instantiate(module, imports);
119911
- if (instance instanceof WebAssembly.Instance) {
119912
- return { instance, module };
119913
- } else {
119914
- return instance;
119915
- }
119958
+ });
119959
+ } catch (e) {
119960
+ return Promise.reject(e);
119961
+ }
119962
+ }, "sign");
119963
+ }
119964
+ __name(ES256KSignerAlg, "ES256KSignerAlg");
119965
+ function Ed25519SignerAlg() {
119966
+ return /* @__PURE__ */ __name(function sign5(payload, signer) {
119967
+ try {
119968
+ return Promise.resolve(signer(payload)).then(function(signature2) {
119969
+ if (!instanceOfEcdsaSignature(signature2)) {
119970
+ return signature2;
119971
+ } else {
119972
+ throw new Error("invalid_config: expected a signer function that returns a string instead of signature object");
119973
+ }
119974
+ });
119975
+ } catch (e) {
119976
+ return Promise.reject(e);
119977
+ }
119978
+ }, "sign");
119979
+ }
119980
+ __name(Ed25519SignerAlg, "Ed25519SignerAlg");
119981
+ var algorithms$1 = {
119982
+ ES256K: ES256KSignerAlg(),
119983
+ "ES256K-R": ES256KSignerAlg(true),
119984
+ Ed25519: Ed25519SignerAlg(),
119985
+ EdDSA: Ed25519SignerAlg()
119986
+ };
119987
+ function SignerAlg(alg) {
119988
+ const impl = algorithms$1[alg];
119989
+ if (!impl)
119990
+ throw new Error(`not_supported: Unsupported algorithm ${alg}`);
119991
+ return impl;
119992
+ }
119993
+ __name(SignerAlg, "SignerAlg");
119994
+ var secp256k1 = new import_elliptic.ec("secp256k1");
119995
+ function toSignatureObject(signature2, recoverable = false) {
119996
+ const rawSig = base64ToBytes(signature2);
119997
+ if (rawSig.length !== (recoverable ? 65 : 64)) {
119998
+ throw new Error("wrong signature length");
119999
+ }
120000
+ const r = bytesToHex(rawSig.slice(0, 32));
120001
+ const s = bytesToHex(rawSig.slice(32, 64));
120002
+ const sigObj = {
120003
+ r,
120004
+ s
120005
+ };
120006
+ if (recoverable) {
120007
+ sigObj.recoveryParam = rawSig[64];
120008
+ }
120009
+ return sigObj;
120010
+ }
120011
+ __name(toSignatureObject, "toSignatureObject");
120012
+ function extractPublicKeyBytes(pk) {
120013
+ if (pk.publicKeyBase58) {
120014
+ return base58ToBytes(pk.publicKeyBase58);
120015
+ } else if (pk.publicKeyBase64) {
120016
+ return base64ToBytes(pk.publicKeyBase64);
120017
+ } else if (pk.publicKeyHex) {
120018
+ return hexToBytes(pk.publicKeyHex);
120019
+ } else if (pk.publicKeyJwk && pk.publicKeyJwk.crv === "secp256k1" && pk.publicKeyJwk.x && pk.publicKeyJwk.y) {
120020
+ return hexToBytes(secp256k1.keyFromPublic({
120021
+ x: bytesToHex(base64ToBytes(pk.publicKeyJwk.x)),
120022
+ y: bytesToHex(base64ToBytes(pk.publicKeyJwk.y))
120023
+ }).getPublic("hex"));
120024
+ } else if (pk.publicKeyMultibase) {
120025
+ const {
120026
+ base16: base162,
120027
+ base58btc: base58btc2,
120028
+ base64: base642,
120029
+ base64url: base64url2
120030
+ } = bases;
120031
+ const baseDecoder = base162.decoder.or(base58btc2.decoder.or(base642.decoder.or(base64url2.decoder)));
120032
+ return baseDecoder.decode(pk.publicKeyMultibase);
120033
+ }
120034
+ return new Uint8Array();
120035
+ }
120036
+ __name(extractPublicKeyBytes, "extractPublicKeyBytes");
120037
+ function verifyES256K(data, signature2, authenticators) {
120038
+ const hash3 = sha2562(data);
120039
+ const sigObj = toSignatureObject(signature2);
120040
+ const fullPublicKeys = authenticators.filter(({
120041
+ ethereumAddress,
120042
+ blockchainAccountId
120043
+ }) => {
120044
+ return typeof ethereumAddress === "undefined" && typeof blockchainAccountId === "undefined";
120045
+ });
120046
+ const ethAddressKeys = authenticators.filter(({
120047
+ ethereumAddress,
120048
+ blockchainAccountId
120049
+ }) => {
120050
+ return typeof ethereumAddress !== "undefined" || typeof blockchainAccountId !== void 0;
120051
+ });
120052
+ let signer = fullPublicKeys.find((pk) => {
120053
+ try {
120054
+ const pubBytes = extractPublicKeyBytes(pk);
120055
+ return secp256k1.keyFromPublic(pubBytes).verify(hash3, sigObj);
120056
+ } catch (err) {
120057
+ return false;
119916
120058
  }
119917
120059
  });
119918
- }
119919
- __name(load, "load");
119920
- function init(input) {
119921
- return __async$1(this, null, function* () {
119922
- const imports = {};
119923
- imports.wbg = {};
119924
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
119925
- const ret = getStringFromWasm0(arg0, arg1);
119926
- return addHeapObject(ret);
119927
- };
119928
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
119929
- takeObject(arg0);
119930
- };
119931
- imports.wbg.__wbindgen_cb_drop = function(arg0) {
119932
- const obj = takeObject(arg0).original;
119933
- if (obj.cnt-- == 1) {
119934
- obj.a = 0;
119935
- return true;
119936
- }
119937
- const ret = false;
119938
- return ret;
119939
- };
119940
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
119941
- const ret = getObject(arg0);
119942
- return addHeapObject(ret);
119943
- };
119944
- imports.wbg.__wbg_fetch_811d43d6bdcad5b1 = function(arg0) {
119945
- const ret = fetch(getObject(arg0));
119946
- return addHeapObject(ret);
119947
- };
119948
- imports.wbg.__wbg_fetch_bf56e2a9f0644e3f = function(arg0, arg1) {
119949
- const ret = getObject(arg0).fetch(getObject(arg1));
119950
- return addHeapObject(ret);
119951
- };
119952
- imports.wbg.__wbg_new_89d7f088c1c45353 = function() {
119953
- return handleError(function() {
119954
- const ret = new Headers();
119955
- return addHeapObject(ret);
119956
- }, arguments);
119957
- };
119958
- imports.wbg.__wbg_append_f4f93bc73c45ee3e = function() {
119959
- return handleError(function(arg0, arg1, arg2, arg3, arg4) {
119960
- getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
119961
- }, arguments);
119962
- };
119963
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
119964
- const obj = getObject(arg1);
119965
- const ret = typeof obj === "string" ? obj : void 0;
119966
- var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
119967
- var len0 = WASM_VECTOR_LEN;
119968
- getInt32Memory0()[arg0 / 4 + 1] = len0;
119969
- getInt32Memory0()[arg0 / 4 + 0] = ptr0;
119970
- };
119971
- imports.wbg.__wbg_instanceof_Response_ccfeb62399355bcd = function(arg0) {
119972
- const ret = getObject(arg0) instanceof Response;
119973
- return ret;
119974
- };
119975
- imports.wbg.__wbg_url_06c0f822d68d195c = function(arg0, arg1) {
119976
- const ret = getObject(arg1).url;
119977
- const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
119978
- const len0 = WASM_VECTOR_LEN;
119979
- getInt32Memory0()[arg0 / 4 + 1] = len0;
119980
- getInt32Memory0()[arg0 / 4 + 0] = ptr0;
119981
- };
119982
- imports.wbg.__wbg_status_600fd8b881393898 = function(arg0) {
119983
- const ret = getObject(arg0).status;
119984
- return ret;
119985
- };
119986
- imports.wbg.__wbg_headers_9e7f2c05a9b962ea = function(arg0) {
119987
- const ret = getObject(arg0).headers;
119988
- return addHeapObject(ret);
119989
- };
119990
- imports.wbg.__wbg_arrayBuffer_5a99283a3954c850 = function() {
119991
- return handleError(function(arg0) {
119992
- const ret = getObject(arg0).arrayBuffer();
119993
- return addHeapObject(ret);
119994
- }, arguments);
119995
- };
119996
- imports.wbg.__wbg_newwithstrandinit_fd99688f189f053e = function() {
119997
- return handleError(function(arg0, arg1, arg2) {
119998
- const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
119999
- return addHeapObject(ret);
120000
- }, arguments);
120001
- };
120002
- imports.wbg.__wbindgen_is_object = function(arg0) {
120003
- const val = getObject(arg0);
120004
- const ret = typeof val === "object" && val !== null;
120005
- return ret;
120006
- };
120007
- imports.wbg.__wbg_self_86b4b13392c7af56 = function() {
120008
- return handleError(function() {
120009
- const ret = self.self;
120010
- return addHeapObject(ret);
120011
- }, arguments);
120012
- };
120013
- imports.wbg.__wbg_crypto_b8c92eaac23d0d80 = function(arg0) {
120014
- const ret = getObject(arg0).crypto;
120015
- return addHeapObject(ret);
120016
- };
120017
- imports.wbg.__wbg_msCrypto_9ad6677321a08dd8 = function(arg0) {
120018
- const ret = getObject(arg0).msCrypto;
120019
- return addHeapObject(ret);
120020
- };
120021
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
120022
- const ret = getObject(arg0) === void 0;
120023
- return ret;
120024
- };
120025
- imports.wbg.__wbg_static_accessor_MODULE_452b4680e8614c81 = function() {
120026
- const ret = module;
120027
- return addHeapObject(ret);
120028
- };
120029
- imports.wbg.__wbg_require_f5521a5b85ad2542 = function(arg0, arg1, arg2) {
120030
- const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
120031
- return addHeapObject(ret);
120032
- };
120033
- imports.wbg.__wbg_getRandomValues_dd27e6b0652b3236 = function(arg0) {
120034
- const ret = getObject(arg0).getRandomValues;
120035
- return addHeapObject(ret);
120036
- };
120037
- imports.wbg.__wbg_getRandomValues_e57c9b75ddead065 = function(arg0, arg1) {
120038
- getObject(arg0).getRandomValues(getObject(arg1));
120039
- };
120040
- imports.wbg.__wbg_randomFillSync_d2ba53160aec6aba = function(arg0, arg1, arg2) {
120041
- getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
120042
- };
120043
- imports.wbg.__wbindgen_is_function = function(arg0) {
120044
- const ret = typeof getObject(arg0) === "function";
120045
- return ret;
120046
- };
120047
- imports.wbg.__wbg_newnoargs_e23b458e372830de = function(arg0, arg1) {
120048
- const ret = new Function(getStringFromWasm0(arg0, arg1));
120049
- return addHeapObject(ret);
120050
- };
120051
- imports.wbg.__wbg_next_cabb70b365520721 = function(arg0) {
120052
- const ret = getObject(arg0).next;
120053
- return addHeapObject(ret);
120054
- };
120055
- imports.wbg.__wbg_next_bf3d83fc18df496e = function() {
120056
- return handleError(function(arg0) {
120057
- const ret = getObject(arg0).next();
120058
- return addHeapObject(ret);
120059
- }, arguments);
120060
- };
120061
- imports.wbg.__wbg_done_040f966faa9a72b3 = function(arg0) {
120062
- const ret = getObject(arg0).done;
120063
- return ret;
120064
- };
120065
- imports.wbg.__wbg_value_419afbd9b9574c4c = function(arg0) {
120066
- const ret = getObject(arg0).value;
120067
- return addHeapObject(ret);
120068
- };
120069
- imports.wbg.__wbg_iterator_4832ef1f15b0382b = function() {
120070
- const ret = Symbol.iterator;
120071
- return addHeapObject(ret);
120072
- };
120073
- imports.wbg.__wbg_get_a9cab131e3152c49 = function() {
120074
- return handleError(function(arg0, arg1) {
120075
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
120076
- return addHeapObject(ret);
120077
- }, arguments);
120078
- };
120079
- imports.wbg.__wbg_call_ae78342adc33730a = function() {
120080
- return handleError(function(arg0, arg1) {
120081
- const ret = getObject(arg0).call(getObject(arg1));
120082
- return addHeapObject(ret);
120083
- }, arguments);
120084
- };
120085
- imports.wbg.__wbg_new_36359baae5a47e27 = function() {
120086
- const ret = new Object();
120087
- return addHeapObject(ret);
120088
- };
120089
- imports.wbg.__wbg_call_3ed288a247f13ea5 = function() {
120090
- return handleError(function(arg0, arg1, arg2) {
120091
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
120092
- return addHeapObject(ret);
120093
- }, arguments);
120094
- };
120095
- imports.wbg.__wbg_getTime_bffb1c09df09618b = function(arg0) {
120096
- const ret = getObject(arg0).getTime();
120097
- return ret;
120098
- };
120099
- imports.wbg.__wbg_new0_0ff7eb5c1486f3ec = function() {
120100
- const ret = new Date();
120101
- return addHeapObject(ret);
120102
- };
120103
- imports.wbg.__wbg_new_37705eed627d5ed9 = function(arg0, arg1) {
120104
- try {
120105
- var state0 = { a: arg0, b: arg1 };
120106
- var cb0 = /* @__PURE__ */ __name((arg02, arg12) => {
120107
- const a = state0.a;
120108
- state0.a = 0;
120109
- try {
120110
- return __wbg_adapter_108(a, state0.b, arg02, arg12);
120111
- } finally {
120112
- state0.a = a;
120113
- }
120114
- }, "cb0");
120115
- const ret = new Promise(cb0);
120116
- return addHeapObject(ret);
120117
- } finally {
120118
- state0.a = state0.b = 0;
120119
- }
120120
- };
120121
- imports.wbg.__wbg_resolve_a9a87bdd64e9e62c = function(arg0) {
120122
- const ret = Promise.resolve(getObject(arg0));
120123
- return addHeapObject(ret);
120124
- };
120125
- imports.wbg.__wbg_then_ce526c837d07b68f = function(arg0, arg1) {
120126
- const ret = getObject(arg0).then(getObject(arg1));
120127
- return addHeapObject(ret);
120128
- };
120129
- imports.wbg.__wbg_then_842e65b843962f56 = function(arg0, arg1, arg2) {
120130
- const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
120131
- return addHeapObject(ret);
120132
- };
120133
- imports.wbg.__wbg_self_99737b4dcdf6f0d8 = function() {
120134
- return handleError(function() {
120135
- const ret = self.self;
120136
- return addHeapObject(ret);
120137
- }, arguments);
120138
- };
120139
- imports.wbg.__wbg_window_9b61fbbf3564c4fb = function() {
120140
- return handleError(function() {
120141
- const ret = window.window;
120142
- return addHeapObject(ret);
120143
- }, arguments);
120144
- };
120145
- imports.wbg.__wbg_globalThis_8e275ef40caea3a3 = function() {
120146
- return handleError(function() {
120147
- const ret = globalThis.globalThis;
120148
- return addHeapObject(ret);
120149
- }, arguments);
120150
- };
120151
- imports.wbg.__wbg_global_5de1e0f82bddcd27 = function() {
120152
- return handleError(function() {
120153
- const ret = global.global;
120154
- return addHeapObject(ret);
120155
- }, arguments);
120156
- };
120157
- imports.wbg.__wbg_buffer_7af23f65f6c64548 = function(arg0) {
120158
- const ret = getObject(arg0).buffer;
120159
- return addHeapObject(ret);
120160
- };
120161
- imports.wbg.__wbg_newwithbyteoffsetandlength_ce1e75f0ce5f7974 = function(arg0, arg1, arg2) {
120162
- const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
120163
- return addHeapObject(ret);
120164
- };
120165
- imports.wbg.__wbg_new_cc9018bd6f283b6f = function(arg0) {
120166
- const ret = new Uint8Array(getObject(arg0));
120167
- return addHeapObject(ret);
120168
- };
120169
- imports.wbg.__wbg_set_f25e869e4565d2a2 = function(arg0, arg1, arg2) {
120170
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
120171
- };
120172
- imports.wbg.__wbg_length_0acb1cf9bbaf8519 = function(arg0) {
120173
- const ret = getObject(arg0).length;
120174
- return ret;
120175
- };
120176
- imports.wbg.__wbg_newwithlength_8f0657faca9f1422 = function(arg0) {
120177
- const ret = new Uint8Array(arg0 >>> 0);
120178
- return addHeapObject(ret);
120179
- };
120180
- imports.wbg.__wbg_subarray_da527dbd24eafb6b = function(arg0, arg1, arg2) {
120181
- const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
120182
- return addHeapObject(ret);
120183
- };
120184
- imports.wbg.__wbg_has_ce995ec88636803d = function() {
120185
- return handleError(function(arg0, arg1) {
120186
- const ret = Reflect.has(getObject(arg0), getObject(arg1));
120187
- return ret;
120188
- }, arguments);
120189
- };
120190
- imports.wbg.__wbg_set_93b1c87ee2af852e = function() {
120191
- return handleError(function(arg0, arg1, arg2) {
120192
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
120193
- return ret;
120194
- }, arguments);
120195
- };
120196
- imports.wbg.__wbg_stringify_c760003feffcc1f2 = function() {
120197
- return handleError(function(arg0) {
120198
- const ret = JSON.stringify(getObject(arg0));
120199
- return addHeapObject(ret);
120200
- }, arguments);
120201
- };
120202
- imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
120203
- const ret = debugString(getObject(arg1));
120204
- const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
120205
- const len0 = WASM_VECTOR_LEN;
120206
- getInt32Memory0()[arg0 / 4 + 1] = len0;
120207
- getInt32Memory0()[arg0 / 4 + 0] = ptr0;
120208
- };
120209
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
120210
- throw new Error(getStringFromWasm0(arg0, arg1));
120211
- };
120212
- imports.wbg.__wbindgen_memory = function() {
120213
- const ret = wasm.memory;
120214
- return addHeapObject(ret);
120215
- };
120216
- imports.wbg.__wbindgen_closure_wrapper10902 = function(arg0, arg1, arg2) {
120217
- const ret = makeMutClosure(arg0, arg1, 3717, __wbg_adapter_24);
120218
- return addHeapObject(ret);
120219
- };
120220
- if (typeof input === "string" || typeof Request === "function" && input instanceof Request || typeof URL === "function" && input instanceof URL) {
120221
- input = fetch(input);
120222
- }
120223
- const { instance, module } = yield load(yield input, imports);
120224
- wasm = instance.exports;
120225
- init.__wbindgen_wasm_module = module;
120226
- return wasm;
120227
- });
120228
- }
120229
- __name(init, "init");
120230
- var didkit_wasm_default = init;
120231
- var initialized = false;
120232
- var init2 = /* @__PURE__ */ __name((arg = "https://cdn.filestackcontent.com/jXExSjNXSerFVDMIYOgy") => __async$1(void 0, null, function* () {
120233
- if (initialized)
120234
- return;
120235
- initialized = true;
120236
- return didkit_wasm_default(arg);
120237
- }), "init");
120238
- var didkit_default = init2;
120239
- if (typeof window === "undefined")
120240
- globalThis.crypto = crypto2;
120241
- var addPluginToWallet = /* @__PURE__ */ __name((wallet, plugin) => __async$1(void 0, null, function* () {
120242
- return generateWallet(wallet.contents, {
120243
- plugins: [...wallet.plugins, plugin]
120244
- });
120245
- }), "addPluginToWallet");
120246
- var addToWallet = /* @__PURE__ */ __name((wallet, content) => __async$1(void 0, null, function* () {
120247
- return generateWallet([...wallet.contents, content], wallet);
120248
- }), "addToWallet");
120249
- var removeFromWallet = /* @__PURE__ */ __name((wallet, contentId) => __async$1(void 0, null, function* () {
120250
- const clonedContents = JSON.parse(JSON.stringify(wallet.contents));
120251
- const content = clonedContents.find((c) => c.id === contentId);
120252
- return generateWallet(clonedContents.filter((i) => i.id !== content.id), wallet);
120253
- }), "removeFromWallet");
120254
- var bindMethods = /* @__PURE__ */ __name((wallet, pluginMethods) => Object.fromEntries(Object.entries(pluginMethods).map(([key2, method]) => [key2, method.bind(wallet, wallet)])), "bindMethods");
120255
- var generateWallet = /* @__PURE__ */ __name((..._0) => __async$1(void 0, [..._0], function* (contents = [], _wallet = {}) {
120256
- const { plugins = [] } = _wallet;
120257
- const pluginMethods = plugins.reduce((cumulativePluginMethods, plugin) => {
120258
- const newPluginMethods = __spreadValues(__spreadValues({}, cumulativePluginMethods), plugin.pluginMethods);
120259
- return newPluginMethods;
120260
- }, {});
120261
- const wallet = {
120262
- contents: [...contents],
120263
- add: function(content) {
120264
- return addToWallet(this, content);
120265
- },
120266
- remove: function(contentId) {
120267
- return removeFromWallet(this, contentId);
120268
- },
120269
- status: "UNLOCKED",
120270
- plugins,
120271
- pluginMethods,
120272
- addPlugin: function(plugin) {
120273
- return addPluginToWallet(this, plugin);
120274
- }
120275
- };
120276
- if (pluginMethods)
120277
- wallet.pluginMethods = bindMethods(wallet, pluginMethods);
120278
- return wallet;
120279
- }), "generateWallet");
120280
- function _catch(body, recover) {
120281
- try {
120282
- var result = body();
120283
- } catch (e) {
120284
- return recover(e);
120285
- }
120286
- if (result && result.then) {
120287
- return result.then(void 0, recover);
120288
- }
120289
- return result;
120290
- }
120291
- __name(_catch, "_catch");
120292
- function inMemoryCache() {
120293
- const cache = /* @__PURE__ */ new Map();
120294
- return function(parsed, resolve) {
120295
- try {
120296
- let _temp2 = function(_result) {
120297
- if (_exit)
120298
- return _result;
120299
- const cached = cache.get(parsed.didUrl);
120300
- return cached !== void 0 ? cached : Promise.resolve(resolve()).then(function(result) {
120301
- var _result$didResolution;
120302
- if (((_result$didResolution = result.didResolutionMetadata) == null ? void 0 : _result$didResolution.error) !== "notFound") {
120303
- cache.set(parsed.didUrl, result);
120304
- }
120305
- return result;
120306
- });
120307
- };
120308
- __name(_temp2, "_temp2");
120309
- let _exit;
120310
- const _temp = function() {
120311
- if (parsed.params && parsed.params["no-cache"] === "true") {
120312
- return Promise.resolve(resolve()).then(function(_await$resolve) {
120313
- _exit = 1;
120314
- return _await$resolve;
120315
- });
120316
- }
120317
- }();
120318
- return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
120319
- } catch (e) {
120320
- return Promise.reject(e);
120321
- }
120322
- };
120323
- }
120324
- __name(inMemoryCache, "inMemoryCache");
120325
- function noCache(parsed, resolve) {
120326
- return resolve();
120327
- }
120328
- __name(noCache, "noCache");
120329
- var PCT_ENCODED = "(?:%[0-9a-fA-F]{2})";
120330
- var ID_CHAR = `(?:[a-zA-Z0-9._-]|${PCT_ENCODED})`;
120331
- var METHOD = "([a-z0-9]+)";
120332
- var METHOD_ID = `((?:${ID_CHAR}*:)*(${ID_CHAR}+))`;
120333
- var PARAM_CHAR = "[a-zA-Z0-9_.:%-]";
120334
- var PARAM = `;${PARAM_CHAR}+=${PARAM_CHAR}*`;
120335
- var PARAMS = `((${PARAM})*)`;
120336
- var PATH = `(/[^#?]*)?`;
120337
- var QUERY = `([?][^#]*)?`;
120338
- var FRAGMENT = `(#.*)?`;
120339
- var DID_MATCHER = new RegExp(`^did:${METHOD}:${METHOD_ID}${PARAMS}${PATH}${QUERY}${FRAGMENT}$`);
120340
- function parse(didUrl) {
120341
- if (didUrl === "" || !didUrl)
120342
- return null;
120343
- const sections = didUrl.match(DID_MATCHER);
120344
- if (sections) {
120345
- const parts = {
120346
- did: `did:${sections[1]}:${sections[2]}`,
120347
- method: sections[1],
120348
- id: sections[2],
120349
- didUrl
120350
- };
120351
- if (sections[4]) {
120352
- const params = sections[4].slice(1).split(";");
120353
- parts.params = {};
120354
- for (const p of params) {
120355
- const kv = p.split("=");
120356
- parts.params[kv[0]] = kv[1];
120357
- }
120358
- }
120359
- if (sections[6])
120360
- parts.path = sections[6];
120361
- if (sections[7])
120362
- parts.query = sections[7].slice(1);
120363
- if (sections[8])
120364
- parts.fragment = sections[8].slice(1);
120365
- return parts;
120366
- }
120367
- return null;
120368
- }
120369
- __name(parse, "parse");
120370
- var EMPTY_RESULT = {
120371
- didResolutionMetadata: {},
120372
- didDocument: null,
120373
- didDocumentMetadata: {}
120374
- };
120375
- function wrapLegacyResolver(resolve) {
120376
- return function(did, parsed, resolver) {
120377
- try {
120378
- return Promise.resolve(_catch(function() {
120379
- return Promise.resolve(resolve(did, parsed, resolver)).then(function(doc) {
120380
- return __spreadProps(__spreadValues({}, EMPTY_RESULT), {
120381
- didResolutionMetadata: {
120382
- contentType: "application/did+ld+json"
120383
- },
120384
- didDocument: doc
120385
- });
120386
- });
120387
- }, function(e) {
120388
- return __spreadProps(__spreadValues({}, EMPTY_RESULT), {
120389
- didResolutionMetadata: {
120390
- error: "notFound",
120391
- message: e.toString()
120392
- }
120393
- });
120394
- }));
120395
- } catch (e) {
120396
- return Promise.reject(e);
120397
- }
120398
- };
120399
- }
120400
- __name(wrapLegacyResolver, "wrapLegacyResolver");
120401
- var Resolver = class {
120402
- constructor(registry2 = {}, options = {}) {
120403
- this.registry = void 0;
120404
- this.cache = void 0;
120405
- this.registry = registry2;
120406
- this.cache = options.cache === true ? inMemoryCache() : options.cache || noCache;
120407
- if (options.legacyResolvers) {
120408
- Object.keys(options.legacyResolvers).map((methodName) => {
120409
- if (!this.registry[methodName]) {
120410
- this.registry[methodName] = wrapLegacyResolver(options.legacyResolvers[methodName]);
120411
- }
120412
- });
120413
- }
120414
- }
120415
- resolve(didUrl, options = {}) {
120416
- try {
120417
- const _this = this;
120418
- const parsed = parse(didUrl);
120419
- if (parsed === null) {
120420
- return Promise.resolve(__spreadProps(__spreadValues({}, EMPTY_RESULT), {
120421
- didResolutionMetadata: {
120422
- error: "invalidDid"
120423
- }
120424
- }));
120425
- }
120426
- const resolver = _this.registry[parsed.method];
120427
- if (!resolver) {
120428
- return Promise.resolve(__spreadProps(__spreadValues({}, EMPTY_RESULT), {
120429
- didResolutionMetadata: {
120430
- error: "unsupportedDidMethod"
120431
- }
120432
- }));
120433
- }
120434
- return Promise.resolve(_this.cache(parsed, () => resolver(parsed.did, parsed, _this, options)));
120435
- } catch (e) {
120436
- return Promise.reject(e);
120437
- }
120438
- }
120439
- };
120440
- __name(Resolver, "Resolver");
120441
- init_concat();
120442
- init_from_string();
120443
- init_to_string();
120444
- init_basics();
120445
- var import_sha256 = __toESM(require_sha256());
120446
- var import_js_sha3 = __toESM(require_sha3());
120447
- var import_elliptic = __toESM(require_elliptic());
120448
- var import_ed25519 = __toESM(require_ed25519());
120449
- var import_canonicalize = __toESM(require_canonicalize());
120450
- var import_x25519 = __toESM(require_x25519());
120451
- var import_xchacha20poly1305 = __toESM(require_xchacha20poly1305());
120452
- var import_random = __toESM(require_random());
120453
- function bytesToBase64url(b) {
120454
- return toString3(b, "base64url");
120455
- }
120456
- __name(bytesToBase64url, "bytesToBase64url");
120457
- function base64ToBytes(s) {
120458
- const inputBase64Url = s.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
120459
- return fromString2(inputBase64Url, "base64url");
120460
- }
120461
- __name(base64ToBytes, "base64ToBytes");
120462
- function base58ToBytes(s) {
120463
- return fromString2(s, "base58btc");
120464
- }
120465
- __name(base58ToBytes, "base58ToBytes");
120466
- function hexToBytes(s) {
120467
- const input = s.startsWith("0x") ? s.substring(2) : s;
120468
- return fromString2(input.toLowerCase(), "base16");
120469
- }
120470
- __name(hexToBytes, "hexToBytes");
120471
- function encodeBase64url(s) {
120472
- return bytesToBase64url(fromString2(s));
120473
- }
120474
- __name(encodeBase64url, "encodeBase64url");
120475
- function decodeBase64url(s) {
120476
- return toString3(base64ToBytes(s));
120477
- }
120478
- __name(decodeBase64url, "decodeBase64url");
120479
- function bytesToHex(b) {
120480
- return toString3(b, "base16");
120481
- }
120482
- __name(bytesToHex, "bytesToHex");
120483
- function stringToBytes(s) {
120484
- return fromString2(s);
120485
- }
120486
- __name(stringToBytes, "stringToBytes");
120487
- function toJose({
120488
- r,
120489
- s,
120490
- recoveryParam
120491
- }, recoverable) {
120492
- const jose = new Uint8Array(recoverable ? 65 : 64);
120493
- jose.set(fromString2(r, "base16"), 0);
120494
- jose.set(fromString2(s, "base16"), 32);
120495
- if (recoverable) {
120496
- if (typeof recoveryParam === "undefined") {
120497
- throw new Error("Signer did not return a recoveryParam");
120498
- }
120499
- jose[64] = recoveryParam;
120500
- }
120501
- return bytesToBase64url(jose);
120502
- }
120503
- __name(toJose, "toJose");
120504
- function fromJose(signature2) {
120505
- const signatureBytes = base64ToBytes(signature2);
120506
- if (signatureBytes.length < 64 || signatureBytes.length > 65) {
120507
- throw new TypeError(`Wrong size for signature. Expected 64 or 65 bytes, but got ${signatureBytes.length}`);
120508
- }
120509
- const r = bytesToHex(signatureBytes.slice(0, 32));
120510
- const s = bytesToHex(signatureBytes.slice(32, 64));
120511
- const recoveryParam = signatureBytes.length === 65 ? signatureBytes[64] : void 0;
120512
- return {
120513
- r,
120514
- s,
120515
- recoveryParam
120516
- };
120517
- }
120518
- __name(fromJose, "fromJose");
120519
- function toSealed(ciphertext, tag) {
120520
- return concat([base64ToBytes(ciphertext), base64ToBytes(tag)]);
120521
- }
120522
- __name(toSealed, "toSealed");
120523
- var hexMatcher = /^(0x)?([a-fA-F0-9]{64}|[a-fA-F0-9]{128})$/;
120524
- var base58Matcher = /^([1-9A-HJ-NP-Za-km-z]{44}|[1-9A-HJ-NP-Za-km-z]{88})$/;
120525
- var base64Matcher = /^([0-9a-zA-Z=\-_+/]{43}|[0-9a-zA-Z=\-_+/]{86})(={0,2})$/;
120526
- function parseKey(input) {
120527
- if (typeof input === "string") {
120528
- if (hexMatcher.test(input)) {
120529
- return hexToBytes(input);
120530
- } else if (base58Matcher.test(input)) {
120531
- return base58ToBytes(input);
120532
- } else if (base64Matcher.test(input)) {
120533
- return base64ToBytes(input);
120534
- } else {
120535
- throw TypeError("bad_key: Invalid private key format");
120536
- }
120537
- } else if (input instanceof Uint8Array) {
120538
- return input;
120539
- } else {
120540
- throw TypeError("bad_key: Invalid private key format");
120541
- }
120542
- }
120543
- __name(parseKey, "parseKey");
120544
- function sha2562(payload) {
120545
- const data = typeof payload === "string" ? fromString2(payload) : payload;
120546
- return (0, import_sha256.hash)(data);
120547
- }
120548
- __name(sha2562, "sha256");
120549
- function keccak(data) {
120550
- return new Uint8Array(import_js_sha3.keccak_256.arrayBuffer(data));
120551
- }
120552
- __name(keccak, "keccak");
120553
- function toEthereumAddress(hexPublicKey) {
120554
- const hashInput = fromString2(hexPublicKey.slice(2), "base16");
120555
- return `0x${toString3(keccak(hashInput).slice(-20), "base16")}`;
120556
- }
120557
- __name(toEthereumAddress, "toEthereumAddress");
120558
- function writeUint32BE(value, array = new Uint8Array(4)) {
120559
- const encoded = fromString2(value.toString(), "base10");
120560
- array.set(encoded, 4 - encoded.length);
120561
- return array;
120562
- }
120563
- __name(writeUint32BE, "writeUint32BE");
120564
- var lengthAndInput = /* @__PURE__ */ __name((input) => concat([writeUint32BE(input.length), input]), "lengthAndInput");
120565
- function concatKDF(secret, keyLen, alg, producerInfo, consumerInfo) {
120566
- if (keyLen !== 256)
120567
- throw new Error(`Unsupported key length: ${keyLen}`);
120568
- const value = concat([lengthAndInput(fromString2(alg)), lengthAndInput(typeof producerInfo === "undefined" ? new Uint8Array(0) : producerInfo), lengthAndInput(typeof consumerInfo === "undefined" ? new Uint8Array(0) : consumerInfo), writeUint32BE(keyLen)]);
120569
- const roundNumber = 1;
120570
- return (0, import_sha256.hash)(concat([writeUint32BE(roundNumber), secret, value]));
120571
- }
120572
- __name(concatKDF, "concatKDF");
120573
- new import_elliptic.ec("secp256k1");
120574
- function EdDSASigner(secretKey) {
120575
- const privateKeyBytes = parseKey(secretKey);
120576
- if (privateKeyBytes.length !== 64) {
120577
- throw new Error(`bad_key: Invalid private key format. Expecting 64 bytes, but got ${privateKeyBytes.length}`);
120578
- }
120579
- return function(data) {
120580
- try {
120581
- const dataBytes = typeof data === "string" ? stringToBytes(data) : data;
120582
- const sig = (0, import_ed25519.sign)(privateKeyBytes, dataBytes);
120583
- return Promise.resolve(bytesToBase64url(sig));
120584
- } catch (e) {
120585
- return Promise.reject(e);
120586
- }
120587
- };
120588
- }
120589
- __name(EdDSASigner, "EdDSASigner");
120590
- function instanceOfEcdsaSignature(object) {
120591
- return typeof object === "object" && "r" in object && "s" in object;
120592
- }
120593
- __name(instanceOfEcdsaSignature, "instanceOfEcdsaSignature");
120594
- function ES256KSignerAlg(recoverable) {
120595
- return /* @__PURE__ */ __name(function sign5(payload, signer) {
120596
- try {
120597
- return Promise.resolve(signer(payload)).then(function(signature2) {
120598
- if (instanceOfEcdsaSignature(signature2)) {
120599
- return toJose(signature2, recoverable);
120600
- } else {
120601
- if (recoverable && typeof fromJose(signature2).recoveryParam === "undefined") {
120602
- throw new Error(`not_supported: ES256K-R not supported when signer doesn't provide a recovery param`);
120603
- }
120604
- return signature2;
120605
- }
120606
- });
120607
- } catch (e) {
120608
- return Promise.reject(e);
120609
- }
120610
- }, "sign");
120611
- }
120612
- __name(ES256KSignerAlg, "ES256KSignerAlg");
120613
- function Ed25519SignerAlg() {
120614
- return /* @__PURE__ */ __name(function sign5(payload, signer) {
120615
- try {
120616
- return Promise.resolve(signer(payload)).then(function(signature2) {
120617
- if (!instanceOfEcdsaSignature(signature2)) {
120618
- return signature2;
120619
- } else {
120620
- throw new Error("invalid_config: expected a signer function that returns a string instead of signature object");
120621
- }
120622
- });
120623
- } catch (e) {
120624
- return Promise.reject(e);
120625
- }
120626
- }, "sign");
120627
- }
120628
- __name(Ed25519SignerAlg, "Ed25519SignerAlg");
120629
- var algorithms$1 = {
120630
- ES256K: ES256KSignerAlg(),
120631
- "ES256K-R": ES256KSignerAlg(true),
120632
- Ed25519: Ed25519SignerAlg(),
120633
- EdDSA: Ed25519SignerAlg()
120634
- };
120635
- function SignerAlg(alg) {
120636
- const impl = algorithms$1[alg];
120637
- if (!impl)
120638
- throw new Error(`not_supported: Unsupported algorithm ${alg}`);
120639
- return impl;
120640
- }
120641
- __name(SignerAlg, "SignerAlg");
120642
- var secp256k1 = new import_elliptic.ec("secp256k1");
120643
- function toSignatureObject(signature2, recoverable = false) {
120644
- const rawSig = base64ToBytes(signature2);
120645
- if (rawSig.length !== (recoverable ? 65 : 64)) {
120646
- throw new Error("wrong signature length");
120647
- }
120648
- const r = bytesToHex(rawSig.slice(0, 32));
120649
- const s = bytesToHex(rawSig.slice(32, 64));
120650
- const sigObj = {
120651
- r,
120652
- s
120653
- };
120654
- if (recoverable) {
120655
- sigObj.recoveryParam = rawSig[64];
120656
- }
120657
- return sigObj;
120658
- }
120659
- __name(toSignatureObject, "toSignatureObject");
120660
- function extractPublicKeyBytes(pk) {
120661
- if (pk.publicKeyBase58) {
120662
- return base58ToBytes(pk.publicKeyBase58);
120663
- } else if (pk.publicKeyBase64) {
120664
- return base64ToBytes(pk.publicKeyBase64);
120665
- } else if (pk.publicKeyHex) {
120666
- return hexToBytes(pk.publicKeyHex);
120667
- } else if (pk.publicKeyJwk && pk.publicKeyJwk.crv === "secp256k1" && pk.publicKeyJwk.x && pk.publicKeyJwk.y) {
120668
- return hexToBytes(secp256k1.keyFromPublic({
120669
- x: bytesToHex(base64ToBytes(pk.publicKeyJwk.x)),
120670
- y: bytesToHex(base64ToBytes(pk.publicKeyJwk.y))
120671
- }).getPublic("hex"));
120672
- } else if (pk.publicKeyMultibase) {
120673
- const {
120674
- base16: base162,
120675
- base58btc: base58btc2,
120676
- base64: base642,
120677
- base64url: base64url2
120678
- } = bases;
120679
- const baseDecoder = base162.decoder.or(base58btc2.decoder.or(base642.decoder.or(base64url2.decoder)));
120680
- return baseDecoder.decode(pk.publicKeyMultibase);
120681
- }
120682
- return new Uint8Array();
120683
- }
120684
- __name(extractPublicKeyBytes, "extractPublicKeyBytes");
120685
- function verifyES256K(data, signature2, authenticators) {
120686
- const hash3 = sha2562(data);
120687
- const sigObj = toSignatureObject(signature2);
120688
- const fullPublicKeys = authenticators.filter(({
120689
- ethereumAddress,
120690
- blockchainAccountId
120691
- }) => {
120692
- return typeof ethereumAddress === "undefined" && typeof blockchainAccountId === "undefined";
120693
- });
120694
- const ethAddressKeys = authenticators.filter(({
120695
- ethereumAddress,
120696
- blockchainAccountId
120697
- }) => {
120698
- return typeof ethereumAddress !== "undefined" || typeof blockchainAccountId !== void 0;
120699
- });
120700
- let signer = fullPublicKeys.find((pk) => {
120701
- try {
120702
- const pubBytes = extractPublicKeyBytes(pk);
120703
- return secp256k1.keyFromPublic(pubBytes).verify(hash3, sigObj);
120704
- } catch (err) {
120705
- return false;
120706
- }
120707
- });
120708
- if (!signer && ethAddressKeys.length > 0) {
120709
- signer = verifyRecoverableES256K(data, signature2, ethAddressKeys);
120710
- }
120711
- if (!signer)
120712
- throw new Error("invalid_signature: Signature invalid for JWT");
120713
- return signer;
120060
+ if (!signer && ethAddressKeys.length > 0) {
120061
+ signer = verifyRecoverableES256K(data, signature2, ethAddressKeys);
120062
+ }
120063
+ if (!signer)
120064
+ throw new Error("invalid_signature: Signature invalid for JWT");
120065
+ return signer;
120714
120066
  }
120715
120067
  __name(verifyES256K, "verifyES256K");
120716
120068
  function verifyRecoverableES256K(data, signature2, authenticators) {
@@ -122231,7 +121583,7 @@ function decodeString64(data, pos, _minor, options) {
122231
121583
  return toToken2(data, pos, 9, l, options);
122232
121584
  }
122233
121585
  __name(decodeString64, "decodeString64");
122234
- var encodeString2 = encodeBytes;
121586
+ var encodeString = encodeBytes;
122235
121587
  function toToken3(_data, _pos, prefix, length2) {
122236
121588
  return new Token(Type.array, length2, prefix);
122237
121589
  }
@@ -122699,7 +122051,7 @@ function makeCborEncoders() {
122699
122051
  encoders[Type.uint.major] = encodeUint;
122700
122052
  encoders[Type.negint.major] = encodeNegint;
122701
122053
  encoders[Type.bytes.major] = encodeBytes;
122702
- encoders[Type.string.major] = encodeString2;
122054
+ encoders[Type.string.major] = encodeString;
122703
122055
  encoders[Type.array.major] = encodeArray;
122704
122056
  encoders[Type.map.major] = encodeMap;
122705
122057
  encoders[Type.tag.major] = encodeTag;
@@ -125885,7 +125237,7 @@ function HmacDRBG(options) {
125885
125237
  }
125886
125238
  __name(HmacDRBG, "HmacDRBG");
125887
125239
  var hmacDrbg = HmacDRBG;
125888
- HmacDRBG.prototype._init = /* @__PURE__ */ __name(function init3(entropy, nonce, pers) {
125240
+ HmacDRBG.prototype._init = /* @__PURE__ */ __name(function init(entropy, nonce, pers) {
125889
125241
  var seed = entropy.concat(nonce).concat(pers);
125890
125242
  this.K = new Array(this.outLen / 8);
125891
125243
  this.V = new Array(this.outLen / 8);
@@ -132542,10 +131894,9 @@ var getDidKeyPlugin = /* @__PURE__ */ __name((wallet, key2) => __async$1(void 0,
132542
131894
  if (key2.length > 64)
132543
131895
  throw new Error("Key must be less than 64 characters");
132544
131896
  const keypair = wallet.pluginMethods.generateEd25519KeyFromBytes(toUint8Array(key2.padStart(64, "0")));
132545
- const did = wallet.pluginMethods.keyToDid("key", keypair);
132546
131897
  return {
132547
131898
  pluginMethods: {
132548
- getSubjectDid: () => did,
131899
+ getSubjectDid: (_wallet, type) => wallet.pluginMethods.keyToDid(type, keypair),
132549
131900
  getSubjectKeypair: () => keypair,
132550
131901
  getKey: () => key2.padStart(64, "0")
132551
131902
  }
@@ -132564,7 +131915,8 @@ var ExpirationPlugin = /* @__PURE__ */ __name((wallet) => ({
132564
131915
  })
132565
131916
  }
132566
131917
  }), "ExpirationPlugin");
132567
- var issueCredential2 = /* @__PURE__ */ __name((initWallet) => {
131918
+ var recycleDependents = /* @__PURE__ */ __name((_methods) => ({}), "recycleDependents");
131919
+ var issueCredential = /* @__PURE__ */ __name((initWallet) => {
132568
131920
  return (wallet, credential) => __async$1(void 0, null, function* () {
132569
131921
  const kp = wallet.pluginMethods.getSubjectKeypair();
132570
131922
  if (!kp)
@@ -132576,14 +131928,14 @@ var issueCredential2 = /* @__PURE__ */ __name((initWallet) => {
132576
131928
  return initWallet.pluginMethods.issueCredential(credential, options, kp);
132577
131929
  });
132578
131930
  }, "issueCredential");
132579
- var verifyCredential2 = /* @__PURE__ */ __name((initWallet) => {
131931
+ var verifyCredential = /* @__PURE__ */ __name((initWallet) => {
132580
131932
  return (_wallet, credential) => __async$1(void 0, null, function* () {
132581
131933
  return initWallet.pluginMethods.verifyCredential(credential);
132582
131934
  });
132583
131935
  }, "verifyCredential");
132584
- var issuePresentation2 = /* @__PURE__ */ __name((initWallet) => {
131936
+ var issuePresentation = /* @__PURE__ */ __name((initWallet) => {
132585
131937
  return (wallet, credential) => __async$1(void 0, null, function* () {
132586
- const did = wallet.pluginMethods.getSubjectDid();
131938
+ const did = wallet.pluginMethods.getSubjectDid("key");
132587
131939
  if (!did)
132588
131940
  throw new Error("Cannot create presentation: No holder key found");
132589
131941
  const holder = did;
@@ -132603,20 +131955,20 @@ var issuePresentation2 = /* @__PURE__ */ __name((initWallet) => {
132603
131955
  return initWallet.pluginMethods.issuePresentation(presentation, options, kp);
132604
131956
  });
132605
131957
  }, "issuePresentation");
132606
- var verifyPresentation2 = /* @__PURE__ */ __name((initWallet) => {
131958
+ var verifyPresentation = /* @__PURE__ */ __name((initWallet) => {
132607
131959
  return (_wallet, presentation) => __async$1(void 0, null, function* () {
132608
131960
  return initWallet.pluginMethods.verifyPresentation(presentation);
132609
131961
  });
132610
131962
  }, "verifyPresentation");
132611
131963
  var getVCPlugin = /* @__PURE__ */ __name((wallet) => __async$1(void 0, null, function* () {
132612
131964
  return {
132613
- pluginMethods: __spreadProps(__spreadValues({}, wallet.pluginMethods), {
132614
- issueCredential: issueCredential2(wallet),
132615
- verifyCredential: verifyCredential2(wallet),
132616
- issuePresentation: issuePresentation2(wallet),
132617
- verifyPresentation: verifyPresentation2(wallet),
131965
+ pluginMethods: __spreadProps(__spreadValues({}, recycleDependents(wallet.pluginMethods)), {
131966
+ issueCredential: issueCredential(wallet),
131967
+ verifyCredential: verifyCredential(wallet),
131968
+ issuePresentation: issuePresentation(wallet),
131969
+ verifyPresentation: verifyPresentation(wallet),
132618
131970
  getTestVc: (_wallet, subject = "did:example:d23dd687a7dc6787646f2eb98d0") => {
132619
- const did = _wallet.pluginMethods.getSubjectDid();
131971
+ const did = _wallet.pluginMethods.getSubjectDid("key");
132620
131972
  return {
132621
131973
  "@context": ["https://www.w3.org/2018/credentials/v1"],
132622
131974
  id: "http://example.org/credentials/3731",
@@ -136825,431 +136177,1088 @@ var formatters2 = {
136825
136177
  });
136826
136178
  case "BBBB":
136827
136179
  default:
136828
- return localize2.dayPeriod(dayPeriodEnumValue, {
136829
- width: "wide",
136830
- context: "formatting"
136831
- });
136180
+ return localize2.dayPeriod(dayPeriodEnumValue, {
136181
+ width: "wide",
136182
+ context: "formatting"
136183
+ });
136184
+ }
136185
+ },
136186
+ h: function(date, token, localize2) {
136187
+ if (token === "ho") {
136188
+ var hours = date.getUTCHours() % 12;
136189
+ if (hours === 0)
136190
+ hours = 12;
136191
+ return localize2.ordinalNumber(hours, {
136192
+ unit: "hour"
136193
+ });
136194
+ }
136195
+ return lightFormatters_default.h(date, token);
136196
+ },
136197
+ H: function(date, token, localize2) {
136198
+ if (token === "Ho") {
136199
+ return localize2.ordinalNumber(date.getUTCHours(), {
136200
+ unit: "hour"
136201
+ });
136202
+ }
136203
+ return lightFormatters_default.H(date, token);
136204
+ },
136205
+ K: function(date, token, localize2) {
136206
+ var hours = date.getUTCHours() % 12;
136207
+ if (token === "Ko") {
136208
+ return localize2.ordinalNumber(hours, {
136209
+ unit: "hour"
136210
+ });
136211
+ }
136212
+ return addLeadingZeros(hours, token.length);
136213
+ },
136214
+ k: function(date, token, localize2) {
136215
+ var hours = date.getUTCHours();
136216
+ if (hours === 0)
136217
+ hours = 24;
136218
+ if (token === "ko") {
136219
+ return localize2.ordinalNumber(hours, {
136220
+ unit: "hour"
136221
+ });
136222
+ }
136223
+ return addLeadingZeros(hours, token.length);
136224
+ },
136225
+ m: function(date, token, localize2) {
136226
+ if (token === "mo") {
136227
+ return localize2.ordinalNumber(date.getUTCMinutes(), {
136228
+ unit: "minute"
136229
+ });
136230
+ }
136231
+ return lightFormatters_default.m(date, token);
136232
+ },
136233
+ s: function(date, token, localize2) {
136234
+ if (token === "so") {
136235
+ return localize2.ordinalNumber(date.getUTCSeconds(), {
136236
+ unit: "second"
136237
+ });
136238
+ }
136239
+ return lightFormatters_default.s(date, token);
136240
+ },
136241
+ S: function(date, token) {
136242
+ return lightFormatters_default.S(date, token);
136243
+ },
136244
+ X: function(date, token, _localize, options) {
136245
+ var originalDate = options._originalDate || date;
136246
+ var timezoneOffset = originalDate.getTimezoneOffset();
136247
+ if (timezoneOffset === 0) {
136248
+ return "Z";
136249
+ }
136250
+ switch (token) {
136251
+ case "X":
136252
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
136253
+ case "XXXX":
136254
+ case "XX":
136255
+ return formatTimezone(timezoneOffset);
136256
+ case "XXXXX":
136257
+ case "XXX":
136258
+ default:
136259
+ return formatTimezone(timezoneOffset, ":");
136260
+ }
136261
+ },
136262
+ x: function(date, token, _localize, options) {
136263
+ var originalDate = options._originalDate || date;
136264
+ var timezoneOffset = originalDate.getTimezoneOffset();
136265
+ switch (token) {
136266
+ case "x":
136267
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
136268
+ case "xxxx":
136269
+ case "xx":
136270
+ return formatTimezone(timezoneOffset);
136271
+ case "xxxxx":
136272
+ case "xxx":
136273
+ default:
136274
+ return formatTimezone(timezoneOffset, ":");
136832
136275
  }
136833
136276
  },
136834
- h: function(date, token, localize2) {
136835
- if (token === "ho") {
136836
- var hours = date.getUTCHours() % 12;
136837
- if (hours === 0)
136838
- hours = 12;
136839
- return localize2.ordinalNumber(hours, {
136840
- unit: "hour"
136841
- });
136277
+ O: function(date, token, _localize, options) {
136278
+ var originalDate = options._originalDate || date;
136279
+ var timezoneOffset = originalDate.getTimezoneOffset();
136280
+ switch (token) {
136281
+ case "O":
136282
+ case "OO":
136283
+ case "OOO":
136284
+ return "GMT" + formatTimezoneShort(timezoneOffset, ":");
136285
+ case "OOOO":
136286
+ default:
136287
+ return "GMT" + formatTimezone(timezoneOffset, ":");
136842
136288
  }
136843
- return lightFormatters_default.h(date, token);
136844
136289
  },
136845
- H: function(date, token, localize2) {
136846
- if (token === "Ho") {
136847
- return localize2.ordinalNumber(date.getUTCHours(), {
136848
- unit: "hour"
136849
- });
136290
+ z: function(date, token, _localize, options) {
136291
+ var originalDate = options._originalDate || date;
136292
+ var timezoneOffset = originalDate.getTimezoneOffset();
136293
+ switch (token) {
136294
+ case "z":
136295
+ case "zz":
136296
+ case "zzz":
136297
+ return "GMT" + formatTimezoneShort(timezoneOffset, ":");
136298
+ case "zzzz":
136299
+ default:
136300
+ return "GMT" + formatTimezone(timezoneOffset, ":");
136850
136301
  }
136851
- return lightFormatters_default.H(date, token);
136852
136302
  },
136853
- K: function(date, token, localize2) {
136854
- var hours = date.getUTCHours() % 12;
136855
- if (token === "Ko") {
136856
- return localize2.ordinalNumber(hours, {
136857
- unit: "hour"
136303
+ t: function(date, token, _localize, options) {
136304
+ var originalDate = options._originalDate || date;
136305
+ var timestamp = Math.floor(originalDate.getTime() / 1e3);
136306
+ return addLeadingZeros(timestamp, token.length);
136307
+ },
136308
+ T: function(date, token, _localize, options) {
136309
+ var originalDate = options._originalDate || date;
136310
+ var timestamp = originalDate.getTime();
136311
+ return addLeadingZeros(timestamp, token.length);
136312
+ }
136313
+ };
136314
+ function formatTimezoneShort(offset, dirtyDelimiter) {
136315
+ var sign5 = offset > 0 ? "-" : "+";
136316
+ var absOffset = Math.abs(offset);
136317
+ var hours = Math.floor(absOffset / 60);
136318
+ var minutes = absOffset % 60;
136319
+ if (minutes === 0) {
136320
+ return sign5 + String(hours);
136321
+ }
136322
+ var delimiter = dirtyDelimiter || "";
136323
+ return sign5 + String(hours) + delimiter + addLeadingZeros(minutes, 2);
136324
+ }
136325
+ __name(formatTimezoneShort, "formatTimezoneShort");
136326
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
136327
+ if (offset % 60 === 0) {
136328
+ var sign5 = offset > 0 ? "-" : "+";
136329
+ return sign5 + addLeadingZeros(Math.abs(offset) / 60, 2);
136330
+ }
136331
+ return formatTimezone(offset, dirtyDelimiter);
136332
+ }
136333
+ __name(formatTimezoneWithOptionalMinutes, "formatTimezoneWithOptionalMinutes");
136334
+ function formatTimezone(offset, dirtyDelimiter) {
136335
+ var delimiter = dirtyDelimiter || "";
136336
+ var sign5 = offset > 0 ? "-" : "+";
136337
+ var absOffset = Math.abs(offset);
136338
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
136339
+ var minutes = addLeadingZeros(absOffset % 60, 2);
136340
+ return sign5 + hours + delimiter + minutes;
136341
+ }
136342
+ __name(formatTimezone, "formatTimezone");
136343
+ var formatters_default = formatters2;
136344
+ function dateLongFormatter(pattern, formatLong2) {
136345
+ switch (pattern) {
136346
+ case "P":
136347
+ return formatLong2.date({
136348
+ width: "short"
136349
+ });
136350
+ case "PP":
136351
+ return formatLong2.date({
136352
+ width: "medium"
136353
+ });
136354
+ case "PPP":
136355
+ return formatLong2.date({
136356
+ width: "long"
136357
+ });
136358
+ case "PPPP":
136359
+ default:
136360
+ return formatLong2.date({
136361
+ width: "full"
136362
+ });
136363
+ }
136364
+ }
136365
+ __name(dateLongFormatter, "dateLongFormatter");
136366
+ function timeLongFormatter(pattern, formatLong2) {
136367
+ switch (pattern) {
136368
+ case "p":
136369
+ return formatLong2.time({
136370
+ width: "short"
136371
+ });
136372
+ case "pp":
136373
+ return formatLong2.time({
136374
+ width: "medium"
136375
+ });
136376
+ case "ppp":
136377
+ return formatLong2.time({
136378
+ width: "long"
136379
+ });
136380
+ case "pppp":
136381
+ default:
136382
+ return formatLong2.time({
136383
+ width: "full"
136384
+ });
136385
+ }
136386
+ }
136387
+ __name(timeLongFormatter, "timeLongFormatter");
136388
+ function dateTimeLongFormatter(pattern, formatLong2) {
136389
+ var matchResult = pattern.match(/(P+)(p+)?/) || [];
136390
+ var datePattern = matchResult[1];
136391
+ var timePattern = matchResult[2];
136392
+ if (!timePattern) {
136393
+ return dateLongFormatter(pattern, formatLong2);
136394
+ }
136395
+ var dateTimeFormat;
136396
+ switch (datePattern) {
136397
+ case "P":
136398
+ dateTimeFormat = formatLong2.dateTime({
136399
+ width: "short"
136400
+ });
136401
+ break;
136402
+ case "PP":
136403
+ dateTimeFormat = formatLong2.dateTime({
136404
+ width: "medium"
136405
+ });
136406
+ break;
136407
+ case "PPP":
136408
+ dateTimeFormat = formatLong2.dateTime({
136409
+ width: "long"
136410
+ });
136411
+ break;
136412
+ case "PPPP":
136413
+ default:
136414
+ dateTimeFormat = formatLong2.dateTime({
136415
+ width: "full"
136858
136416
  });
136417
+ break;
136418
+ }
136419
+ return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
136420
+ }
136421
+ __name(dateTimeLongFormatter, "dateTimeLongFormatter");
136422
+ var longFormatters = {
136423
+ p: timeLongFormatter,
136424
+ P: dateTimeLongFormatter
136425
+ };
136426
+ var longFormatters_default = longFormatters;
136427
+ var protectedDayOfYearTokens = ["D", "DD"];
136428
+ var protectedWeekYearTokens = ["YY", "YYYY"];
136429
+ function isProtectedDayOfYearToken(token) {
136430
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
136431
+ }
136432
+ __name(isProtectedDayOfYearToken, "isProtectedDayOfYearToken");
136433
+ function isProtectedWeekYearToken(token) {
136434
+ return protectedWeekYearTokens.indexOf(token) !== -1;
136435
+ }
136436
+ __name(isProtectedWeekYearToken, "isProtectedWeekYearToken");
136437
+ function throwProtectedError(token, format2, input) {
136438
+ if (token === "YYYY") {
136439
+ throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
136440
+ } else if (token === "YY") {
136441
+ throw new RangeError("Use `yy` instead of `YY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
136442
+ } else if (token === "D") {
136443
+ throw new RangeError("Use `d` instead of `D` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
136444
+ } else if (token === "DD") {
136445
+ throw new RangeError("Use `dd` instead of `DD` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
136446
+ }
136447
+ }
136448
+ __name(throwProtectedError, "throwProtectedError");
136449
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
136450
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
136451
+ var escapedStringRegExp = /^'([^]*?)'?$/;
136452
+ var doubleQuoteRegExp = /''/g;
136453
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
136454
+ function format(dirtyDate, dirtyFormatStr, dirtyOptions) {
136455
+ requiredArgs(2, arguments);
136456
+ var formatStr = String(dirtyFormatStr);
136457
+ var options = dirtyOptions || {};
136458
+ var locale2 = options.locale || en_US_default;
136459
+ var localeFirstWeekContainsDate = locale2.options && locale2.options.firstWeekContainsDate;
136460
+ var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
136461
+ var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
136462
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
136463
+ throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");
136464
+ }
136465
+ var localeWeekStartsOn = locale2.options && locale2.options.weekStartsOn;
136466
+ var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
136467
+ var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn);
136468
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
136469
+ throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");
136470
+ }
136471
+ if (!locale2.localize) {
136472
+ throw new RangeError("locale must contain localize property");
136473
+ }
136474
+ if (!locale2.formatLong) {
136475
+ throw new RangeError("locale must contain formatLong property");
136476
+ }
136477
+ var originalDate = toDate(dirtyDate);
136478
+ if (!isValid2(originalDate)) {
136479
+ throw new RangeError("Invalid time value");
136480
+ }
136481
+ var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
136482
+ var utcDate = subMilliseconds(originalDate, timezoneOffset);
136483
+ var formatterOptions = {
136484
+ firstWeekContainsDate,
136485
+ weekStartsOn,
136486
+ locale: locale2,
136487
+ _originalDate: originalDate
136488
+ };
136489
+ var result = formatStr.match(longFormattingTokensRegExp).map(function(substring) {
136490
+ var firstCharacter = substring[0];
136491
+ if (firstCharacter === "p" || firstCharacter === "P") {
136492
+ var longFormatter = longFormatters_default[firstCharacter];
136493
+ return longFormatter(substring, locale2.formatLong, formatterOptions);
136494
+ }
136495
+ return substring;
136496
+ }).join("").match(formattingTokensRegExp).map(function(substring) {
136497
+ if (substring === "''") {
136498
+ return "'";
136499
+ }
136500
+ var firstCharacter = substring[0];
136501
+ if (firstCharacter === "'") {
136502
+ return cleanEscapedString(substring);
136503
+ }
136504
+ var formatter = formatters_default[firstCharacter];
136505
+ if (formatter) {
136506
+ if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
136507
+ throwProtectedError(substring, dirtyFormatStr, dirtyDate);
136508
+ }
136509
+ if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
136510
+ throwProtectedError(substring, dirtyFormatStr, dirtyDate);
136511
+ }
136512
+ return formatter(utcDate, substring, locale2.localize, formatterOptions);
136859
136513
  }
136860
- return addLeadingZeros(hours, token.length);
136861
- },
136862
- k: function(date, token, localize2) {
136863
- var hours = date.getUTCHours();
136864
- if (hours === 0)
136865
- hours = 24;
136866
- if (token === "ko") {
136867
- return localize2.ordinalNumber(hours, {
136868
- unit: "hour"
136869
- });
136514
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
136515
+ throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
136870
136516
  }
136871
- return addLeadingZeros(hours, token.length);
136872
- },
136873
- m: function(date, token, localize2) {
136874
- if (token === "mo") {
136875
- return localize2.ordinalNumber(date.getUTCMinutes(), {
136876
- unit: "minute"
136517
+ return substring;
136518
+ }).join("");
136519
+ return result;
136520
+ }
136521
+ __name(format, "format");
136522
+ function cleanEscapedString(input) {
136523
+ return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
136524
+ }
136525
+ __name(cleanEscapedString, "cleanEscapedString");
136526
+ var transformErrorCheck = /* @__PURE__ */ __name((error, _credential) => {
136527
+ const prefix = error.split(" error")[0];
136528
+ return prefix || error;
136529
+ }, "transformErrorCheck");
136530
+ var transformErrorMessage = /* @__PURE__ */ __name((error, credential) => {
136531
+ if (error.startsWith("expiration")) {
136532
+ return credential.expirationDate ? `Invalid \u2022 Expired ${format(new Date(credential.expirationDate), "dd MMM yyyy").toUpperCase()}` : "Invalid \u2022 Expired";
136533
+ }
136534
+ return error;
136535
+ }, "transformErrorMessage");
136536
+ var transformCheckMessage = /* @__PURE__ */ __name((check, credential) => {
136537
+ return {
136538
+ proof: "Valid",
136539
+ expiration: credential.expirationDate ? `Valid \u2022 Expires ${format(new Date(credential.expirationDate), "dd MMM yyyy").toUpperCase()}` : "Valid \u2022 Does Not Expire"
136540
+ }[check] || check;
136541
+ }, "transformCheckMessage");
136542
+ var verifyCredential2 = /* @__PURE__ */ __name((wallet) => {
136543
+ return (credential) => __async$1(void 0, null, function* () {
136544
+ const rawVerificationCheck = yield wallet.pluginMethods.verifyCredential(credential);
136545
+ const verificationItems = [];
136546
+ rawVerificationCheck.errors.forEach((error) => {
136547
+ verificationItems.push({
136548
+ status: VerificationStatusEnum.Failed,
136549
+ check: transformErrorCheck(error, credential),
136550
+ details: transformErrorMessage(error, credential)
136877
136551
  });
136878
- }
136879
- return lightFormatters_default.m(date, token);
136880
- },
136881
- s: function(date, token, localize2) {
136882
- if (token === "so") {
136883
- return localize2.ordinalNumber(date.getUTCSeconds(), {
136884
- unit: "second"
136552
+ });
136553
+ rawVerificationCheck.warnings.forEach((warning) => {
136554
+ verificationItems.push({
136555
+ status: VerificationStatusEnum.Error,
136556
+ check: "hmm",
136557
+ message: warning
136885
136558
  });
136886
- }
136887
- return lightFormatters_default.s(date, token);
136888
- },
136889
- S: function(date, token) {
136890
- return lightFormatters_default.S(date, token);
136559
+ });
136560
+ rawVerificationCheck.checks.forEach((check) => {
136561
+ verificationItems.push({
136562
+ status: VerificationStatusEnum.Success,
136563
+ check,
136564
+ message: transformCheckMessage(check, credential)
136565
+ });
136566
+ });
136567
+ return verificationItems;
136568
+ });
136569
+ }, "verifyCredential");
136570
+ var defaultCeramicIDXArgs = {
136571
+ modelData: {
136572
+ definitions: {
136573
+ MyVerifiableCredentials: "kjzl6cwe1jw14am5tu5hh412s19o4zm8aq3g2lpd6s4paxj2nly2lj4drp3pun2"
136574
+ },
136575
+ schemas: {
136576
+ AchievementVerifiableCredential: "ceramic://k3y52l7qbv1frylibw2725v8gem3hxs1onoh6pvux0szdduugczh0hddxo6qsd6o0",
136577
+ VerifiableCredentialsList: "ceramic://k3y52l7qbv1frxkcwfpyauky3fyl4n44izridy3blvjjzgftis40sk9w8g3remghs"
136578
+ },
136579
+ tiles: {}
136891
136580
  },
136892
- X: function(date, token, _localize, options) {
136893
- var originalDate = options._originalDate || date;
136894
- var timezoneOffset = originalDate.getTimezoneOffset();
136895
- if (timezoneOffset === 0) {
136896
- return "Z";
136581
+ credentialAlias: "MyVerifiableCredentials",
136582
+ ceramicEndpoint: "https://ceramic-node.welibrary.io:7007",
136583
+ defaultContentFamily: "SuperSkills"
136584
+ };
136585
+ var wasm;
136586
+ var cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
136587
+ cachedTextDecoder.decode();
136588
+ var cachegetUint8Memory0 = null;
136589
+ function getUint8Memory0() {
136590
+ if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
136591
+ cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
136592
+ }
136593
+ return cachegetUint8Memory0;
136594
+ }
136595
+ __name(getUint8Memory0, "getUint8Memory0");
136596
+ function getStringFromWasm0(ptr, len) {
136597
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
136598
+ }
136599
+ __name(getStringFromWasm0, "getStringFromWasm0");
136600
+ var heap = new Array(32).fill(void 0);
136601
+ heap.push(void 0, null, true, false);
136602
+ var heap_next = heap.length;
136603
+ function addHeapObject(obj) {
136604
+ if (heap_next === heap.length)
136605
+ heap.push(heap.length + 1);
136606
+ const idx = heap_next;
136607
+ heap_next = heap[idx];
136608
+ heap[idx] = obj;
136609
+ return idx;
136610
+ }
136611
+ __name(addHeapObject, "addHeapObject");
136612
+ function getObject(idx) {
136613
+ return heap[idx];
136614
+ }
136615
+ __name(getObject, "getObject");
136616
+ function dropObject(idx) {
136617
+ if (idx < 36)
136618
+ return;
136619
+ heap[idx] = heap_next;
136620
+ heap_next = idx;
136621
+ }
136622
+ __name(dropObject, "dropObject");
136623
+ function takeObject(idx) {
136624
+ const ret = getObject(idx);
136625
+ dropObject(idx);
136626
+ return ret;
136627
+ }
136628
+ __name(takeObject, "takeObject");
136629
+ var WASM_VECTOR_LEN = 0;
136630
+ var cachedTextEncoder = new TextEncoder("utf-8");
136631
+ var encodeString2 = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
136632
+ return cachedTextEncoder.encodeInto(arg, view);
136633
+ } : function(arg, view) {
136634
+ const buf2 = cachedTextEncoder.encode(arg);
136635
+ view.set(buf2);
136636
+ return {
136637
+ read: arg.length,
136638
+ written: buf2.length
136639
+ };
136640
+ };
136641
+ function passStringToWasm0(arg, malloc, realloc) {
136642
+ if (realloc === void 0) {
136643
+ const buf2 = cachedTextEncoder.encode(arg);
136644
+ const ptr2 = malloc(buf2.length);
136645
+ getUint8Memory0().subarray(ptr2, ptr2 + buf2.length).set(buf2);
136646
+ WASM_VECTOR_LEN = buf2.length;
136647
+ return ptr2;
136648
+ }
136649
+ let len = arg.length;
136650
+ let ptr = malloc(len);
136651
+ const mem = getUint8Memory0();
136652
+ let offset = 0;
136653
+ for (; offset < len; offset++) {
136654
+ const code5 = arg.charCodeAt(offset);
136655
+ if (code5 > 127)
136656
+ break;
136657
+ mem[ptr + offset] = code5;
136658
+ }
136659
+ if (offset !== len) {
136660
+ if (offset !== 0) {
136661
+ arg = arg.slice(offset);
136897
136662
  }
136898
- switch (token) {
136899
- case "X":
136900
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
136901
- case "XXXX":
136902
- case "XX":
136903
- return formatTimezone(timezoneOffset);
136904
- case "XXXXX":
136905
- case "XXX":
136906
- default:
136907
- return formatTimezone(timezoneOffset, ":");
136663
+ ptr = realloc(ptr, len, len = offset + arg.length * 3);
136664
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
136665
+ const ret = encodeString2(arg, view);
136666
+ offset += ret.written;
136667
+ }
136668
+ WASM_VECTOR_LEN = offset;
136669
+ return ptr;
136670
+ }
136671
+ __name(passStringToWasm0, "passStringToWasm0");
136672
+ function isLikeNone(x) {
136673
+ return x === void 0 || x === null;
136674
+ }
136675
+ __name(isLikeNone, "isLikeNone");
136676
+ var cachegetInt32Memory0 = null;
136677
+ function getInt32Memory0() {
136678
+ if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
136679
+ cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
136680
+ }
136681
+ return cachegetInt32Memory0;
136682
+ }
136683
+ __name(getInt32Memory0, "getInt32Memory0");
136684
+ function debugString(val) {
136685
+ const type = typeof val;
136686
+ if (type == "number" || type == "boolean" || val == null) {
136687
+ return `${val}`;
136688
+ }
136689
+ if (type == "string") {
136690
+ return `"${val}"`;
136691
+ }
136692
+ if (type == "symbol") {
136693
+ const description = val.description;
136694
+ if (description == null) {
136695
+ return "Symbol";
136696
+ } else {
136697
+ return `Symbol(${description})`;
136908
136698
  }
136909
- },
136910
- x: function(date, token, _localize, options) {
136911
- var originalDate = options._originalDate || date;
136912
- var timezoneOffset = originalDate.getTimezoneOffset();
136913
- switch (token) {
136914
- case "x":
136915
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
136916
- case "xxxx":
136917
- case "xx":
136918
- return formatTimezone(timezoneOffset);
136919
- case "xxxxx":
136920
- case "xxx":
136921
- default:
136922
- return formatTimezone(timezoneOffset, ":");
136699
+ }
136700
+ if (type == "function") {
136701
+ const name5 = val.name;
136702
+ if (typeof name5 == "string" && name5.length > 0) {
136703
+ return `Function(${name5})`;
136704
+ } else {
136705
+ return "Function";
136923
136706
  }
136924
- },
136925
- O: function(date, token, _localize, options) {
136926
- var originalDate = options._originalDate || date;
136927
- var timezoneOffset = originalDate.getTimezoneOffset();
136928
- switch (token) {
136929
- case "O":
136930
- case "OO":
136931
- case "OOO":
136932
- return "GMT" + formatTimezoneShort(timezoneOffset, ":");
136933
- case "OOOO":
136934
- default:
136935
- return "GMT" + formatTimezone(timezoneOffset, ":");
136707
+ }
136708
+ if (Array.isArray(val)) {
136709
+ const length2 = val.length;
136710
+ let debug = "[";
136711
+ if (length2 > 0) {
136712
+ debug += debugString(val[0]);
136936
136713
  }
136937
- },
136938
- z: function(date, token, _localize, options) {
136939
- var originalDate = options._originalDate || date;
136940
- var timezoneOffset = originalDate.getTimezoneOffset();
136941
- switch (token) {
136942
- case "z":
136943
- case "zz":
136944
- case "zzz":
136945
- return "GMT" + formatTimezoneShort(timezoneOffset, ":");
136946
- case "zzzz":
136947
- default:
136948
- return "GMT" + formatTimezone(timezoneOffset, ":");
136714
+ for (let i = 1; i < length2; i++) {
136715
+ debug += ", " + debugString(val[i]);
136949
136716
  }
136950
- },
136951
- t: function(date, token, _localize, options) {
136952
- var originalDate = options._originalDate || date;
136953
- var timestamp = Math.floor(originalDate.getTime() / 1e3);
136954
- return addLeadingZeros(timestamp, token.length);
136955
- },
136956
- T: function(date, token, _localize, options) {
136957
- var originalDate = options._originalDate || date;
136958
- var timestamp = originalDate.getTime();
136959
- return addLeadingZeros(timestamp, token.length);
136717
+ debug += "]";
136718
+ return debug;
136960
136719
  }
136961
- };
136962
- function formatTimezoneShort(offset, dirtyDelimiter) {
136963
- var sign5 = offset > 0 ? "-" : "+";
136964
- var absOffset = Math.abs(offset);
136965
- var hours = Math.floor(absOffset / 60);
136966
- var minutes = absOffset % 60;
136967
- if (minutes === 0) {
136968
- return sign5 + String(hours);
136720
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
136721
+ let className;
136722
+ if (builtInMatches.length > 1) {
136723
+ className = builtInMatches[1];
136724
+ } else {
136725
+ return toString.call(val);
136969
136726
  }
136970
- var delimiter = dirtyDelimiter || "";
136971
- return sign5 + String(hours) + delimiter + addLeadingZeros(minutes, 2);
136972
- }
136973
- __name(formatTimezoneShort, "formatTimezoneShort");
136974
- function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
136975
- if (offset % 60 === 0) {
136976
- var sign5 = offset > 0 ? "-" : "+";
136977
- return sign5 + addLeadingZeros(Math.abs(offset) / 60, 2);
136727
+ if (className == "Object") {
136728
+ try {
136729
+ return "Object(" + JSON.stringify(val) + ")";
136730
+ } catch (_) {
136731
+ return "Object";
136732
+ }
136978
136733
  }
136979
- return formatTimezone(offset, dirtyDelimiter);
136734
+ if (val instanceof Error) {
136735
+ return `${val.name}: ${val.message}
136736
+ ${val.stack}`;
136737
+ }
136738
+ return className;
136980
136739
  }
136981
- __name(formatTimezoneWithOptionalMinutes, "formatTimezoneWithOptionalMinutes");
136982
- function formatTimezone(offset, dirtyDelimiter) {
136983
- var delimiter = dirtyDelimiter || "";
136984
- var sign5 = offset > 0 ? "-" : "+";
136985
- var absOffset = Math.abs(offset);
136986
- var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
136987
- var minutes = addLeadingZeros(absOffset % 60, 2);
136988
- return sign5 + hours + delimiter + minutes;
136740
+ __name(debugString, "debugString");
136741
+ function makeMutClosure(arg0, arg1, dtor, f) {
136742
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
136743
+ const real = /* @__PURE__ */ __name((...args) => {
136744
+ state.cnt++;
136745
+ const a = state.a;
136746
+ state.a = 0;
136747
+ try {
136748
+ return f(a, state.b, ...args);
136749
+ } finally {
136750
+ if (--state.cnt === 0) {
136751
+ wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
136752
+ } else {
136753
+ state.a = a;
136754
+ }
136755
+ }
136756
+ }, "real");
136757
+ real.original = state;
136758
+ return real;
136989
136759
  }
136990
- __name(formatTimezone, "formatTimezone");
136991
- var formatters_default = formatters2;
136992
- function dateLongFormatter(pattern, formatLong2) {
136993
- switch (pattern) {
136994
- case "P":
136995
- return formatLong2.date({
136996
- width: "short"
136997
- });
136998
- case "PP":
136999
- return formatLong2.date({
137000
- width: "medium"
137001
- });
137002
- case "PPP":
137003
- return formatLong2.date({
137004
- width: "long"
137005
- });
137006
- case "PPPP":
137007
- default:
137008
- return formatLong2.date({
137009
- width: "full"
137010
- });
137011
- }
136760
+ __name(makeMutClosure, "makeMutClosure");
136761
+ function __wbg_adapter_24(arg0, arg1, arg2) {
136762
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h91a8814f66f14b17(arg0, arg1, addHeapObject(arg2));
137012
136763
  }
137013
- __name(dateLongFormatter, "dateLongFormatter");
137014
- function timeLongFormatter(pattern, formatLong2) {
137015
- switch (pattern) {
137016
- case "p":
137017
- return formatLong2.time({
137018
- width: "short"
137019
- });
137020
- case "pp":
137021
- return formatLong2.time({
137022
- width: "medium"
137023
- });
137024
- case "ppp":
137025
- return formatLong2.time({
137026
- width: "long"
137027
- });
137028
- case "pppp":
137029
- default:
137030
- return formatLong2.time({
137031
- width: "full"
137032
- });
137033
- }
136764
+ __name(__wbg_adapter_24, "__wbg_adapter_24");
136765
+ function passArray8ToWasm0(arg, malloc) {
136766
+ const ptr = malloc(arg.length * 1);
136767
+ getUint8Memory0().set(arg, ptr / 1);
136768
+ WASM_VECTOR_LEN = arg.length;
136769
+ return ptr;
137034
136770
  }
137035
- __name(timeLongFormatter, "timeLongFormatter");
137036
- function dateTimeLongFormatter(pattern, formatLong2) {
137037
- var matchResult = pattern.match(/(P+)(p+)?/) || [];
137038
- var datePattern = matchResult[1];
137039
- var timePattern = matchResult[2];
137040
- if (!timePattern) {
137041
- return dateLongFormatter(pattern, formatLong2);
136771
+ __name(passArray8ToWasm0, "passArray8ToWasm0");
136772
+ function generateEd25519KeyFromBytes(bytes) {
136773
+ try {
136774
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
136775
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
136776
+ const len0 = WASM_VECTOR_LEN;
136777
+ wasm.generateEd25519KeyFromBytes(retptr, ptr0, len0);
136778
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
136779
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
136780
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
136781
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
136782
+ var ptr1 = r0;
136783
+ var len1 = r1;
136784
+ if (r3) {
136785
+ ptr1 = 0;
136786
+ len1 = 0;
136787
+ throw takeObject(r2);
136788
+ }
136789
+ return getStringFromWasm0(ptr1, len1);
136790
+ } finally {
136791
+ wasm.__wbindgen_add_to_stack_pointer(16);
136792
+ wasm.__wbindgen_free(ptr1, len1);
137042
136793
  }
137043
- var dateTimeFormat;
137044
- switch (datePattern) {
137045
- case "P":
137046
- dateTimeFormat = formatLong2.dateTime({
137047
- width: "short"
137048
- });
137049
- break;
137050
- case "PP":
137051
- dateTimeFormat = formatLong2.dateTime({
137052
- width: "medium"
137053
- });
137054
- break;
137055
- case "PPP":
137056
- dateTimeFormat = formatLong2.dateTime({
137057
- width: "long"
137058
- });
137059
- break;
137060
- case "PPPP":
137061
- default:
137062
- dateTimeFormat = formatLong2.dateTime({
137063
- width: "full"
137064
- });
137065
- break;
136794
+ }
136795
+ __name(generateEd25519KeyFromBytes, "generateEd25519KeyFromBytes");
136796
+ function keyToDID(method_pattern, jwk) {
136797
+ try {
136798
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
136799
+ const ptr0 = passStringToWasm0(method_pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136800
+ const len0 = WASM_VECTOR_LEN;
136801
+ const ptr1 = passStringToWasm0(jwk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136802
+ const len1 = WASM_VECTOR_LEN;
136803
+ wasm.keyToDID(retptr, ptr0, len0, ptr1, len1);
136804
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
136805
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
136806
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
136807
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
136808
+ var ptr2 = r0;
136809
+ var len2 = r1;
136810
+ if (r3) {
136811
+ ptr2 = 0;
136812
+ len2 = 0;
136813
+ throw takeObject(r2);
136814
+ }
136815
+ return getStringFromWasm0(ptr2, len2);
136816
+ } finally {
136817
+ wasm.__wbindgen_add_to_stack_pointer(16);
136818
+ wasm.__wbindgen_free(ptr2, len2);
137066
136819
  }
137067
- return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
137068
136820
  }
137069
- __name(dateTimeLongFormatter, "dateTimeLongFormatter");
137070
- var longFormatters = {
137071
- p: timeLongFormatter,
137072
- P: dateTimeLongFormatter
137073
- };
137074
- var longFormatters_default = longFormatters;
137075
- var protectedDayOfYearTokens = ["D", "DD"];
137076
- var protectedWeekYearTokens = ["YY", "YYYY"];
137077
- function isProtectedDayOfYearToken(token) {
137078
- return protectedDayOfYearTokens.indexOf(token) !== -1;
136821
+ __name(keyToDID, "keyToDID");
136822
+ function keyToVerificationMethod(method_pattern, jwk) {
136823
+ const ptr0 = passStringToWasm0(method_pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136824
+ const len0 = WASM_VECTOR_LEN;
136825
+ const ptr1 = passStringToWasm0(jwk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136826
+ const len1 = WASM_VECTOR_LEN;
136827
+ const ret = wasm.keyToVerificationMethod(ptr0, len0, ptr1, len1);
136828
+ return takeObject(ret);
136829
+ }
136830
+ __name(keyToVerificationMethod, "keyToVerificationMethod");
136831
+ function issueCredential2(credential, proof_options, key2) {
136832
+ const ptr0 = passStringToWasm0(credential, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136833
+ const len0 = WASM_VECTOR_LEN;
136834
+ const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136835
+ const len1 = WASM_VECTOR_LEN;
136836
+ const ptr2 = passStringToWasm0(key2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136837
+ const len2 = WASM_VECTOR_LEN;
136838
+ const ret = wasm.issueCredential(ptr0, len0, ptr1, len1, ptr2, len2);
136839
+ return takeObject(ret);
136840
+ }
136841
+ __name(issueCredential2, "issueCredential");
136842
+ function verifyCredential3(vc, proof_options) {
136843
+ const ptr0 = passStringToWasm0(vc, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136844
+ const len0 = WASM_VECTOR_LEN;
136845
+ const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136846
+ const len1 = WASM_VECTOR_LEN;
136847
+ const ret = wasm.verifyCredential(ptr0, len0, ptr1, len1);
136848
+ return takeObject(ret);
137079
136849
  }
137080
- __name(isProtectedDayOfYearToken, "isProtectedDayOfYearToken");
137081
- function isProtectedWeekYearToken(token) {
137082
- return protectedWeekYearTokens.indexOf(token) !== -1;
136850
+ __name(verifyCredential3, "verifyCredential");
136851
+ function issuePresentation2(presentation, proof_options, key2) {
136852
+ const ptr0 = passStringToWasm0(presentation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136853
+ const len0 = WASM_VECTOR_LEN;
136854
+ const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136855
+ const len1 = WASM_VECTOR_LEN;
136856
+ const ptr2 = passStringToWasm0(key2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136857
+ const len2 = WASM_VECTOR_LEN;
136858
+ const ret = wasm.issuePresentation(ptr0, len0, ptr1, len1, ptr2, len2);
136859
+ return takeObject(ret);
137083
136860
  }
137084
- __name(isProtectedWeekYearToken, "isProtectedWeekYearToken");
137085
- function throwProtectedError(token, format2, input) {
137086
- if (token === "YYYY") {
137087
- throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
137088
- } else if (token === "YY") {
137089
- throw new RangeError("Use `yy` instead of `YY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
137090
- } else if (token === "D") {
137091
- throw new RangeError("Use `d` instead of `D` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
137092
- } else if (token === "DD") {
137093
- throw new RangeError("Use `dd` instead of `DD` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
137094
- }
136861
+ __name(issuePresentation2, "issuePresentation");
136862
+ function verifyPresentation2(vp, proof_options) {
136863
+ const ptr0 = passStringToWasm0(vp, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136864
+ const len0 = WASM_VECTOR_LEN;
136865
+ const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136866
+ const len1 = WASM_VECTOR_LEN;
136867
+ const ret = wasm.verifyPresentation(ptr0, len0, ptr1, len1);
136868
+ return takeObject(ret);
137095
136869
  }
137096
- __name(throwProtectedError, "throwProtectedError");
137097
- var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
137098
- var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
137099
- var escapedStringRegExp = /^'([^]*?)'?$/;
137100
- var doubleQuoteRegExp = /''/g;
137101
- var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
137102
- function format(dirtyDate, dirtyFormatStr, dirtyOptions) {
137103
- requiredArgs(2, arguments);
137104
- var formatStr = String(dirtyFormatStr);
137105
- var options = dirtyOptions || {};
137106
- var locale2 = options.locale || en_US_default;
137107
- var localeFirstWeekContainsDate = locale2.options && locale2.options.firstWeekContainsDate;
137108
- var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
137109
- var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
137110
- if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
137111
- throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");
137112
- }
137113
- var localeWeekStartsOn = locale2.options && locale2.options.weekStartsOn;
137114
- var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
137115
- var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn);
137116
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
137117
- throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");
137118
- }
137119
- if (!locale2.localize) {
137120
- throw new RangeError("locale must contain localize property");
137121
- }
137122
- if (!locale2.formatLong) {
137123
- throw new RangeError("locale must contain formatLong property");
137124
- }
137125
- var originalDate = toDate(dirtyDate);
137126
- if (!isValid2(originalDate)) {
137127
- throw new RangeError("Invalid time value");
136870
+ __name(verifyPresentation2, "verifyPresentation");
136871
+ function handleError(f, args) {
136872
+ try {
136873
+ return f.apply(this, args);
136874
+ } catch (e) {
136875
+ wasm.__wbindgen_exn_store(addHeapObject(e));
137128
136876
  }
137129
- var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
137130
- var utcDate = subMilliseconds(originalDate, timezoneOffset);
137131
- var formatterOptions = {
137132
- firstWeekContainsDate,
137133
- weekStartsOn,
137134
- locale: locale2,
137135
- _originalDate: originalDate
137136
- };
137137
- var result = formatStr.match(longFormattingTokensRegExp).map(function(substring) {
137138
- var firstCharacter = substring[0];
137139
- if (firstCharacter === "p" || firstCharacter === "P") {
137140
- var longFormatter = longFormatters_default[firstCharacter];
137141
- return longFormatter(substring, locale2.formatLong, formatterOptions);
137142
- }
137143
- return substring;
137144
- }).join("").match(formattingTokensRegExp).map(function(substring) {
137145
- if (substring === "''") {
137146
- return "'";
137147
- }
137148
- var firstCharacter = substring[0];
137149
- if (firstCharacter === "'") {
137150
- return cleanEscapedString(substring);
136877
+ }
136878
+ __name(handleError, "handleError");
136879
+ function getArrayU8FromWasm0(ptr, len) {
136880
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
136881
+ }
136882
+ __name(getArrayU8FromWasm0, "getArrayU8FromWasm0");
136883
+ function __wbg_adapter_108(arg0, arg1, arg2, arg3) {
136884
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h3ecfeb7a01c1be81(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
136885
+ }
136886
+ __name(__wbg_adapter_108, "__wbg_adapter_108");
136887
+ function load(module, imports) {
136888
+ return __async$1(this, null, function* () {
136889
+ if (typeof Response === "function" && module instanceof Response) {
136890
+ if (typeof WebAssembly.instantiateStreaming === "function") {
136891
+ try {
136892
+ return yield WebAssembly.instantiateStreaming(module, imports);
136893
+ } catch (e) {
136894
+ if (module.headers.get("Content-Type") != "application/wasm") {
136895
+ 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", e);
136896
+ } else {
136897
+ throw e;
136898
+ }
136899
+ }
136900
+ }
136901
+ const bytes = yield module.arrayBuffer();
136902
+ return yield WebAssembly.instantiate(bytes, imports);
136903
+ } else {
136904
+ const instance = yield WebAssembly.instantiate(module, imports);
136905
+ if (instance instanceof WebAssembly.Instance) {
136906
+ return { instance, module };
136907
+ } else {
136908
+ return instance;
136909
+ }
137151
136910
  }
137152
- var formatter = formatters_default[firstCharacter];
137153
- if (formatter) {
137154
- if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
137155
- throwProtectedError(substring, dirtyFormatStr, dirtyDate);
136911
+ });
136912
+ }
136913
+ __name(load, "load");
136914
+ function init2(input) {
136915
+ return __async$1(this, null, function* () {
136916
+ const imports = {};
136917
+ imports.wbg = {};
136918
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
136919
+ const ret = getStringFromWasm0(arg0, arg1);
136920
+ return addHeapObject(ret);
136921
+ };
136922
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
136923
+ takeObject(arg0);
136924
+ };
136925
+ imports.wbg.__wbindgen_cb_drop = function(arg0) {
136926
+ const obj = takeObject(arg0).original;
136927
+ if (obj.cnt-- == 1) {
136928
+ obj.a = 0;
136929
+ return true;
137156
136930
  }
137157
- if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
137158
- throwProtectedError(substring, dirtyFormatStr, dirtyDate);
136931
+ const ret = false;
136932
+ return ret;
136933
+ };
136934
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
136935
+ const ret = getObject(arg0);
136936
+ return addHeapObject(ret);
136937
+ };
136938
+ imports.wbg.__wbg_fetch_811d43d6bdcad5b1 = function(arg0) {
136939
+ const ret = fetch(getObject(arg0));
136940
+ return addHeapObject(ret);
136941
+ };
136942
+ imports.wbg.__wbg_fetch_bf56e2a9f0644e3f = function(arg0, arg1) {
136943
+ const ret = getObject(arg0).fetch(getObject(arg1));
136944
+ return addHeapObject(ret);
136945
+ };
136946
+ imports.wbg.__wbg_new_89d7f088c1c45353 = function() {
136947
+ return handleError(function() {
136948
+ const ret = new Headers();
136949
+ return addHeapObject(ret);
136950
+ }, arguments);
136951
+ };
136952
+ imports.wbg.__wbg_append_f4f93bc73c45ee3e = function() {
136953
+ return handleError(function(arg0, arg1, arg2, arg3, arg4) {
136954
+ getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
136955
+ }, arguments);
136956
+ };
136957
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
136958
+ const obj = getObject(arg1);
136959
+ const ret = typeof obj === "string" ? obj : void 0;
136960
+ var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136961
+ var len0 = WASM_VECTOR_LEN;
136962
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
136963
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
136964
+ };
136965
+ imports.wbg.__wbg_instanceof_Response_ccfeb62399355bcd = function(arg0) {
136966
+ const ret = getObject(arg0) instanceof Response;
136967
+ return ret;
136968
+ };
136969
+ imports.wbg.__wbg_url_06c0f822d68d195c = function(arg0, arg1) {
136970
+ const ret = getObject(arg1).url;
136971
+ const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136972
+ const len0 = WASM_VECTOR_LEN;
136973
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
136974
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
136975
+ };
136976
+ imports.wbg.__wbg_status_600fd8b881393898 = function(arg0) {
136977
+ const ret = getObject(arg0).status;
136978
+ return ret;
136979
+ };
136980
+ imports.wbg.__wbg_headers_9e7f2c05a9b962ea = function(arg0) {
136981
+ const ret = getObject(arg0).headers;
136982
+ return addHeapObject(ret);
136983
+ };
136984
+ imports.wbg.__wbg_arrayBuffer_5a99283a3954c850 = function() {
136985
+ return handleError(function(arg0) {
136986
+ const ret = getObject(arg0).arrayBuffer();
136987
+ return addHeapObject(ret);
136988
+ }, arguments);
136989
+ };
136990
+ imports.wbg.__wbg_newwithstrandinit_fd99688f189f053e = function() {
136991
+ return handleError(function(arg0, arg1, arg2) {
136992
+ const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
136993
+ return addHeapObject(ret);
136994
+ }, arguments);
136995
+ };
136996
+ imports.wbg.__wbindgen_is_object = function(arg0) {
136997
+ const val = getObject(arg0);
136998
+ const ret = typeof val === "object" && val !== null;
136999
+ return ret;
137000
+ };
137001
+ imports.wbg.__wbg_self_86b4b13392c7af56 = function() {
137002
+ return handleError(function() {
137003
+ const ret = self.self;
137004
+ return addHeapObject(ret);
137005
+ }, arguments);
137006
+ };
137007
+ imports.wbg.__wbg_crypto_b8c92eaac23d0d80 = function(arg0) {
137008
+ const ret = getObject(arg0).crypto;
137009
+ return addHeapObject(ret);
137010
+ };
137011
+ imports.wbg.__wbg_msCrypto_9ad6677321a08dd8 = function(arg0) {
137012
+ const ret = getObject(arg0).msCrypto;
137013
+ return addHeapObject(ret);
137014
+ };
137015
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
137016
+ const ret = getObject(arg0) === void 0;
137017
+ return ret;
137018
+ };
137019
+ imports.wbg.__wbg_static_accessor_MODULE_452b4680e8614c81 = function() {
137020
+ const ret = module;
137021
+ return addHeapObject(ret);
137022
+ };
137023
+ imports.wbg.__wbg_require_f5521a5b85ad2542 = function(arg0, arg1, arg2) {
137024
+ const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
137025
+ return addHeapObject(ret);
137026
+ };
137027
+ imports.wbg.__wbg_getRandomValues_dd27e6b0652b3236 = function(arg0) {
137028
+ const ret = getObject(arg0).getRandomValues;
137029
+ return addHeapObject(ret);
137030
+ };
137031
+ imports.wbg.__wbg_getRandomValues_e57c9b75ddead065 = function(arg0, arg1) {
137032
+ getObject(arg0).getRandomValues(getObject(arg1));
137033
+ };
137034
+ imports.wbg.__wbg_randomFillSync_d2ba53160aec6aba = function(arg0, arg1, arg2) {
137035
+ getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
137036
+ };
137037
+ imports.wbg.__wbindgen_is_function = function(arg0) {
137038
+ const ret = typeof getObject(arg0) === "function";
137039
+ return ret;
137040
+ };
137041
+ imports.wbg.__wbg_newnoargs_e23b458e372830de = function(arg0, arg1) {
137042
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
137043
+ return addHeapObject(ret);
137044
+ };
137045
+ imports.wbg.__wbg_next_cabb70b365520721 = function(arg0) {
137046
+ const ret = getObject(arg0).next;
137047
+ return addHeapObject(ret);
137048
+ };
137049
+ imports.wbg.__wbg_next_bf3d83fc18df496e = function() {
137050
+ return handleError(function(arg0) {
137051
+ const ret = getObject(arg0).next();
137052
+ return addHeapObject(ret);
137053
+ }, arguments);
137054
+ };
137055
+ imports.wbg.__wbg_done_040f966faa9a72b3 = function(arg0) {
137056
+ const ret = getObject(arg0).done;
137057
+ return ret;
137058
+ };
137059
+ imports.wbg.__wbg_value_419afbd9b9574c4c = function(arg0) {
137060
+ const ret = getObject(arg0).value;
137061
+ return addHeapObject(ret);
137062
+ };
137063
+ imports.wbg.__wbg_iterator_4832ef1f15b0382b = function() {
137064
+ const ret = Symbol.iterator;
137065
+ return addHeapObject(ret);
137066
+ };
137067
+ imports.wbg.__wbg_get_a9cab131e3152c49 = function() {
137068
+ return handleError(function(arg0, arg1) {
137069
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
137070
+ return addHeapObject(ret);
137071
+ }, arguments);
137072
+ };
137073
+ imports.wbg.__wbg_call_ae78342adc33730a = function() {
137074
+ return handleError(function(arg0, arg1) {
137075
+ const ret = getObject(arg0).call(getObject(arg1));
137076
+ return addHeapObject(ret);
137077
+ }, arguments);
137078
+ };
137079
+ imports.wbg.__wbg_new_36359baae5a47e27 = function() {
137080
+ const ret = new Object();
137081
+ return addHeapObject(ret);
137082
+ };
137083
+ imports.wbg.__wbg_call_3ed288a247f13ea5 = function() {
137084
+ return handleError(function(arg0, arg1, arg2) {
137085
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
137086
+ return addHeapObject(ret);
137087
+ }, arguments);
137088
+ };
137089
+ imports.wbg.__wbg_getTime_bffb1c09df09618b = function(arg0) {
137090
+ const ret = getObject(arg0).getTime();
137091
+ return ret;
137092
+ };
137093
+ imports.wbg.__wbg_new0_0ff7eb5c1486f3ec = function() {
137094
+ const ret = new Date();
137095
+ return addHeapObject(ret);
137096
+ };
137097
+ imports.wbg.__wbg_new_37705eed627d5ed9 = function(arg0, arg1) {
137098
+ try {
137099
+ var state0 = { a: arg0, b: arg1 };
137100
+ var cb0 = /* @__PURE__ */ __name((arg02, arg12) => {
137101
+ const a = state0.a;
137102
+ state0.a = 0;
137103
+ try {
137104
+ return __wbg_adapter_108(a, state0.b, arg02, arg12);
137105
+ } finally {
137106
+ state0.a = a;
137107
+ }
137108
+ }, "cb0");
137109
+ const ret = new Promise(cb0);
137110
+ return addHeapObject(ret);
137111
+ } finally {
137112
+ state0.a = state0.b = 0;
137159
137113
  }
137160
- return formatter(utcDate, substring, locale2.localize, formatterOptions);
137161
- }
137162
- if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
137163
- throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
137114
+ };
137115
+ imports.wbg.__wbg_resolve_a9a87bdd64e9e62c = function(arg0) {
137116
+ const ret = Promise.resolve(getObject(arg0));
137117
+ return addHeapObject(ret);
137118
+ };
137119
+ imports.wbg.__wbg_then_ce526c837d07b68f = function(arg0, arg1) {
137120
+ const ret = getObject(arg0).then(getObject(arg1));
137121
+ return addHeapObject(ret);
137122
+ };
137123
+ imports.wbg.__wbg_then_842e65b843962f56 = function(arg0, arg1, arg2) {
137124
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
137125
+ return addHeapObject(ret);
137126
+ };
137127
+ imports.wbg.__wbg_self_99737b4dcdf6f0d8 = function() {
137128
+ return handleError(function() {
137129
+ const ret = self.self;
137130
+ return addHeapObject(ret);
137131
+ }, arguments);
137132
+ };
137133
+ imports.wbg.__wbg_window_9b61fbbf3564c4fb = function() {
137134
+ return handleError(function() {
137135
+ const ret = window.window;
137136
+ return addHeapObject(ret);
137137
+ }, arguments);
137138
+ };
137139
+ imports.wbg.__wbg_globalThis_8e275ef40caea3a3 = function() {
137140
+ return handleError(function() {
137141
+ const ret = globalThis.globalThis;
137142
+ return addHeapObject(ret);
137143
+ }, arguments);
137144
+ };
137145
+ imports.wbg.__wbg_global_5de1e0f82bddcd27 = function() {
137146
+ return handleError(function() {
137147
+ const ret = global.global;
137148
+ return addHeapObject(ret);
137149
+ }, arguments);
137150
+ };
137151
+ imports.wbg.__wbg_buffer_7af23f65f6c64548 = function(arg0) {
137152
+ const ret = getObject(arg0).buffer;
137153
+ return addHeapObject(ret);
137154
+ };
137155
+ imports.wbg.__wbg_newwithbyteoffsetandlength_ce1e75f0ce5f7974 = function(arg0, arg1, arg2) {
137156
+ const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
137157
+ return addHeapObject(ret);
137158
+ };
137159
+ imports.wbg.__wbg_new_cc9018bd6f283b6f = function(arg0) {
137160
+ const ret = new Uint8Array(getObject(arg0));
137161
+ return addHeapObject(ret);
137162
+ };
137163
+ imports.wbg.__wbg_set_f25e869e4565d2a2 = function(arg0, arg1, arg2) {
137164
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
137165
+ };
137166
+ imports.wbg.__wbg_length_0acb1cf9bbaf8519 = function(arg0) {
137167
+ const ret = getObject(arg0).length;
137168
+ return ret;
137169
+ };
137170
+ imports.wbg.__wbg_newwithlength_8f0657faca9f1422 = function(arg0) {
137171
+ const ret = new Uint8Array(arg0 >>> 0);
137172
+ return addHeapObject(ret);
137173
+ };
137174
+ imports.wbg.__wbg_subarray_da527dbd24eafb6b = function(arg0, arg1, arg2) {
137175
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
137176
+ return addHeapObject(ret);
137177
+ };
137178
+ imports.wbg.__wbg_has_ce995ec88636803d = function() {
137179
+ return handleError(function(arg0, arg1) {
137180
+ const ret = Reflect.has(getObject(arg0), getObject(arg1));
137181
+ return ret;
137182
+ }, arguments);
137183
+ };
137184
+ imports.wbg.__wbg_set_93b1c87ee2af852e = function() {
137185
+ return handleError(function(arg0, arg1, arg2) {
137186
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
137187
+ return ret;
137188
+ }, arguments);
137189
+ };
137190
+ imports.wbg.__wbg_stringify_c760003feffcc1f2 = function() {
137191
+ return handleError(function(arg0) {
137192
+ const ret = JSON.stringify(getObject(arg0));
137193
+ return addHeapObject(ret);
137194
+ }, arguments);
137195
+ };
137196
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
137197
+ const ret = debugString(getObject(arg1));
137198
+ const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
137199
+ const len0 = WASM_VECTOR_LEN;
137200
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
137201
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
137202
+ };
137203
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
137204
+ throw new Error(getStringFromWasm0(arg0, arg1));
137205
+ };
137206
+ imports.wbg.__wbindgen_memory = function() {
137207
+ const ret = wasm.memory;
137208
+ return addHeapObject(ret);
137209
+ };
137210
+ imports.wbg.__wbindgen_closure_wrapper10902 = function(arg0, arg1, arg2) {
137211
+ const ret = makeMutClosure(arg0, arg1, 3717, __wbg_adapter_24);
137212
+ return addHeapObject(ret);
137213
+ };
137214
+ if (typeof input === "string" || typeof Request === "function" && input instanceof Request || typeof URL === "function" && input instanceof URL) {
137215
+ input = fetch(input);
137164
137216
  }
137165
- return substring;
137166
- }).join("");
137167
- return result;
137168
- }
137169
- __name(format, "format");
137170
- function cleanEscapedString(input) {
137171
- return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
137172
- }
137173
- __name(cleanEscapedString, "cleanEscapedString");
137174
- var transformErrorCheck = /* @__PURE__ */ __name((error, _credential) => {
137175
- const prefix = error.split(" error")[0];
137176
- return prefix || error;
137177
- }, "transformErrorCheck");
137178
- var transformErrorMessage = /* @__PURE__ */ __name((error, credential) => {
137179
- if (error.startsWith("expiration")) {
137180
- return credential.expirationDate ? `Invalid \u2022 Expired ${format(new Date(credential.expirationDate), "dd MMM yyyy").toUpperCase()}` : "Invalid \u2022 Expired";
137181
- }
137182
- return error;
137183
- }, "transformErrorMessage");
137184
- var transformCheckMessage = /* @__PURE__ */ __name((check, credential) => {
137185
- return {
137186
- proof: "Valid",
137187
- expiration: credential.expirationDate ? `Valid \u2022 Expires ${format(new Date(credential.expirationDate), "dd MMM yyyy").toUpperCase()}` : "Valid \u2022 Does Not Expire"
137188
- }[check] || check;
137189
- }, "transformCheckMessage");
137190
- var verifyCredential3 = /* @__PURE__ */ __name((wallet) => {
137191
- return (credential) => __async$1(void 0, null, function* () {
137192
- const rawVerificationCheck = yield wallet.pluginMethods.verifyCredential(credential);
137193
- const verificationItems = [];
137194
- rawVerificationCheck.errors.forEach((error) => {
137195
- verificationItems.push({
137196
- status: VerificationStatusEnum.Failed,
137197
- check: transformErrorCheck(error, credential),
137198
- details: transformErrorMessage(error, credential)
137199
- });
137200
- });
137201
- rawVerificationCheck.warnings.forEach((warning) => {
137202
- verificationItems.push({
137203
- status: VerificationStatusEnum.Error,
137204
- check: "hmm",
137205
- message: warning
137206
- });
137207
- });
137208
- rawVerificationCheck.checks.forEach((check) => {
137209
- verificationItems.push({
137210
- status: VerificationStatusEnum.Success,
137211
- check,
137212
- message: transformCheckMessage(check, credential)
137213
- });
137214
- });
137215
- return verificationItems;
137217
+ const { instance, module } = yield load(yield input, imports);
137218
+ wasm = instance.exports;
137219
+ init2.__wbindgen_wasm_module = module;
137220
+ return wasm;
137216
137221
  });
137217
- }, "verifyCredential");
137218
- var defaultCeramicIDXArgs = {
137219
- modelData: {
137220
- definitions: {
137221
- MyVerifiableCredentials: "kjzl6cwe1jw14am5tu5hh412s19o4zm8aq3g2lpd6s4paxj2nly2lj4drp3pun2"
137222
- },
137223
- schemas: {
137224
- AchievementVerifiableCredential: "ceramic://k3y52l7qbv1frylibw2725v8gem3hxs1onoh6pvux0szdduugczh0hddxo6qsd6o0",
137225
- VerifiableCredentialsList: "ceramic://k3y52l7qbv1frxkcwfpyauky3fyl4n44izridy3blvjjzgftis40sk9w8g3remghs"
137226
- },
137227
- tiles: {}
137228
- },
137229
- credentialAlias: "MyVerifiableCredentials",
137230
- ceramicEndpoint: "https://ceramic-node.welibrary.io:7007",
137231
- defaultContentFamily: "SuperSkills"
137232
- };
137222
+ }
137223
+ __name(init2, "init");
137224
+ var didkit_wasm_default = init2;
137225
+ var initialized = false;
137226
+ var init3 = /* @__PURE__ */ __name((arg = "https://cdn.filestackcontent.com/jXExSjNXSerFVDMIYOgy") => __async$1(void 0, null, function* () {
137227
+ if (initialized)
137228
+ return;
137229
+ initialized = true;
137230
+ return didkit_wasm_default(arg);
137231
+ }), "init");
137232
+ var didkit_default = init3;
137233
137233
  var getDidKitPlugin = /* @__PURE__ */ __name((input) => __async$1(void 0, null, function* () {
137234
137234
  yield didkit_default(input);
137235
+ const memoizedDids = {};
137235
137236
  return {
137236
137237
  pluginMethods: {
137237
137238
  generateEd25519KeyFromBytes: (_wallet, bytes) => JSON.parse(generateEd25519KeyFromBytes(bytes)),
137238
- keyToDid: (_wallet, type, keypair) => keyToDID(type, JSON.stringify(keypair)),
137239
+ keyToDid: (_wallet, type, keypair) => {
137240
+ const memoizedDid = memoizedDids[type];
137241
+ if (!memoizedDid) {
137242
+ const did = keyToDID(type, JSON.stringify(keypair));
137243
+ memoizedDids[type] = did;
137244
+ return did;
137245
+ }
137246
+ return memoizedDid;
137247
+ },
137239
137248
  keyToVerificationMethod: (_wallet, type, keypair) => __async$1(void 0, null, function* () {
137240
137249
  return keyToVerificationMethod(type, JSON.stringify(keypair));
137241
137250
  }),
137242
137251
  issueCredential: (_wallet, credential, options, keypair) => __async$1(void 0, null, function* () {
137243
- return JSON.parse(yield issueCredential(JSON.stringify(credential), JSON.stringify(options), JSON.stringify(keypair)));
137252
+ return JSON.parse(yield issueCredential2(JSON.stringify(credential), JSON.stringify(options), JSON.stringify(keypair)));
137244
137253
  }),
137245
137254
  verifyCredential: (_wallet, credential) => __async$1(void 0, null, function* () {
137246
- return JSON.parse(yield verifyCredential(JSON.stringify(credential), "{}"));
137255
+ return JSON.parse(yield verifyCredential3(JSON.stringify(credential), "{}"));
137247
137256
  }),
137248
- issuePresentation: (presentation, options, keypair) => __async$1(void 0, null, function* () {
137249
- return issuePresentation(JSON.stringify(presentation), JSON.stringify(options), JSON.stringify(keypair));
137257
+ issuePresentation: (_wallet, presentation, options, keypair) => __async$1(void 0, null, function* () {
137258
+ return JSON.parse(yield issuePresentation2(JSON.stringify(presentation), JSON.stringify(options), JSON.stringify(keypair)));
137250
137259
  }),
137251
137260
  verifyPresentation: (_wallet, presentation) => __async$1(void 0, null, function* () {
137252
- return JSON.parse(yield verifyPresentation(JSON.stringify(presentation), "{}"));
137261
+ return JSON.parse(yield verifyPresentation2(JSON.stringify(presentation), "{}"));
137253
137262
  })
137254
137263
  }
137255
137264
  };
@@ -137259,7 +137268,6 @@ var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async$1(void 0, [_0,
137259
137268
  didkit,
137260
137269
  defaultContents = []
137261
137270
  } = {}) {
137262
- yield didkit_default(didkit);
137263
137271
  const didkitWallet = yield (yield generateWallet(defaultContents)).addPlugin(yield getDidKitPlugin(didkit));
137264
137272
  const didkeyWallet = yield didkitWallet.addPlugin(yield getDidKeyPlugin(didkitWallet, key2));
137265
137273
  const didkeyAndVCWallet = yield didkeyWallet.addPlugin(yield getVCPlugin(didkeyWallet));
@@ -137267,14 +137275,12 @@ var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async$1(void 0, [_0,
137267
137275
  const wallet = yield idxWallet.addPlugin(ExpirationPlugin(idxWallet));
137268
137276
  return {
137269
137277
  _wallet: wallet,
137270
- get did() {
137271
- return wallet.pluginMethods.getSubjectDid();
137272
- },
137278
+ did: (type = "key") => wallet.pluginMethods.getSubjectDid(type),
137273
137279
  get keypair() {
137274
137280
  return wallet.pluginMethods.getSubjectKeypair();
137275
137281
  },
137276
137282
  issueCredential: wallet.pluginMethods.issueCredential,
137277
- verifyCredential: verifyCredential3(wallet),
137283
+ verifyCredential: verifyCredential2(wallet),
137278
137284
  issuePresentation: wallet.pluginMethods.issuePresentation,
137279
137285
  verifyPresentation: wallet.pluginMethods.verifyPresentation,
137280
137286
  getCredential: wallet.pluginMethods.getVerifiableCredentialFromIndex,
@@ -137348,4 +137354,4 @@ const VCCard = ({ credential, issueeOverride, className = "" }) => {
137348
137354
  };
137349
137355
 
137350
137356
  export { VCCard as V };
137351
- //# sourceMappingURL=VCCard-e39551a6.js.map
137357
+ //# sourceMappingURL=VCCard-27020ddd.js.map