@learncard/core 1.1.5 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -29752,916 +29752,262 @@ __export(src_exports2, {
29752
29752
  module.exports = __toCommonJS(src_exports2);
29753
29753
  var import_isomorphic_fetch = require("isomorphic-fetch");
29754
29754
 
29755
- // src/didkit/pkg/didkit_wasm.js
29756
- var wasm;
29757
- var cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
29758
- cachedTextDecoder.decode();
29759
- var cachegetUint8Memory0 = null;
29760
- function getUint8Memory0() {
29761
- if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
29762
- cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
29763
- }
29764
- return cachegetUint8Memory0;
29765
- }
29766
- __name(getUint8Memory0, "getUint8Memory0");
29767
- function getStringFromWasm0(ptr, len) {
29768
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
29769
- }
29770
- __name(getStringFromWasm0, "getStringFromWasm0");
29771
- var heap = new Array(32).fill(void 0);
29772
- heap.push(void 0, null, true, false);
29773
- var heap_next = heap.length;
29774
- function addHeapObject(obj) {
29775
- if (heap_next === heap.length)
29776
- heap.push(heap.length + 1);
29777
- const idx = heap_next;
29778
- heap_next = heap[idx];
29779
- heap[idx] = obj;
29780
- return idx;
29781
- }
29782
- __name(addHeapObject, "addHeapObject");
29783
- function getObject(idx) {
29784
- return heap[idx];
29785
- }
29786
- __name(getObject, "getObject");
29787
- function dropObject(idx) {
29788
- if (idx < 36)
29789
- return;
29790
- heap[idx] = heap_next;
29791
- heap_next = idx;
29792
- }
29793
- __name(dropObject, "dropObject");
29794
- function takeObject(idx) {
29795
- const ret = getObject(idx);
29796
- dropObject(idx);
29797
- return ret;
29798
- }
29799
- __name(takeObject, "takeObject");
29800
- var WASM_VECTOR_LEN = 0;
29801
- var cachedTextEncoder = new TextEncoder("utf-8");
29802
- var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
29803
- return cachedTextEncoder.encodeInto(arg, view);
29804
- } : function(arg, view) {
29805
- const buf2 = cachedTextEncoder.encode(arg);
29806
- view.set(buf2);
29807
- return {
29808
- read: arg.length,
29809
- written: buf2.length
29810
- };
29811
- };
29812
- function passStringToWasm0(arg, malloc, realloc) {
29813
- if (realloc === void 0) {
29814
- const buf2 = cachedTextEncoder.encode(arg);
29815
- const ptr2 = malloc(buf2.length);
29816
- getUint8Memory0().subarray(ptr2, ptr2 + buf2.length).set(buf2);
29817
- WASM_VECTOR_LEN = buf2.length;
29818
- return ptr2;
29819
- }
29820
- let len = arg.length;
29821
- let ptr = malloc(len);
29822
- const mem = getUint8Memory0();
29823
- let offset = 0;
29824
- for (; offset < len; offset++) {
29825
- const code5 = arg.charCodeAt(offset);
29826
- if (code5 > 127)
29827
- break;
29828
- mem[ptr + offset] = code5;
29829
- }
29830
- if (offset !== len) {
29831
- if (offset !== 0) {
29832
- arg = arg.slice(offset);
29755
+ // src/wallet/base/crypto.ts
29756
+ var import_isomorphic_webcrypto = __toESM(require("isomorphic-webcrypto"));
29757
+ if (typeof window === "undefined")
29758
+ globalThis.crypto = import_isomorphic_webcrypto.default;
29759
+
29760
+ // src/wallet/base/wallet.ts
29761
+ var addPluginToWallet = /* @__PURE__ */ __name((wallet, plugin) => __async(void 0, null, function* () {
29762
+ return generateWallet(wallet.contents, {
29763
+ plugins: [...wallet.plugins, plugin]
29764
+ });
29765
+ }), "addPluginToWallet");
29766
+ var addToWallet = /* @__PURE__ */ __name((wallet, content) => __async(void 0, null, function* () {
29767
+ return generateWallet([...wallet.contents, content], wallet);
29768
+ }), "addToWallet");
29769
+ var removeFromWallet = /* @__PURE__ */ __name((wallet, contentId) => __async(void 0, null, function* () {
29770
+ const clonedContents = JSON.parse(JSON.stringify(wallet.contents));
29771
+ const content = clonedContents.find((c) => c.id === contentId);
29772
+ return generateWallet(clonedContents.filter((i) => i.id !== content.id), wallet);
29773
+ }), "removeFromWallet");
29774
+ var bindMethods = /* @__PURE__ */ __name((wallet, pluginMethods) => Object.fromEntries(Object.entries(pluginMethods).map(([key2, method]) => [key2, method.bind(wallet, wallet)])), "bindMethods");
29775
+ var generateWallet = /* @__PURE__ */ __name((..._0) => __async(void 0, [..._0], function* (contents = [], _wallet = {}) {
29776
+ const { plugins = [] } = _wallet;
29777
+ const pluginMethods = plugins.reduce((cumulativePluginMethods, plugin) => {
29778
+ const newPluginMethods = __spreadValues(__spreadValues({}, cumulativePluginMethods), plugin.pluginMethods);
29779
+ return newPluginMethods;
29780
+ }, {});
29781
+ const wallet = {
29782
+ contents: [...contents],
29783
+ add: function(content) {
29784
+ return addToWallet(this, content);
29785
+ },
29786
+ remove: function(contentId) {
29787
+ return removeFromWallet(this, contentId);
29788
+ },
29789
+ status: "UNLOCKED" /* Unlocked */,
29790
+ plugins,
29791
+ pluginMethods,
29792
+ addPlugin: function(plugin) {
29793
+ return addPluginToWallet(this, plugin);
29833
29794
  }
29834
- ptr = realloc(ptr, len, len = offset + arg.length * 3);
29835
- const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
29836
- const ret = encodeString(arg, view);
29837
- offset += ret.written;
29795
+ };
29796
+ if (pluginMethods)
29797
+ wallet.pluginMethods = bindMethods(wallet, pluginMethods);
29798
+ return wallet;
29799
+ }), "generateWallet");
29800
+
29801
+ // ../../node_modules/.pnpm/did-resolver@3.2.2/node_modules/did-resolver/lib/resolver.module.js
29802
+ function _catch(body, recover) {
29803
+ try {
29804
+ var result = body();
29805
+ } catch (e) {
29806
+ return recover(e);
29838
29807
  }
29839
- WASM_VECTOR_LEN = offset;
29840
- return ptr;
29841
- }
29842
- __name(passStringToWasm0, "passStringToWasm0");
29843
- function isLikeNone(x) {
29844
- return x === void 0 || x === null;
29845
- }
29846
- __name(isLikeNone, "isLikeNone");
29847
- var cachegetInt32Memory0 = null;
29848
- function getInt32Memory0() {
29849
- if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
29850
- cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
29808
+ if (result && result.then) {
29809
+ return result.then(void 0, recover);
29851
29810
  }
29852
- return cachegetInt32Memory0;
29811
+ return result;
29853
29812
  }
29854
- __name(getInt32Memory0, "getInt32Memory0");
29855
- function debugString(val) {
29856
- const type = typeof val;
29857
- if (type == "number" || type == "boolean" || val == null) {
29858
- return `${val}`;
29859
- }
29860
- if (type == "string") {
29861
- return `"${val}"`;
29862
- }
29863
- if (type == "symbol") {
29864
- const description = val.description;
29865
- if (description == null) {
29866
- return "Symbol";
29867
- } else {
29868
- return `Symbol(${description})`;
29869
- }
29870
- }
29871
- if (type == "function") {
29872
- const name5 = val.name;
29873
- if (typeof name5 == "string" && name5.length > 0) {
29874
- return `Function(${name5})`;
29875
- } else {
29876
- return "Function";
29877
- }
29878
- }
29879
- if (Array.isArray(val)) {
29880
- const length2 = val.length;
29881
- let debug = "[";
29882
- if (length2 > 0) {
29883
- debug += debugString(val[0]);
29884
- }
29885
- for (let i = 1; i < length2; i++) {
29886
- debug += ", " + debugString(val[i]);
29887
- }
29888
- debug += "]";
29889
- return debug;
29890
- }
29891
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
29892
- let className;
29893
- if (builtInMatches.length > 1) {
29894
- className = builtInMatches[1];
29895
- } else {
29896
- return toString.call(val);
29897
- }
29898
- if (className == "Object") {
29813
+ __name(_catch, "_catch");
29814
+ function inMemoryCache() {
29815
+ const cache = /* @__PURE__ */ new Map();
29816
+ return function(parsed, resolve) {
29899
29817
  try {
29900
- return "Object(" + JSON.stringify(val) + ")";
29901
- } catch (_) {
29902
- return "Object";
29818
+ let _temp2 = function(_result) {
29819
+ if (_exit)
29820
+ return _result;
29821
+ const cached = cache.get(parsed.didUrl);
29822
+ return cached !== void 0 ? cached : Promise.resolve(resolve()).then(function(result) {
29823
+ var _result$didResolution;
29824
+ if (((_result$didResolution = result.didResolutionMetadata) == null ? void 0 : _result$didResolution.error) !== "notFound") {
29825
+ cache.set(parsed.didUrl, result);
29826
+ }
29827
+ return result;
29828
+ });
29829
+ };
29830
+ __name(_temp2, "_temp2");
29831
+ let _exit;
29832
+ const _temp = function() {
29833
+ if (parsed.params && parsed.params["no-cache"] === "true") {
29834
+ return Promise.resolve(resolve()).then(function(_await$resolve) {
29835
+ _exit = 1;
29836
+ return _await$resolve;
29837
+ });
29838
+ }
29839
+ }();
29840
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
29841
+ } catch (e) {
29842
+ return Promise.reject(e);
29903
29843
  }
29904
- }
29905
- if (val instanceof Error) {
29906
- return `${val.name}: ${val.message}
29907
- ${val.stack}`;
29908
- }
29909
- return className;
29844
+ };
29910
29845
  }
29911
- __name(debugString, "debugString");
29912
- function makeMutClosure(arg0, arg1, dtor, f) {
29913
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
29914
- const real = /* @__PURE__ */ __name((...args) => {
29915
- state.cnt++;
29916
- const a = state.a;
29917
- state.a = 0;
29918
- try {
29919
- return f(a, state.b, ...args);
29920
- } finally {
29921
- if (--state.cnt === 0) {
29922
- wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
29923
- } else {
29924
- state.a = a;
29925
- }
29926
- }
29927
- }, "real");
29928
- real.original = state;
29929
- return real;
29846
+ __name(inMemoryCache, "inMemoryCache");
29847
+ function noCache(parsed, resolve) {
29848
+ return resolve();
29930
29849
  }
29931
- __name(makeMutClosure, "makeMutClosure");
29932
- function __wbg_adapter_24(arg0, arg1, arg2) {
29933
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h91a8814f66f14b17(arg0, arg1, addHeapObject(arg2));
29850
+ __name(noCache, "noCache");
29851
+ var PCT_ENCODED = "(?:%[0-9a-fA-F]{2})";
29852
+ var ID_CHAR = `(?:[a-zA-Z0-9._-]|${PCT_ENCODED})`;
29853
+ var METHOD = "([a-z0-9]+)";
29854
+ var METHOD_ID = `((?:${ID_CHAR}*:)*(${ID_CHAR}+))`;
29855
+ var PARAM_CHAR = "[a-zA-Z0-9_.:%-]";
29856
+ var PARAM = `;${PARAM_CHAR}+=${PARAM_CHAR}*`;
29857
+ var PARAMS = `((${PARAM})*)`;
29858
+ var PATH = `(/[^#?]*)?`;
29859
+ var QUERY = `([?][^#]*)?`;
29860
+ var FRAGMENT = `(#.*)?`;
29861
+ var DID_MATCHER = new RegExp(`^did:${METHOD}:${METHOD_ID}${PARAMS}${PATH}${QUERY}${FRAGMENT}$`);
29862
+ function parse(didUrl) {
29863
+ if (didUrl === "" || !didUrl)
29864
+ return null;
29865
+ const sections = didUrl.match(DID_MATCHER);
29866
+ if (sections) {
29867
+ const parts = {
29868
+ did: `did:${sections[1]}:${sections[2]}`,
29869
+ method: sections[1],
29870
+ id: sections[2],
29871
+ didUrl
29872
+ };
29873
+ if (sections[4]) {
29874
+ const params = sections[4].slice(1).split(";");
29875
+ parts.params = {};
29876
+ for (const p of params) {
29877
+ const kv = p.split("=");
29878
+ parts.params[kv[0]] = kv[1];
29879
+ }
29880
+ }
29881
+ if (sections[6])
29882
+ parts.path = sections[6];
29883
+ if (sections[7])
29884
+ parts.query = sections[7].slice(1);
29885
+ if (sections[8])
29886
+ parts.fragment = sections[8].slice(1);
29887
+ return parts;
29888
+ }
29889
+ return null;
29934
29890
  }
29935
- __name(__wbg_adapter_24, "__wbg_adapter_24");
29936
- function passArray8ToWasm0(arg, malloc) {
29937
- const ptr = malloc(arg.length * 1);
29938
- getUint8Memory0().set(arg, ptr / 1);
29939
- WASM_VECTOR_LEN = arg.length;
29940
- return ptr;
29891
+ __name(parse, "parse");
29892
+ var EMPTY_RESULT = {
29893
+ didResolutionMetadata: {},
29894
+ didDocument: null,
29895
+ didDocumentMetadata: {}
29896
+ };
29897
+ function wrapLegacyResolver(resolve) {
29898
+ return function(did, parsed, resolver) {
29899
+ try {
29900
+ return Promise.resolve(_catch(function() {
29901
+ return Promise.resolve(resolve(did, parsed, resolver)).then(function(doc) {
29902
+ return __spreadProps(__spreadValues({}, EMPTY_RESULT), {
29903
+ didResolutionMetadata: {
29904
+ contentType: "application/did+ld+json"
29905
+ },
29906
+ didDocument: doc
29907
+ });
29908
+ });
29909
+ }, function(e) {
29910
+ return __spreadProps(__spreadValues({}, EMPTY_RESULT), {
29911
+ didResolutionMetadata: {
29912
+ error: "notFound",
29913
+ message: e.toString()
29914
+ }
29915
+ });
29916
+ }));
29917
+ } catch (e) {
29918
+ return Promise.reject(e);
29919
+ }
29920
+ };
29941
29921
  }
29942
- __name(passArray8ToWasm0, "passArray8ToWasm0");
29943
- function generateEd25519KeyFromBytes(bytes) {
29944
- try {
29945
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
29946
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
29947
- const len0 = WASM_VECTOR_LEN;
29948
- wasm.generateEd25519KeyFromBytes(retptr, ptr0, len0);
29949
- var r0 = getInt32Memory0()[retptr / 4 + 0];
29950
- var r1 = getInt32Memory0()[retptr / 4 + 1];
29951
- var r2 = getInt32Memory0()[retptr / 4 + 2];
29952
- var r3 = getInt32Memory0()[retptr / 4 + 3];
29953
- var ptr1 = r0;
29954
- var len1 = r1;
29955
- if (r3) {
29956
- ptr1 = 0;
29957
- len1 = 0;
29958
- throw takeObject(r2);
29922
+ __name(wrapLegacyResolver, "wrapLegacyResolver");
29923
+ var Resolver = class {
29924
+ constructor(registry2 = {}, options = {}) {
29925
+ this.registry = void 0;
29926
+ this.cache = void 0;
29927
+ this.registry = registry2;
29928
+ this.cache = options.cache === true ? inMemoryCache() : options.cache || noCache;
29929
+ if (options.legacyResolvers) {
29930
+ Object.keys(options.legacyResolvers).map((methodName) => {
29931
+ if (!this.registry[methodName]) {
29932
+ this.registry[methodName] = wrapLegacyResolver(options.legacyResolvers[methodName]);
29933
+ }
29934
+ });
29959
29935
  }
29960
- return getStringFromWasm0(ptr1, len1);
29961
- } finally {
29962
- wasm.__wbindgen_add_to_stack_pointer(16);
29963
- wasm.__wbindgen_free(ptr1, len1);
29964
29936
  }
29965
- }
29966
- __name(generateEd25519KeyFromBytes, "generateEd25519KeyFromBytes");
29967
- function keyToDID(method_pattern, jwk) {
29968
- try {
29969
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
29970
- const ptr0 = passStringToWasm0(method_pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
29971
- const len0 = WASM_VECTOR_LEN;
29972
- const ptr1 = passStringToWasm0(jwk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
29973
- const len1 = WASM_VECTOR_LEN;
29974
- wasm.keyToDID(retptr, ptr0, len0, ptr1, len1);
29975
- var r0 = getInt32Memory0()[retptr / 4 + 0];
29976
- var r1 = getInt32Memory0()[retptr / 4 + 1];
29977
- var r2 = getInt32Memory0()[retptr / 4 + 2];
29978
- var r3 = getInt32Memory0()[retptr / 4 + 3];
29979
- var ptr2 = r0;
29980
- var len2 = r1;
29981
- if (r3) {
29982
- ptr2 = 0;
29983
- len2 = 0;
29984
- throw takeObject(r2);
29937
+ resolve(didUrl, options = {}) {
29938
+ try {
29939
+ const _this = this;
29940
+ const parsed = parse(didUrl);
29941
+ if (parsed === null) {
29942
+ return Promise.resolve(__spreadProps(__spreadValues({}, EMPTY_RESULT), {
29943
+ didResolutionMetadata: {
29944
+ error: "invalidDid"
29945
+ }
29946
+ }));
29947
+ }
29948
+ const resolver = _this.registry[parsed.method];
29949
+ if (!resolver) {
29950
+ return Promise.resolve(__spreadProps(__spreadValues({}, EMPTY_RESULT), {
29951
+ didResolutionMetadata: {
29952
+ error: "unsupportedDidMethod"
29953
+ }
29954
+ }));
29955
+ }
29956
+ return Promise.resolve(_this.cache(parsed, () => resolver(parsed.did, parsed, _this, options)));
29957
+ } catch (e) {
29958
+ return Promise.reject(e);
29985
29959
  }
29986
- return getStringFromWasm0(ptr2, len2);
29987
- } finally {
29988
- wasm.__wbindgen_add_to_stack_pointer(16);
29989
- wasm.__wbindgen_free(ptr2, len2);
29990
29960
  }
29961
+ };
29962
+ __name(Resolver, "Resolver");
29963
+
29964
+ // ../../node_modules/.pnpm/uint8arrays@3.0.0/node_modules/uint8arrays/esm/src/index.js
29965
+ init_concat();
29966
+ init_from_string();
29967
+ init_to_string();
29968
+
29969
+ // ../../node_modules/.pnpm/did-jwt@5.9.0/node_modules/did-jwt/lib/index.module.js
29970
+ init_basics();
29971
+ var import_sha256 = __toESM(require_sha256());
29972
+ var import_js_sha3 = __toESM(require_sha3());
29973
+ var import_elliptic = __toESM(require_elliptic());
29974
+ var import_ed25519 = __toESM(require_ed25519());
29975
+ var import_canonicalize = __toESM(require_canonicalize());
29976
+ var import_x25519 = __toESM(require_x25519());
29977
+ var import_xchacha20poly1305 = __toESM(require_xchacha20poly1305());
29978
+ var import_random = __toESM(require_random());
29979
+ function bytesToBase64url(b) {
29980
+ return toString3(b, "base64url");
29991
29981
  }
29992
- __name(keyToDID, "keyToDID");
29993
- function keyToVerificationMethod(method_pattern, jwk) {
29994
- const ptr0 = passStringToWasm0(method_pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
29995
- const len0 = WASM_VECTOR_LEN;
29996
- const ptr1 = passStringToWasm0(jwk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
29997
- const len1 = WASM_VECTOR_LEN;
29998
- const ret = wasm.keyToVerificationMethod(ptr0, len0, ptr1, len1);
29999
- return takeObject(ret);
30000
- }
30001
- __name(keyToVerificationMethod, "keyToVerificationMethod");
30002
- function issueCredential(credential, proof_options, key2) {
30003
- const ptr0 = passStringToWasm0(credential, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
30004
- const len0 = WASM_VECTOR_LEN;
30005
- const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
30006
- const len1 = WASM_VECTOR_LEN;
30007
- const ptr2 = passStringToWasm0(key2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
30008
- const len2 = WASM_VECTOR_LEN;
30009
- const ret = wasm.issueCredential(ptr0, len0, ptr1, len1, ptr2, len2);
30010
- return takeObject(ret);
29982
+ __name(bytesToBase64url, "bytesToBase64url");
29983
+ function base64ToBytes(s) {
29984
+ const inputBase64Url = s.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
29985
+ return fromString2(inputBase64Url, "base64url");
30011
29986
  }
30012
- __name(issueCredential, "issueCredential");
30013
- function verifyCredential(vc, proof_options) {
30014
- const ptr0 = passStringToWasm0(vc, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
30015
- const len0 = WASM_VECTOR_LEN;
30016
- const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
30017
- const len1 = WASM_VECTOR_LEN;
30018
- const ret = wasm.verifyCredential(ptr0, len0, ptr1, len1);
30019
- return takeObject(ret);
29987
+ __name(base64ToBytes, "base64ToBytes");
29988
+ function base58ToBytes(s) {
29989
+ return fromString2(s, "base58btc");
30020
29990
  }
30021
- __name(verifyCredential, "verifyCredential");
30022
- function issuePresentation(presentation, proof_options, key2) {
30023
- const ptr0 = passStringToWasm0(presentation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
30024
- const len0 = WASM_VECTOR_LEN;
30025
- const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
30026
- const len1 = WASM_VECTOR_LEN;
30027
- const ptr2 = passStringToWasm0(key2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
30028
- const len2 = WASM_VECTOR_LEN;
30029
- const ret = wasm.issuePresentation(ptr0, len0, ptr1, len1, ptr2, len2);
30030
- return takeObject(ret);
29991
+ __name(base58ToBytes, "base58ToBytes");
29992
+ function hexToBytes(s) {
29993
+ const input = s.startsWith("0x") ? s.substring(2) : s;
29994
+ return fromString2(input.toLowerCase(), "base16");
30031
29995
  }
30032
- __name(issuePresentation, "issuePresentation");
30033
- function verifyPresentation(vp, proof_options) {
30034
- const ptr0 = passStringToWasm0(vp, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
30035
- const len0 = WASM_VECTOR_LEN;
30036
- const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
30037
- const len1 = WASM_VECTOR_LEN;
30038
- const ret = wasm.verifyPresentation(ptr0, len0, ptr1, len1);
30039
- return takeObject(ret);
29996
+ __name(hexToBytes, "hexToBytes");
29997
+ function encodeBase64url(s) {
29998
+ return bytesToBase64url(fromString2(s));
30040
29999
  }
30041
- __name(verifyPresentation, "verifyPresentation");
30042
- function handleError(f, args) {
30043
- try {
30044
- return f.apply(this, args);
30045
- } catch (e) {
30046
- wasm.__wbindgen_exn_store(addHeapObject(e));
30047
- }
30000
+ __name(encodeBase64url, "encodeBase64url");
30001
+ function decodeBase64url(s) {
30002
+ return toString3(base64ToBytes(s));
30048
30003
  }
30049
- __name(handleError, "handleError");
30050
- function getArrayU8FromWasm0(ptr, len) {
30051
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
30004
+ __name(decodeBase64url, "decodeBase64url");
30005
+ function bytesToHex(b) {
30006
+ return toString3(b, "base16");
30052
30007
  }
30053
- __name(getArrayU8FromWasm0, "getArrayU8FromWasm0");
30054
- function __wbg_adapter_108(arg0, arg1, arg2, arg3) {
30055
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h3ecfeb7a01c1be81(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
30056
- }
30057
- __name(__wbg_adapter_108, "__wbg_adapter_108");
30058
- function load(module2, imports) {
30059
- return __async(this, null, function* () {
30060
- if (typeof Response === "function" && module2 instanceof Response) {
30061
- if (typeof WebAssembly.instantiateStreaming === "function") {
30062
- try {
30063
- return yield WebAssembly.instantiateStreaming(module2, imports);
30064
- } catch (e) {
30065
- if (module2.headers.get("Content-Type") != "application/wasm") {
30066
- 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);
30067
- } else {
30068
- throw e;
30069
- }
30070
- }
30071
- }
30072
- const bytes = yield module2.arrayBuffer();
30073
- return yield WebAssembly.instantiate(bytes, imports);
30074
- } else {
30075
- const instance = yield WebAssembly.instantiate(module2, imports);
30076
- if (instance instanceof WebAssembly.Instance) {
30077
- return { instance, module: module2 };
30078
- } else {
30079
- return instance;
30080
- }
30081
- }
30082
- });
30083
- }
30084
- __name(load, "load");
30085
- function init(input) {
30086
- return __async(this, null, function* () {
30087
- if (typeof input === "undefined") {
30088
- }
30089
- const imports = {};
30090
- imports.wbg = {};
30091
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
30092
- const ret = getStringFromWasm0(arg0, arg1);
30093
- return addHeapObject(ret);
30094
- };
30095
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
30096
- takeObject(arg0);
30097
- };
30098
- imports.wbg.__wbindgen_cb_drop = function(arg0) {
30099
- const obj = takeObject(arg0).original;
30100
- if (obj.cnt-- == 1) {
30101
- obj.a = 0;
30102
- return true;
30103
- }
30104
- const ret = false;
30105
- return ret;
30106
- };
30107
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
30108
- const ret = getObject(arg0);
30109
- return addHeapObject(ret);
30110
- };
30111
- imports.wbg.__wbg_fetch_811d43d6bdcad5b1 = function(arg0) {
30112
- const ret = fetch(getObject(arg0));
30113
- return addHeapObject(ret);
30114
- };
30115
- imports.wbg.__wbg_fetch_bf56e2a9f0644e3f = function(arg0, arg1) {
30116
- const ret = getObject(arg0).fetch(getObject(arg1));
30117
- return addHeapObject(ret);
30118
- };
30119
- imports.wbg.__wbg_new_89d7f088c1c45353 = function() {
30120
- return handleError(function() {
30121
- const ret = new Headers();
30122
- return addHeapObject(ret);
30123
- }, arguments);
30124
- };
30125
- imports.wbg.__wbg_append_f4f93bc73c45ee3e = function() {
30126
- return handleError(function(arg0, arg1, arg2, arg3, arg4) {
30127
- getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
30128
- }, arguments);
30129
- };
30130
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
30131
- const obj = getObject(arg1);
30132
- const ret = typeof obj === "string" ? obj : void 0;
30133
- var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
30134
- var len0 = WASM_VECTOR_LEN;
30135
- getInt32Memory0()[arg0 / 4 + 1] = len0;
30136
- getInt32Memory0()[arg0 / 4 + 0] = ptr0;
30137
- };
30138
- imports.wbg.__wbg_instanceof_Response_ccfeb62399355bcd = function(arg0) {
30139
- const ret = getObject(arg0) instanceof Response;
30140
- return ret;
30141
- };
30142
- imports.wbg.__wbg_url_06c0f822d68d195c = function(arg0, arg1) {
30143
- const ret = getObject(arg1).url;
30144
- const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
30145
- const len0 = WASM_VECTOR_LEN;
30146
- getInt32Memory0()[arg0 / 4 + 1] = len0;
30147
- getInt32Memory0()[arg0 / 4 + 0] = ptr0;
30148
- };
30149
- imports.wbg.__wbg_status_600fd8b881393898 = function(arg0) {
30150
- const ret = getObject(arg0).status;
30151
- return ret;
30152
- };
30153
- imports.wbg.__wbg_headers_9e7f2c05a9b962ea = function(arg0) {
30154
- const ret = getObject(arg0).headers;
30155
- return addHeapObject(ret);
30156
- };
30157
- imports.wbg.__wbg_arrayBuffer_5a99283a3954c850 = function() {
30158
- return handleError(function(arg0) {
30159
- const ret = getObject(arg0).arrayBuffer();
30160
- return addHeapObject(ret);
30161
- }, arguments);
30162
- };
30163
- imports.wbg.__wbg_newwithstrandinit_fd99688f189f053e = function() {
30164
- return handleError(function(arg0, arg1, arg2) {
30165
- const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
30166
- return addHeapObject(ret);
30167
- }, arguments);
30168
- };
30169
- imports.wbg.__wbindgen_is_object = function(arg0) {
30170
- const val = getObject(arg0);
30171
- const ret = typeof val === "object" && val !== null;
30172
- return ret;
30173
- };
30174
- imports.wbg.__wbg_self_86b4b13392c7af56 = function() {
30175
- return handleError(function() {
30176
- const ret = self.self;
30177
- return addHeapObject(ret);
30178
- }, arguments);
30179
- };
30180
- imports.wbg.__wbg_crypto_b8c92eaac23d0d80 = function(arg0) {
30181
- const ret = getObject(arg0).crypto;
30182
- return addHeapObject(ret);
30183
- };
30184
- imports.wbg.__wbg_msCrypto_9ad6677321a08dd8 = function(arg0) {
30185
- const ret = getObject(arg0).msCrypto;
30186
- return addHeapObject(ret);
30187
- };
30188
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
30189
- const ret = getObject(arg0) === void 0;
30190
- return ret;
30191
- };
30192
- imports.wbg.__wbg_static_accessor_MODULE_452b4680e8614c81 = function() {
30193
- const ret = module2;
30194
- return addHeapObject(ret);
30195
- };
30196
- imports.wbg.__wbg_require_f5521a5b85ad2542 = function(arg0, arg1, arg2) {
30197
- const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
30198
- return addHeapObject(ret);
30199
- };
30200
- imports.wbg.__wbg_getRandomValues_dd27e6b0652b3236 = function(arg0) {
30201
- const ret = getObject(arg0).getRandomValues;
30202
- return addHeapObject(ret);
30203
- };
30204
- imports.wbg.__wbg_getRandomValues_e57c9b75ddead065 = function(arg0, arg1) {
30205
- getObject(arg0).getRandomValues(getObject(arg1));
30206
- };
30207
- imports.wbg.__wbg_randomFillSync_d2ba53160aec6aba = function(arg0, arg1, arg2) {
30208
- getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
30209
- };
30210
- imports.wbg.__wbindgen_is_function = function(arg0) {
30211
- const ret = typeof getObject(arg0) === "function";
30212
- return ret;
30213
- };
30214
- imports.wbg.__wbg_newnoargs_e23b458e372830de = function(arg0, arg1) {
30215
- const ret = new Function(getStringFromWasm0(arg0, arg1));
30216
- return addHeapObject(ret);
30217
- };
30218
- imports.wbg.__wbg_next_cabb70b365520721 = function(arg0) {
30219
- const ret = getObject(arg0).next;
30220
- return addHeapObject(ret);
30221
- };
30222
- imports.wbg.__wbg_next_bf3d83fc18df496e = function() {
30223
- return handleError(function(arg0) {
30224
- const ret = getObject(arg0).next();
30225
- return addHeapObject(ret);
30226
- }, arguments);
30227
- };
30228
- imports.wbg.__wbg_done_040f966faa9a72b3 = function(arg0) {
30229
- const ret = getObject(arg0).done;
30230
- return ret;
30231
- };
30232
- imports.wbg.__wbg_value_419afbd9b9574c4c = function(arg0) {
30233
- const ret = getObject(arg0).value;
30234
- return addHeapObject(ret);
30235
- };
30236
- imports.wbg.__wbg_iterator_4832ef1f15b0382b = function() {
30237
- const ret = Symbol.iterator;
30238
- return addHeapObject(ret);
30239
- };
30240
- imports.wbg.__wbg_get_a9cab131e3152c49 = function() {
30241
- return handleError(function(arg0, arg1) {
30242
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
30243
- return addHeapObject(ret);
30244
- }, arguments);
30245
- };
30246
- imports.wbg.__wbg_call_ae78342adc33730a = function() {
30247
- return handleError(function(arg0, arg1) {
30248
- const ret = getObject(arg0).call(getObject(arg1));
30249
- return addHeapObject(ret);
30250
- }, arguments);
30251
- };
30252
- imports.wbg.__wbg_new_36359baae5a47e27 = function() {
30253
- const ret = new Object();
30254
- return addHeapObject(ret);
30255
- };
30256
- imports.wbg.__wbg_call_3ed288a247f13ea5 = function() {
30257
- return handleError(function(arg0, arg1, arg2) {
30258
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
30259
- return addHeapObject(ret);
30260
- }, arguments);
30261
- };
30262
- imports.wbg.__wbg_getTime_bffb1c09df09618b = function(arg0) {
30263
- const ret = getObject(arg0).getTime();
30264
- return ret;
30265
- };
30266
- imports.wbg.__wbg_new0_0ff7eb5c1486f3ec = function() {
30267
- const ret = new Date();
30268
- return addHeapObject(ret);
30269
- };
30270
- imports.wbg.__wbg_new_37705eed627d5ed9 = function(arg0, arg1) {
30271
- try {
30272
- var state0 = { a: arg0, b: arg1 };
30273
- var cb0 = /* @__PURE__ */ __name((arg02, arg12) => {
30274
- const a = state0.a;
30275
- state0.a = 0;
30276
- try {
30277
- return __wbg_adapter_108(a, state0.b, arg02, arg12);
30278
- } finally {
30279
- state0.a = a;
30280
- }
30281
- }, "cb0");
30282
- const ret = new Promise(cb0);
30283
- return addHeapObject(ret);
30284
- } finally {
30285
- state0.a = state0.b = 0;
30286
- }
30287
- };
30288
- imports.wbg.__wbg_resolve_a9a87bdd64e9e62c = function(arg0) {
30289
- const ret = Promise.resolve(getObject(arg0));
30290
- return addHeapObject(ret);
30291
- };
30292
- imports.wbg.__wbg_then_ce526c837d07b68f = function(arg0, arg1) {
30293
- const ret = getObject(arg0).then(getObject(arg1));
30294
- return addHeapObject(ret);
30295
- };
30296
- imports.wbg.__wbg_then_842e65b843962f56 = function(arg0, arg1, arg2) {
30297
- const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
30298
- return addHeapObject(ret);
30299
- };
30300
- imports.wbg.__wbg_self_99737b4dcdf6f0d8 = function() {
30301
- return handleError(function() {
30302
- const ret = self.self;
30303
- return addHeapObject(ret);
30304
- }, arguments);
30305
- };
30306
- imports.wbg.__wbg_window_9b61fbbf3564c4fb = function() {
30307
- return handleError(function() {
30308
- const ret = window.window;
30309
- return addHeapObject(ret);
30310
- }, arguments);
30311
- };
30312
- imports.wbg.__wbg_globalThis_8e275ef40caea3a3 = function() {
30313
- return handleError(function() {
30314
- const ret = globalThis.globalThis;
30315
- return addHeapObject(ret);
30316
- }, arguments);
30317
- };
30318
- imports.wbg.__wbg_global_5de1e0f82bddcd27 = function() {
30319
- return handleError(function() {
30320
- const ret = global.global;
30321
- return addHeapObject(ret);
30322
- }, arguments);
30323
- };
30324
- imports.wbg.__wbg_buffer_7af23f65f6c64548 = function(arg0) {
30325
- const ret = getObject(arg0).buffer;
30326
- return addHeapObject(ret);
30327
- };
30328
- imports.wbg.__wbg_newwithbyteoffsetandlength_ce1e75f0ce5f7974 = function(arg0, arg1, arg2) {
30329
- const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
30330
- return addHeapObject(ret);
30331
- };
30332
- imports.wbg.__wbg_new_cc9018bd6f283b6f = function(arg0) {
30333
- const ret = new Uint8Array(getObject(arg0));
30334
- return addHeapObject(ret);
30335
- };
30336
- imports.wbg.__wbg_set_f25e869e4565d2a2 = function(arg0, arg1, arg2) {
30337
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
30338
- };
30339
- imports.wbg.__wbg_length_0acb1cf9bbaf8519 = function(arg0) {
30340
- const ret = getObject(arg0).length;
30341
- return ret;
30342
- };
30343
- imports.wbg.__wbg_newwithlength_8f0657faca9f1422 = function(arg0) {
30344
- const ret = new Uint8Array(arg0 >>> 0);
30345
- return addHeapObject(ret);
30346
- };
30347
- imports.wbg.__wbg_subarray_da527dbd24eafb6b = function(arg0, arg1, arg2) {
30348
- const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
30349
- return addHeapObject(ret);
30350
- };
30351
- imports.wbg.__wbg_has_ce995ec88636803d = function() {
30352
- return handleError(function(arg0, arg1) {
30353
- const ret = Reflect.has(getObject(arg0), getObject(arg1));
30354
- return ret;
30355
- }, arguments);
30356
- };
30357
- imports.wbg.__wbg_set_93b1c87ee2af852e = function() {
30358
- return handleError(function(arg0, arg1, arg2) {
30359
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
30360
- return ret;
30361
- }, arguments);
30362
- };
30363
- imports.wbg.__wbg_stringify_c760003feffcc1f2 = function() {
30364
- return handleError(function(arg0) {
30365
- const ret = JSON.stringify(getObject(arg0));
30366
- return addHeapObject(ret);
30367
- }, arguments);
30368
- };
30369
- imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
30370
- const ret = debugString(getObject(arg1));
30371
- const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
30372
- const len0 = WASM_VECTOR_LEN;
30373
- getInt32Memory0()[arg0 / 4 + 1] = len0;
30374
- getInt32Memory0()[arg0 / 4 + 0] = ptr0;
30375
- };
30376
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
30377
- throw new Error(getStringFromWasm0(arg0, arg1));
30378
- };
30379
- imports.wbg.__wbindgen_memory = function() {
30380
- const ret = wasm.memory;
30381
- return addHeapObject(ret);
30382
- };
30383
- imports.wbg.__wbindgen_closure_wrapper10902 = function(arg0, arg1, arg2) {
30384
- const ret = makeMutClosure(arg0, arg1, 3717, __wbg_adapter_24);
30385
- return addHeapObject(ret);
30386
- };
30387
- if (typeof input === "string" || typeof Request === "function" && input instanceof Request || typeof URL === "function" && input instanceof URL) {
30388
- input = fetch(input);
30389
- }
30390
- const { instance, module: module2 } = yield load(yield input, imports);
30391
- wasm = instance.exports;
30392
- init.__wbindgen_wasm_module = module2;
30393
- return wasm;
30394
- });
30395
- }
30396
- __name(init, "init");
30397
- var didkit_wasm_default = init;
30398
-
30399
- // src/didkit/index.ts
30400
- var initialized = false;
30401
- var init2 = /* @__PURE__ */ __name((arg = "https://cdn.filestackcontent.com/jXExSjNXSerFVDMIYOgy") => __async(void 0, null, function* () {
30402
- if (initialized)
30403
- return;
30404
- initialized = true;
30405
- return didkit_wasm_default(arg);
30406
- }), "init");
30407
- var didkit_default = init2;
30408
-
30409
- // src/wallet/base/crypto.ts
30410
- var import_isomorphic_webcrypto = __toESM(require("isomorphic-webcrypto"));
30411
- if (typeof window === "undefined")
30412
- globalThis.crypto = import_isomorphic_webcrypto.default;
30413
-
30414
- // src/wallet/base/wallet.ts
30415
- var addPluginToWallet = /* @__PURE__ */ __name((wallet, plugin) => __async(void 0, null, function* () {
30416
- return generateWallet(wallet.contents, {
30417
- plugins: [...wallet.plugins, plugin]
30418
- });
30419
- }), "addPluginToWallet");
30420
- var addToWallet = /* @__PURE__ */ __name((wallet, content) => __async(void 0, null, function* () {
30421
- return generateWallet([...wallet.contents, content], wallet);
30422
- }), "addToWallet");
30423
- var removeFromWallet = /* @__PURE__ */ __name((wallet, contentId) => __async(void 0, null, function* () {
30424
- const clonedContents = JSON.parse(JSON.stringify(wallet.contents));
30425
- const content = clonedContents.find((c) => c.id === contentId);
30426
- return generateWallet(clonedContents.filter((i) => i.id !== content.id), wallet);
30427
- }), "removeFromWallet");
30428
- var bindMethods = /* @__PURE__ */ __name((wallet, pluginMethods) => Object.fromEntries(Object.entries(pluginMethods).map(([key2, method]) => [key2, method.bind(wallet, wallet)])), "bindMethods");
30429
- var generateWallet = /* @__PURE__ */ __name((..._0) => __async(void 0, [..._0], function* (contents = [], _wallet = {}) {
30430
- const { plugins = [] } = _wallet;
30431
- const pluginMethods = plugins.reduce((cumulativePluginMethods, plugin) => {
30432
- const newPluginMethods = __spreadValues(__spreadValues({}, cumulativePluginMethods), plugin.pluginMethods);
30433
- return newPluginMethods;
30434
- }, {});
30435
- const wallet = {
30436
- contents: [...contents],
30437
- add: function(content) {
30438
- return addToWallet(this, content);
30439
- },
30440
- remove: function(contentId) {
30441
- return removeFromWallet(this, contentId);
30442
- },
30443
- status: "UNLOCKED" /* Unlocked */,
30444
- plugins,
30445
- pluginMethods,
30446
- addPlugin: function(plugin) {
30447
- return addPluginToWallet(this, plugin);
30448
- }
30449
- };
30450
- if (pluginMethods)
30451
- wallet.pluginMethods = bindMethods(wallet, pluginMethods);
30452
- return wallet;
30453
- }), "generateWallet");
30454
-
30455
- // ../../node_modules/.pnpm/did-resolver@3.2.2/node_modules/did-resolver/lib/resolver.module.js
30456
- function _catch(body, recover) {
30457
- try {
30458
- var result = body();
30459
- } catch (e) {
30460
- return recover(e);
30461
- }
30462
- if (result && result.then) {
30463
- return result.then(void 0, recover);
30464
- }
30465
- return result;
30466
- }
30467
- __name(_catch, "_catch");
30468
- function inMemoryCache() {
30469
- const cache = /* @__PURE__ */ new Map();
30470
- return function(parsed, resolve) {
30471
- try {
30472
- let _temp2 = function(_result) {
30473
- if (_exit)
30474
- return _result;
30475
- const cached = cache.get(parsed.didUrl);
30476
- return cached !== void 0 ? cached : Promise.resolve(resolve()).then(function(result) {
30477
- var _result$didResolution;
30478
- if (((_result$didResolution = result.didResolutionMetadata) == null ? void 0 : _result$didResolution.error) !== "notFound") {
30479
- cache.set(parsed.didUrl, result);
30480
- }
30481
- return result;
30482
- });
30483
- };
30484
- __name(_temp2, "_temp2");
30485
- let _exit;
30486
- const _temp = function() {
30487
- if (parsed.params && parsed.params["no-cache"] === "true") {
30488
- return Promise.resolve(resolve()).then(function(_await$resolve) {
30489
- _exit = 1;
30490
- return _await$resolve;
30491
- });
30492
- }
30493
- }();
30494
- return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
30495
- } catch (e) {
30496
- return Promise.reject(e);
30497
- }
30498
- };
30499
- }
30500
- __name(inMemoryCache, "inMemoryCache");
30501
- function noCache(parsed, resolve) {
30502
- return resolve();
30503
- }
30504
- __name(noCache, "noCache");
30505
- var PCT_ENCODED = "(?:%[0-9a-fA-F]{2})";
30506
- var ID_CHAR = `(?:[a-zA-Z0-9._-]|${PCT_ENCODED})`;
30507
- var METHOD = "([a-z0-9]+)";
30508
- var METHOD_ID = `((?:${ID_CHAR}*:)*(${ID_CHAR}+))`;
30509
- var PARAM_CHAR = "[a-zA-Z0-9_.:%-]";
30510
- var PARAM = `;${PARAM_CHAR}+=${PARAM_CHAR}*`;
30511
- var PARAMS = `((${PARAM})*)`;
30512
- var PATH = `(/[^#?]*)?`;
30513
- var QUERY = `([?][^#]*)?`;
30514
- var FRAGMENT = `(#.*)?`;
30515
- var DID_MATCHER = new RegExp(`^did:${METHOD}:${METHOD_ID}${PARAMS}${PATH}${QUERY}${FRAGMENT}$`);
30516
- function parse(didUrl) {
30517
- if (didUrl === "" || !didUrl)
30518
- return null;
30519
- const sections = didUrl.match(DID_MATCHER);
30520
- if (sections) {
30521
- const parts = {
30522
- did: `did:${sections[1]}:${sections[2]}`,
30523
- method: sections[1],
30524
- id: sections[2],
30525
- didUrl
30526
- };
30527
- if (sections[4]) {
30528
- const params = sections[4].slice(1).split(";");
30529
- parts.params = {};
30530
- for (const p of params) {
30531
- const kv = p.split("=");
30532
- parts.params[kv[0]] = kv[1];
30533
- }
30534
- }
30535
- if (sections[6])
30536
- parts.path = sections[6];
30537
- if (sections[7])
30538
- parts.query = sections[7].slice(1);
30539
- if (sections[8])
30540
- parts.fragment = sections[8].slice(1);
30541
- return parts;
30542
- }
30543
- return null;
30544
- }
30545
- __name(parse, "parse");
30546
- var EMPTY_RESULT = {
30547
- didResolutionMetadata: {},
30548
- didDocument: null,
30549
- didDocumentMetadata: {}
30550
- };
30551
- function wrapLegacyResolver(resolve) {
30552
- return function(did, parsed, resolver) {
30553
- try {
30554
- return Promise.resolve(_catch(function() {
30555
- return Promise.resolve(resolve(did, parsed, resolver)).then(function(doc) {
30556
- return __spreadProps(__spreadValues({}, EMPTY_RESULT), {
30557
- didResolutionMetadata: {
30558
- contentType: "application/did+ld+json"
30559
- },
30560
- didDocument: doc
30561
- });
30562
- });
30563
- }, function(e) {
30564
- return __spreadProps(__spreadValues({}, EMPTY_RESULT), {
30565
- didResolutionMetadata: {
30566
- error: "notFound",
30567
- message: e.toString()
30568
- }
30569
- });
30570
- }));
30571
- } catch (e) {
30572
- return Promise.reject(e);
30573
- }
30574
- };
30575
- }
30576
- __name(wrapLegacyResolver, "wrapLegacyResolver");
30577
- var Resolver = class {
30578
- constructor(registry2 = {}, options = {}) {
30579
- this.registry = void 0;
30580
- this.cache = void 0;
30581
- this.registry = registry2;
30582
- this.cache = options.cache === true ? inMemoryCache() : options.cache || noCache;
30583
- if (options.legacyResolvers) {
30584
- Object.keys(options.legacyResolvers).map((methodName) => {
30585
- if (!this.registry[methodName]) {
30586
- this.registry[methodName] = wrapLegacyResolver(options.legacyResolvers[methodName]);
30587
- }
30588
- });
30589
- }
30590
- }
30591
- resolve(didUrl, options = {}) {
30592
- try {
30593
- const _this = this;
30594
- const parsed = parse(didUrl);
30595
- if (parsed === null) {
30596
- return Promise.resolve(__spreadProps(__spreadValues({}, EMPTY_RESULT), {
30597
- didResolutionMetadata: {
30598
- error: "invalidDid"
30599
- }
30600
- }));
30601
- }
30602
- const resolver = _this.registry[parsed.method];
30603
- if (!resolver) {
30604
- return Promise.resolve(__spreadProps(__spreadValues({}, EMPTY_RESULT), {
30605
- didResolutionMetadata: {
30606
- error: "unsupportedDidMethod"
30607
- }
30608
- }));
30609
- }
30610
- return Promise.resolve(_this.cache(parsed, () => resolver(parsed.did, parsed, _this, options)));
30611
- } catch (e) {
30612
- return Promise.reject(e);
30613
- }
30614
- }
30615
- };
30616
- __name(Resolver, "Resolver");
30617
-
30618
- // ../../node_modules/.pnpm/uint8arrays@3.0.0/node_modules/uint8arrays/esm/src/index.js
30619
- init_concat();
30620
- init_from_string();
30621
- init_to_string();
30622
-
30623
- // ../../node_modules/.pnpm/did-jwt@5.9.0/node_modules/did-jwt/lib/index.module.js
30624
- init_basics();
30625
- var import_sha256 = __toESM(require_sha256());
30626
- var import_js_sha3 = __toESM(require_sha3());
30627
- var import_elliptic = __toESM(require_elliptic());
30628
- var import_ed25519 = __toESM(require_ed25519());
30629
- var import_canonicalize = __toESM(require_canonicalize());
30630
- var import_x25519 = __toESM(require_x25519());
30631
- var import_xchacha20poly1305 = __toESM(require_xchacha20poly1305());
30632
- var import_random = __toESM(require_random());
30633
- function bytesToBase64url(b) {
30634
- return toString3(b, "base64url");
30635
- }
30636
- __name(bytesToBase64url, "bytesToBase64url");
30637
- function base64ToBytes(s) {
30638
- const inputBase64Url = s.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
30639
- return fromString2(inputBase64Url, "base64url");
30640
- }
30641
- __name(base64ToBytes, "base64ToBytes");
30642
- function base58ToBytes(s) {
30643
- return fromString2(s, "base58btc");
30644
- }
30645
- __name(base58ToBytes, "base58ToBytes");
30646
- function hexToBytes(s) {
30647
- const input = s.startsWith("0x") ? s.substring(2) : s;
30648
- return fromString2(input.toLowerCase(), "base16");
30649
- }
30650
- __name(hexToBytes, "hexToBytes");
30651
- function encodeBase64url(s) {
30652
- return bytesToBase64url(fromString2(s));
30653
- }
30654
- __name(encodeBase64url, "encodeBase64url");
30655
- function decodeBase64url(s) {
30656
- return toString3(base64ToBytes(s));
30657
- }
30658
- __name(decodeBase64url, "decodeBase64url");
30659
- function bytesToHex(b) {
30660
- return toString3(b, "base16");
30661
- }
30662
- __name(bytesToHex, "bytesToHex");
30663
- function stringToBytes(s) {
30664
- return fromString2(s);
30008
+ __name(bytesToHex, "bytesToHex");
30009
+ function stringToBytes(s) {
30010
+ return fromString2(s);
30665
30011
  }
30666
30012
  __name(stringToBytes, "stringToBytes");
30667
30013
  function toJose({
@@ -32444,7 +31790,7 @@ function decodeString64(data, pos, _minor, options) {
32444
31790
  return toToken2(data, pos, 9, l, options);
32445
31791
  }
32446
31792
  __name(decodeString64, "decodeString64");
32447
- var encodeString2 = encodeBytes;
31793
+ var encodeString = encodeBytes;
32448
31794
 
32449
31795
  // ../../node_modules/.pnpm/cborg@1.9.4/node_modules/cborg/esm/lib/4array.js
32450
31796
  function toToken3(_data, _pos, prefix, length2) {
@@ -32924,7 +32270,7 @@ function makeCborEncoders() {
32924
32270
  encoders[Type.uint.major] = encodeUint;
32925
32271
  encoders[Type.negint.major] = encodeNegint;
32926
32272
  encoders[Type.bytes.major] = encodeBytes;
32927
- encoders[Type.string.major] = encodeString2;
32273
+ encoders[Type.string.major] = encodeString;
32928
32274
  encoders[Type.array.major] = encodeArray;
32929
32275
  encoders[Type.map.major] = encodeMap;
32930
32276
  encoders[Type.tag.major] = encodeTag;
@@ -36269,7 +35615,7 @@ function HmacDRBG(options) {
36269
35615
  }
36270
35616
  __name(HmacDRBG, "HmacDRBG");
36271
35617
  var hmacDrbg = HmacDRBG;
36272
- HmacDRBG.prototype._init = /* @__PURE__ */ __name(function init3(entropy, nonce, pers) {
35618
+ HmacDRBG.prototype._init = /* @__PURE__ */ __name(function init(entropy, nonce, pers) {
36273
35619
  var seed = entropy.concat(nonce).concat(pers);
36274
35620
  this.K = new Array(this.outLen / 8);
36275
35621
  this.V = new Array(this.outLen / 8);
@@ -43222,22 +42568,62 @@ var getIDXPlugin = /* @__PURE__ */ __name((_0, _1) => __async(void 0, [_0, _1],
43222
42568
  };
43223
42569
  }), "getIDXPlugin");
43224
42570
 
43225
- // src/wallet/plugins/didkey/index.ts
42571
+ // src/wallet/plugins/didkey/helpers.ts
42572
+ var ED25519_METHODS = ["key", "tz", "pkh:tz", "pkh:tezos", "pkh:sol", "pkh:solana"];
42573
+ var SECP256K1_METHODS = [
42574
+ "key",
42575
+ "tz",
42576
+ "ethr",
42577
+ "pkh:tz",
42578
+ "pkh:tezos",
42579
+ "pkh:eth",
42580
+ "pkh:celo",
42581
+ "pkh:poly",
42582
+ "pkh:btc",
42583
+ "pkh:doge",
42584
+ "pkh:eip155",
42585
+ "pkh:bip122"
42586
+ ];
43226
42587
  var isHex = /* @__PURE__ */ __name((str) => /^[0-9a-f]+$/i.test(str), "isHex");
43227
- var getDidKeyPlugin = /* @__PURE__ */ __name((key2) => __async(void 0, null, function* () {
42588
+ var getAlgorithmForDidMethod = /* @__PURE__ */ __name((didMethod) => {
42589
+ if (ED25519_METHODS.includes(didMethod))
42590
+ return "ed25519";
42591
+ if (SECP256K1_METHODS.includes(didMethod) || didMethod.startsWith("pkh:eip155:") || didMethod.startsWith("pkh:bip122:")) {
42592
+ return "secp256k1";
42593
+ }
42594
+ throw new Error("Unspported Did Method");
42595
+ }, "getAlgorithmForDidMethod");
42596
+
42597
+ // src/wallet/plugins/didkey/index.ts
42598
+ var getDidKeyPlugin = /* @__PURE__ */ __name((wallet, key2) => __async(void 0, null, function* () {
43228
42599
  if (key2.length === 0)
43229
42600
  throw new Error("Please don't use an empty string for a key!");
43230
42601
  if (!isHex(key2))
43231
42602
  throw new Error("Key must be a hexadecimal string!");
43232
42603
  if (key2.length > 64)
43233
42604
  throw new Error("Key must be less than 64 characters");
43234
- const keypair = JSON.parse(generateEd25519KeyFromBytes(toUint8Array(key2.padStart(64, "0"))));
43235
- const did = keyToDID("key", JSON.stringify(keypair));
42605
+ const seed = key2.padStart(64, "0");
42606
+ const seedBytes = toUint8Array(seed);
42607
+ const memoizedDids = {};
42608
+ const keyPairs = {
42609
+ ed25519: wallet.pluginMethods.generateEd25519KeyFromBytes(seedBytes),
42610
+ secp256k1: wallet.pluginMethods.generateSecp256k1KeyFromBytes(seedBytes)
42611
+ };
43236
42612
  return {
43237
42613
  pluginMethods: {
43238
- getSubjectDid: () => did,
43239
- getSubjectKeypair: () => keypair,
43240
- getKey: () => key2.padStart(64, "0")
42614
+ getSubjectDid: (_wallet, type) => {
42615
+ if (!memoizedDids[type]) {
42616
+ const algorithm = getAlgorithmForDidMethod(type);
42617
+ memoizedDids[type] = wallet.pluginMethods.keyToDid(type, keyPairs[algorithm]);
42618
+ }
42619
+ return memoizedDids[type];
42620
+ },
42621
+ getSubjectKeypair: (_wallet, type = "ed25519") => {
42622
+ if (!keyPairs[type])
42623
+ throw new Error("Unsupported algorithm");
42624
+ return keyPairs[type];
42625
+ },
42626
+ getKey: () => seed
43241
42627
  }
43242
42628
  };
43243
42629
  }), "getDidKeyPlugin");
@@ -43257,66 +42643,71 @@ var ExpirationPlugin = /* @__PURE__ */ __name((wallet) => ({
43257
42643
  }
43258
42644
  }), "ExpirationPlugin");
43259
42645
 
42646
+ // src/wallet/helpers/wallet.helpers.ts
42647
+ var recycleDependents = /* @__PURE__ */ __name((_methods) => ({}), "recycleDependents");
42648
+
43260
42649
  // src/wallet/plugins/vc/issueCredential.ts
43261
- var issueCredential2 = /* @__PURE__ */ __name((wallet, credential) => __async(void 0, null, function* () {
43262
- const _kp = wallet.pluginMethods.getSubjectKeypair();
43263
- if (!_kp)
43264
- throw new Error("Cannot issue credential: Could not get subject keypair");
43265
- const kp = JSON.stringify(_kp);
43266
- const options = JSON.stringify({
43267
- verificationMethod: yield keyToVerificationMethod("key", kp),
43268
- proofPurpose: "assertionMethod"
42650
+ var issueCredential = /* @__PURE__ */ __name((initWallet) => {
42651
+ return (wallet, credential) => __async(void 0, null, function* () {
42652
+ const kp = wallet.pluginMethods.getSubjectKeypair();
42653
+ if (!kp)
42654
+ throw new Error("Cannot issue credential: Could not get subject keypair");
42655
+ const options = {
42656
+ verificationMethod: yield initWallet.pluginMethods.keyToVerificationMethod("key", kp),
42657
+ proofPurpose: "assertionMethod"
42658
+ };
42659
+ return initWallet.pluginMethods.issueCredential(credential, options, kp);
43269
42660
  });
43270
- return JSON.parse(yield issueCredential(JSON.stringify(credential), options, kp));
43271
- }), "issueCredential");
42661
+ }, "issueCredential");
43272
42662
 
43273
42663
  // src/wallet/plugins/vc/verifyCredential.ts
43274
- var verifyCredential2 = /* @__PURE__ */ __name((credential) => __async(void 0, null, function* () {
43275
- return JSON.parse(yield verifyCredential(JSON.stringify(credential), "{}"));
43276
- }), "verifyCredential");
42664
+ var verifyCredential = /* @__PURE__ */ __name((initWallet) => {
42665
+ return (_wallet, credential) => __async(void 0, null, function* () {
42666
+ return initWallet.pluginMethods.verifyCredential(credential);
42667
+ });
42668
+ }, "verifyCredential");
43277
42669
 
43278
42670
  // src/wallet/plugins/vc/issuePresentation.ts
43279
- var issuePresentation2 = /* @__PURE__ */ __name((wallet, credential) => __async(void 0, null, function* () {
43280
- const did = wallet.pluginMethods.getSubjectDid();
43281
- if (!did)
43282
- throw new Error("Cannot create presentation: No holder key found");
43283
- const holder = did;
43284
- const _kp = wallet.pluginMethods.getSubjectKeypair();
43285
- if (!_kp)
43286
- throw new Error("Cannot issue credential: Could not get subject keypair");
43287
- const kp = JSON.stringify(_kp);
43288
- const options = JSON.stringify({
43289
- verificationMethod: yield keyToVerificationMethod("key", kp),
43290
- proofPurpose: "assertionMethod"
43291
- });
43292
- const presentation = JSON.stringify({
43293
- "@context": ["https://www.w3.org/2018/credentials/v1"],
43294
- type: ["VerifiablePresentation"],
43295
- holder,
43296
- verifiableCredential: credential
42671
+ var issuePresentation = /* @__PURE__ */ __name((initWallet) => {
42672
+ return (wallet, credential) => __async(void 0, null, function* () {
42673
+ const did = wallet.pluginMethods.getSubjectDid("key");
42674
+ if (!did)
42675
+ throw new Error("Cannot create presentation: No holder key found");
42676
+ const holder = did;
42677
+ const kp = wallet.pluginMethods.getSubjectKeypair();
42678
+ if (!kp)
42679
+ throw new Error("Cannot issue credential: Could not get subject keypair");
42680
+ const options = {
42681
+ verificationMethod: yield initWallet.pluginMethods.keyToVerificationMethod("key", kp),
42682
+ proofPurpose: "assertionMethod"
42683
+ };
42684
+ const presentation = {
42685
+ "@context": ["https://www.w3.org/2018/credentials/v1"],
42686
+ type: ["VerifiablePresentation"],
42687
+ holder,
42688
+ verifiableCredential: credential
42689
+ };
42690
+ return initWallet.pluginMethods.issuePresentation(presentation, options, kp);
43297
42691
  });
43298
- return JSON.parse(yield issuePresentation(presentation, options, kp));
43299
- }), "issuePresentation");
42692
+ }, "issuePresentation");
43300
42693
 
43301
42694
  // src/wallet/plugins/vc/verifyPresentation.ts
43302
- var verifyPresentation2 = /* @__PURE__ */ __name((presentation) => __async(void 0, null, function* () {
43303
- return JSON.parse(yield verifyPresentation(JSON.stringify(presentation), "{}"));
43304
- }), "verifyPresentation");
42695
+ var verifyPresentation = /* @__PURE__ */ __name((initWallet) => {
42696
+ return (_wallet, presentation) => __async(void 0, null, function* () {
42697
+ return initWallet.pluginMethods.verifyPresentation(presentation);
42698
+ });
42699
+ }, "verifyPresentation");
43305
42700
 
43306
42701
  // src/wallet/plugins/vc/vc.ts
43307
42702
  var getVCPlugin = /* @__PURE__ */ __name((wallet) => __async(void 0, null, function* () {
43308
42703
  return {
43309
- pluginMethods: __spreadProps(__spreadValues({}, wallet.pluginMethods), {
43310
- issueCredential: issueCredential2,
43311
- verifyCredential: (_wallet, credential) => __async(void 0, null, function* () {
43312
- return verifyCredential2(credential);
43313
- }),
43314
- issuePresentation: issuePresentation2,
43315
- verifyPresentation: (_wallet, presentation) => __async(void 0, null, function* () {
43316
- return verifyPresentation2(presentation);
43317
- }),
42704
+ pluginMethods: __spreadProps(__spreadValues({}, recycleDependents(wallet.pluginMethods)), {
42705
+ issueCredential: issueCredential(wallet),
42706
+ verifyCredential: verifyCredential(wallet),
42707
+ issuePresentation: issuePresentation(wallet),
42708
+ verifyPresentation: verifyPresentation(wallet),
43318
42709
  getTestVc: (_wallet, subject = "did:example:d23dd687a7dc6787646f2eb98d0") => {
43319
- const did = _wallet.pluginMethods.getSubjectDid();
42710
+ const did = _wallet.pluginMethods.getSubjectDid("key");
43320
42711
  return {
43321
42712
  "@context": ["https://www.w3.org/2018/credentials/v1"],
43322
42713
  id: "http://example.org/credentials/3731",
@@ -46359,6 +45750,11 @@ var UnsignedAchievementCredentialValidator = UnsignedVCValidator.extend({
46359
45750
  var AchievementCredentialValidator = UnsignedAchievementCredentialValidator.extend({
46360
45751
  proof: ProofValidator.or(ProofValidator.array())
46361
45752
  });
45753
+ var VerificationCheckValidator = mod.object({
45754
+ checks: mod.string().array(),
45755
+ warnings: mod.string().array(),
45756
+ errors: mod.string().array()
45757
+ });
46362
45758
  var VerificationStatusValidator = mod.enum(["Success", "Failed", "Error"]);
46363
45759
  var VerificationStatusEnum = VerificationStatusValidator.enum;
46364
45760
  var VerificationItemValidator = mod.object({
@@ -47556,449 +46952,1163 @@ var formatters2 = {
47556
46952
  context: "formatting"
47557
46953
  });
47558
46954
  }
47559
- },
47560
- B: function(date, token, localize2) {
47561
- var hours = date.getUTCHours();
47562
- var dayPeriodEnumValue;
47563
- if (hours >= 17) {
47564
- dayPeriodEnumValue = dayPeriodEnum.evening;
47565
- } else if (hours >= 12) {
47566
- dayPeriodEnumValue = dayPeriodEnum.afternoon;
47567
- } else if (hours >= 4) {
47568
- dayPeriodEnumValue = dayPeriodEnum.morning;
47569
- } else {
47570
- dayPeriodEnumValue = dayPeriodEnum.night;
46955
+ },
46956
+ B: function(date, token, localize2) {
46957
+ var hours = date.getUTCHours();
46958
+ var dayPeriodEnumValue;
46959
+ if (hours >= 17) {
46960
+ dayPeriodEnumValue = dayPeriodEnum.evening;
46961
+ } else if (hours >= 12) {
46962
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
46963
+ } else if (hours >= 4) {
46964
+ dayPeriodEnumValue = dayPeriodEnum.morning;
46965
+ } else {
46966
+ dayPeriodEnumValue = dayPeriodEnum.night;
46967
+ }
46968
+ switch (token) {
46969
+ case "B":
46970
+ case "BB":
46971
+ case "BBB":
46972
+ return localize2.dayPeriod(dayPeriodEnumValue, {
46973
+ width: "abbreviated",
46974
+ context: "formatting"
46975
+ });
46976
+ case "BBBBB":
46977
+ return localize2.dayPeriod(dayPeriodEnumValue, {
46978
+ width: "narrow",
46979
+ context: "formatting"
46980
+ });
46981
+ case "BBBB":
46982
+ default:
46983
+ return localize2.dayPeriod(dayPeriodEnumValue, {
46984
+ width: "wide",
46985
+ context: "formatting"
46986
+ });
46987
+ }
46988
+ },
46989
+ h: function(date, token, localize2) {
46990
+ if (token === "ho") {
46991
+ var hours = date.getUTCHours() % 12;
46992
+ if (hours === 0)
46993
+ hours = 12;
46994
+ return localize2.ordinalNumber(hours, {
46995
+ unit: "hour"
46996
+ });
46997
+ }
46998
+ return lightFormatters_default.h(date, token);
46999
+ },
47000
+ H: function(date, token, localize2) {
47001
+ if (token === "Ho") {
47002
+ return localize2.ordinalNumber(date.getUTCHours(), {
47003
+ unit: "hour"
47004
+ });
47005
+ }
47006
+ return lightFormatters_default.H(date, token);
47007
+ },
47008
+ K: function(date, token, localize2) {
47009
+ var hours = date.getUTCHours() % 12;
47010
+ if (token === "Ko") {
47011
+ return localize2.ordinalNumber(hours, {
47012
+ unit: "hour"
47013
+ });
47014
+ }
47015
+ return addLeadingZeros(hours, token.length);
47016
+ },
47017
+ k: function(date, token, localize2) {
47018
+ var hours = date.getUTCHours();
47019
+ if (hours === 0)
47020
+ hours = 24;
47021
+ if (token === "ko") {
47022
+ return localize2.ordinalNumber(hours, {
47023
+ unit: "hour"
47024
+ });
47025
+ }
47026
+ return addLeadingZeros(hours, token.length);
47027
+ },
47028
+ m: function(date, token, localize2) {
47029
+ if (token === "mo") {
47030
+ return localize2.ordinalNumber(date.getUTCMinutes(), {
47031
+ unit: "minute"
47032
+ });
47033
+ }
47034
+ return lightFormatters_default.m(date, token);
47035
+ },
47036
+ s: function(date, token, localize2) {
47037
+ if (token === "so") {
47038
+ return localize2.ordinalNumber(date.getUTCSeconds(), {
47039
+ unit: "second"
47040
+ });
47041
+ }
47042
+ return lightFormatters_default.s(date, token);
47043
+ },
47044
+ S: function(date, token) {
47045
+ return lightFormatters_default.S(date, token);
47046
+ },
47047
+ X: function(date, token, _localize, options) {
47048
+ var originalDate = options._originalDate || date;
47049
+ var timezoneOffset = originalDate.getTimezoneOffset();
47050
+ if (timezoneOffset === 0) {
47051
+ return "Z";
47052
+ }
47053
+ switch (token) {
47054
+ case "X":
47055
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
47056
+ case "XXXX":
47057
+ case "XX":
47058
+ return formatTimezone(timezoneOffset);
47059
+ case "XXXXX":
47060
+ case "XXX":
47061
+ default:
47062
+ return formatTimezone(timezoneOffset, ":");
47063
+ }
47064
+ },
47065
+ x: function(date, token, _localize, options) {
47066
+ var originalDate = options._originalDate || date;
47067
+ var timezoneOffset = originalDate.getTimezoneOffset();
47068
+ switch (token) {
47069
+ case "x":
47070
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
47071
+ case "xxxx":
47072
+ case "xx":
47073
+ return formatTimezone(timezoneOffset);
47074
+ case "xxxxx":
47075
+ case "xxx":
47076
+ default:
47077
+ return formatTimezone(timezoneOffset, ":");
47078
+ }
47079
+ },
47080
+ O: function(date, token, _localize, options) {
47081
+ var originalDate = options._originalDate || date;
47082
+ var timezoneOffset = originalDate.getTimezoneOffset();
47083
+ switch (token) {
47084
+ case "O":
47085
+ case "OO":
47086
+ case "OOO":
47087
+ return "GMT" + formatTimezoneShort(timezoneOffset, ":");
47088
+ case "OOOO":
47089
+ default:
47090
+ return "GMT" + formatTimezone(timezoneOffset, ":");
47091
+ }
47092
+ },
47093
+ z: function(date, token, _localize, options) {
47094
+ var originalDate = options._originalDate || date;
47095
+ var timezoneOffset = originalDate.getTimezoneOffset();
47096
+ switch (token) {
47097
+ case "z":
47098
+ case "zz":
47099
+ case "zzz":
47100
+ return "GMT" + formatTimezoneShort(timezoneOffset, ":");
47101
+ case "zzzz":
47102
+ default:
47103
+ return "GMT" + formatTimezone(timezoneOffset, ":");
47104
+ }
47105
+ },
47106
+ t: function(date, token, _localize, options) {
47107
+ var originalDate = options._originalDate || date;
47108
+ var timestamp = Math.floor(originalDate.getTime() / 1e3);
47109
+ return addLeadingZeros(timestamp, token.length);
47110
+ },
47111
+ T: function(date, token, _localize, options) {
47112
+ var originalDate = options._originalDate || date;
47113
+ var timestamp = originalDate.getTime();
47114
+ return addLeadingZeros(timestamp, token.length);
47115
+ }
47116
+ };
47117
+ function formatTimezoneShort(offset, dirtyDelimiter) {
47118
+ var sign5 = offset > 0 ? "-" : "+";
47119
+ var absOffset = Math.abs(offset);
47120
+ var hours = Math.floor(absOffset / 60);
47121
+ var minutes = absOffset % 60;
47122
+ if (minutes === 0) {
47123
+ return sign5 + String(hours);
47124
+ }
47125
+ var delimiter = dirtyDelimiter || "";
47126
+ return sign5 + String(hours) + delimiter + addLeadingZeros(minutes, 2);
47127
+ }
47128
+ __name(formatTimezoneShort, "formatTimezoneShort");
47129
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
47130
+ if (offset % 60 === 0) {
47131
+ var sign5 = offset > 0 ? "-" : "+";
47132
+ return sign5 + addLeadingZeros(Math.abs(offset) / 60, 2);
47133
+ }
47134
+ return formatTimezone(offset, dirtyDelimiter);
47135
+ }
47136
+ __name(formatTimezoneWithOptionalMinutes, "formatTimezoneWithOptionalMinutes");
47137
+ function formatTimezone(offset, dirtyDelimiter) {
47138
+ var delimiter = dirtyDelimiter || "";
47139
+ var sign5 = offset > 0 ? "-" : "+";
47140
+ var absOffset = Math.abs(offset);
47141
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
47142
+ var minutes = addLeadingZeros(absOffset % 60, 2);
47143
+ return sign5 + hours + delimiter + minutes;
47144
+ }
47145
+ __name(formatTimezone, "formatTimezone");
47146
+ var formatters_default = formatters2;
47147
+
47148
+ // ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/format/longFormatters/index.js
47149
+ function dateLongFormatter(pattern, formatLong2) {
47150
+ switch (pattern) {
47151
+ case "P":
47152
+ return formatLong2.date({
47153
+ width: "short"
47154
+ });
47155
+ case "PP":
47156
+ return formatLong2.date({
47157
+ width: "medium"
47158
+ });
47159
+ case "PPP":
47160
+ return formatLong2.date({
47161
+ width: "long"
47162
+ });
47163
+ case "PPPP":
47164
+ default:
47165
+ return formatLong2.date({
47166
+ width: "full"
47167
+ });
47168
+ }
47169
+ }
47170
+ __name(dateLongFormatter, "dateLongFormatter");
47171
+ function timeLongFormatter(pattern, formatLong2) {
47172
+ switch (pattern) {
47173
+ case "p":
47174
+ return formatLong2.time({
47175
+ width: "short"
47176
+ });
47177
+ case "pp":
47178
+ return formatLong2.time({
47179
+ width: "medium"
47180
+ });
47181
+ case "ppp":
47182
+ return formatLong2.time({
47183
+ width: "long"
47184
+ });
47185
+ case "pppp":
47186
+ default:
47187
+ return formatLong2.time({
47188
+ width: "full"
47189
+ });
47190
+ }
47191
+ }
47192
+ __name(timeLongFormatter, "timeLongFormatter");
47193
+ function dateTimeLongFormatter(pattern, formatLong2) {
47194
+ var matchResult = pattern.match(/(P+)(p+)?/) || [];
47195
+ var datePattern = matchResult[1];
47196
+ var timePattern = matchResult[2];
47197
+ if (!timePattern) {
47198
+ return dateLongFormatter(pattern, formatLong2);
47199
+ }
47200
+ var dateTimeFormat;
47201
+ switch (datePattern) {
47202
+ case "P":
47203
+ dateTimeFormat = formatLong2.dateTime({
47204
+ width: "short"
47205
+ });
47206
+ break;
47207
+ case "PP":
47208
+ dateTimeFormat = formatLong2.dateTime({
47209
+ width: "medium"
47210
+ });
47211
+ break;
47212
+ case "PPP":
47213
+ dateTimeFormat = formatLong2.dateTime({
47214
+ width: "long"
47215
+ });
47216
+ break;
47217
+ case "PPPP":
47218
+ default:
47219
+ dateTimeFormat = formatLong2.dateTime({
47220
+ width: "full"
47221
+ });
47222
+ break;
47223
+ }
47224
+ return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
47225
+ }
47226
+ __name(dateTimeLongFormatter, "dateTimeLongFormatter");
47227
+ var longFormatters = {
47228
+ p: timeLongFormatter,
47229
+ P: dateTimeLongFormatter
47230
+ };
47231
+ var longFormatters_default = longFormatters;
47232
+
47233
+ // ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/protectedTokens/index.js
47234
+ var protectedDayOfYearTokens = ["D", "DD"];
47235
+ var protectedWeekYearTokens = ["YY", "YYYY"];
47236
+ function isProtectedDayOfYearToken(token) {
47237
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
47238
+ }
47239
+ __name(isProtectedDayOfYearToken, "isProtectedDayOfYearToken");
47240
+ function isProtectedWeekYearToken(token) {
47241
+ return protectedWeekYearTokens.indexOf(token) !== -1;
47242
+ }
47243
+ __name(isProtectedWeekYearToken, "isProtectedWeekYearToken");
47244
+ function throwProtectedError(token, format2, input) {
47245
+ if (token === "YYYY") {
47246
+ throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
47247
+ } else if (token === "YY") {
47248
+ throw new RangeError("Use `yy` instead of `YY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
47249
+ } else if (token === "D") {
47250
+ 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"));
47251
+ } else if (token === "DD") {
47252
+ 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"));
47253
+ }
47254
+ }
47255
+ __name(throwProtectedError, "throwProtectedError");
47256
+
47257
+ // ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/format/index.js
47258
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
47259
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
47260
+ var escapedStringRegExp = /^'([^]*?)'?$/;
47261
+ var doubleQuoteRegExp = /''/g;
47262
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
47263
+ function format(dirtyDate, dirtyFormatStr, dirtyOptions) {
47264
+ requiredArgs(2, arguments);
47265
+ var formatStr = String(dirtyFormatStr);
47266
+ var options = dirtyOptions || {};
47267
+ var locale2 = options.locale || en_US_default;
47268
+ var localeFirstWeekContainsDate = locale2.options && locale2.options.firstWeekContainsDate;
47269
+ var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
47270
+ var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
47271
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
47272
+ throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");
47273
+ }
47274
+ var localeWeekStartsOn = locale2.options && locale2.options.weekStartsOn;
47275
+ var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
47276
+ var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn);
47277
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
47278
+ throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");
47279
+ }
47280
+ if (!locale2.localize) {
47281
+ throw new RangeError("locale must contain localize property");
47282
+ }
47283
+ if (!locale2.formatLong) {
47284
+ throw new RangeError("locale must contain formatLong property");
47285
+ }
47286
+ var originalDate = toDate(dirtyDate);
47287
+ if (!isValid2(originalDate)) {
47288
+ throw new RangeError("Invalid time value");
47289
+ }
47290
+ var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
47291
+ var utcDate = subMilliseconds(originalDate, timezoneOffset);
47292
+ var formatterOptions = {
47293
+ firstWeekContainsDate,
47294
+ weekStartsOn,
47295
+ locale: locale2,
47296
+ _originalDate: originalDate
47297
+ };
47298
+ var result = formatStr.match(longFormattingTokensRegExp).map(function(substring) {
47299
+ var firstCharacter = substring[0];
47300
+ if (firstCharacter === "p" || firstCharacter === "P") {
47301
+ var longFormatter = longFormatters_default[firstCharacter];
47302
+ return longFormatter(substring, locale2.formatLong, formatterOptions);
47303
+ }
47304
+ return substring;
47305
+ }).join("").match(formattingTokensRegExp).map(function(substring) {
47306
+ if (substring === "''") {
47307
+ return "'";
47571
47308
  }
47572
- switch (token) {
47573
- case "B":
47574
- case "BB":
47575
- case "BBB":
47576
- return localize2.dayPeriod(dayPeriodEnumValue, {
47577
- width: "abbreviated",
47578
- context: "formatting"
47579
- });
47580
- case "BBBBB":
47581
- return localize2.dayPeriod(dayPeriodEnumValue, {
47582
- width: "narrow",
47583
- context: "formatting"
47584
- });
47585
- case "BBBB":
47586
- default:
47587
- return localize2.dayPeriod(dayPeriodEnumValue, {
47588
- width: "wide",
47589
- context: "formatting"
47590
- });
47309
+ var firstCharacter = substring[0];
47310
+ if (firstCharacter === "'") {
47311
+ return cleanEscapedString(substring);
47591
47312
  }
47592
- },
47593
- h: function(date, token, localize2) {
47594
- if (token === "ho") {
47595
- var hours = date.getUTCHours() % 12;
47596
- if (hours === 0)
47597
- hours = 12;
47598
- return localize2.ordinalNumber(hours, {
47599
- unit: "hour"
47600
- });
47313
+ var formatter = formatters_default[firstCharacter];
47314
+ if (formatter) {
47315
+ if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
47316
+ throwProtectedError(substring, dirtyFormatStr, dirtyDate);
47317
+ }
47318
+ if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
47319
+ throwProtectedError(substring, dirtyFormatStr, dirtyDate);
47320
+ }
47321
+ return formatter(utcDate, substring, locale2.localize, formatterOptions);
47601
47322
  }
47602
- return lightFormatters_default.h(date, token);
47603
- },
47604
- H: function(date, token, localize2) {
47605
- if (token === "Ho") {
47606
- return localize2.ordinalNumber(date.getUTCHours(), {
47607
- unit: "hour"
47608
- });
47323
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
47324
+ throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
47609
47325
  }
47610
- return lightFormatters_default.H(date, token);
47611
- },
47612
- K: function(date, token, localize2) {
47613
- var hours = date.getUTCHours() % 12;
47614
- if (token === "Ko") {
47615
- return localize2.ordinalNumber(hours, {
47616
- unit: "hour"
47326
+ return substring;
47327
+ }).join("");
47328
+ return result;
47329
+ }
47330
+ __name(format, "format");
47331
+ function cleanEscapedString(input) {
47332
+ return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
47333
+ }
47334
+ __name(cleanEscapedString, "cleanEscapedString");
47335
+
47336
+ // src/wallet/verify.ts
47337
+ var transformErrorCheck = /* @__PURE__ */ __name((error, _credential) => {
47338
+ const prefix = error.split(" error")[0];
47339
+ return prefix || error;
47340
+ }, "transformErrorCheck");
47341
+ var transformErrorMessage = /* @__PURE__ */ __name((error, credential) => {
47342
+ if (error.startsWith("expiration")) {
47343
+ return credential.expirationDate ? `Invalid \u2022 Expired ${format(new Date(credential.expirationDate), "dd MMM yyyy").toUpperCase()}` : "Invalid \u2022 Expired";
47344
+ }
47345
+ return error;
47346
+ }, "transformErrorMessage");
47347
+ var transformCheckMessage = /* @__PURE__ */ __name((check, credential) => {
47348
+ return {
47349
+ proof: "Valid",
47350
+ expiration: credential.expirationDate ? `Valid \u2022 Expires ${format(new Date(credential.expirationDate), "dd MMM yyyy").toUpperCase()}` : "Valid \u2022 Does Not Expire"
47351
+ }[check] || check;
47352
+ }, "transformCheckMessage");
47353
+ var verifyCredential2 = /* @__PURE__ */ __name((wallet) => {
47354
+ return (credential) => __async(void 0, null, function* () {
47355
+ const rawVerificationCheck = yield wallet.pluginMethods.verifyCredential(credential);
47356
+ const verificationItems = [];
47357
+ rawVerificationCheck.errors.forEach((error) => {
47358
+ verificationItems.push({
47359
+ status: VerificationStatusEnum.Failed,
47360
+ check: transformErrorCheck(error, credential),
47361
+ details: transformErrorMessage(error, credential)
47617
47362
  });
47618
- }
47619
- return addLeadingZeros(hours, token.length);
47620
- },
47621
- k: function(date, token, localize2) {
47622
- var hours = date.getUTCHours();
47623
- if (hours === 0)
47624
- hours = 24;
47625
- if (token === "ko") {
47626
- return localize2.ordinalNumber(hours, {
47627
- unit: "hour"
47363
+ });
47364
+ rawVerificationCheck.warnings.forEach((warning) => {
47365
+ verificationItems.push({
47366
+ status: VerificationStatusEnum.Error,
47367
+ check: "hmm",
47368
+ message: warning
47628
47369
  });
47629
- }
47630
- return addLeadingZeros(hours, token.length);
47631
- },
47632
- m: function(date, token, localize2) {
47633
- if (token === "mo") {
47634
- return localize2.ordinalNumber(date.getUTCMinutes(), {
47635
- unit: "minute"
47370
+ });
47371
+ rawVerificationCheck.checks.forEach((check) => {
47372
+ verificationItems.push({
47373
+ status: VerificationStatusEnum.Success,
47374
+ check,
47375
+ message: transformCheckMessage(check, credential)
47636
47376
  });
47637
- }
47638
- return lightFormatters_default.m(date, token);
47377
+ });
47378
+ return verificationItems;
47379
+ });
47380
+ }, "verifyCredential");
47381
+
47382
+ // src/wallet/defaults.ts
47383
+ var defaultCeramicIDXArgs = {
47384
+ modelData: {
47385
+ definitions: {
47386
+ MyVerifiableCredentials: "kjzl6cwe1jw14am5tu5hh412s19o4zm8aq3g2lpd6s4paxj2nly2lj4drp3pun2"
47387
+ },
47388
+ schemas: {
47389
+ AchievementVerifiableCredential: "ceramic://k3y52l7qbv1frylibw2725v8gem3hxs1onoh6pvux0szdduugczh0hddxo6qsd6o0",
47390
+ VerifiableCredentialsList: "ceramic://k3y52l7qbv1frxkcwfpyauky3fyl4n44izridy3blvjjzgftis40sk9w8g3remghs"
47391
+ },
47392
+ tiles: {}
47639
47393
  },
47640
- s: function(date, token, localize2) {
47641
- if (token === "so") {
47642
- return localize2.ordinalNumber(date.getUTCSeconds(), {
47643
- unit: "second"
47644
- });
47394
+ credentialAlias: "MyVerifiableCredentials",
47395
+ ceramicEndpoint: "https://ceramic-node.welibrary.io:7007",
47396
+ defaultContentFamily: "SuperSkills"
47397
+ };
47398
+
47399
+ // src/didkit/pkg/didkit_wasm.js
47400
+ var wasm;
47401
+ var cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
47402
+ cachedTextDecoder.decode();
47403
+ var cachegetUint8Memory0 = null;
47404
+ function getUint8Memory0() {
47405
+ if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
47406
+ cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
47407
+ }
47408
+ return cachegetUint8Memory0;
47409
+ }
47410
+ __name(getUint8Memory0, "getUint8Memory0");
47411
+ function getStringFromWasm0(ptr, len) {
47412
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
47413
+ }
47414
+ __name(getStringFromWasm0, "getStringFromWasm0");
47415
+ var heap = new Array(32).fill(void 0);
47416
+ heap.push(void 0, null, true, false);
47417
+ var heap_next = heap.length;
47418
+ function addHeapObject(obj) {
47419
+ if (heap_next === heap.length)
47420
+ heap.push(heap.length + 1);
47421
+ const idx = heap_next;
47422
+ heap_next = heap[idx];
47423
+ heap[idx] = obj;
47424
+ return idx;
47425
+ }
47426
+ __name(addHeapObject, "addHeapObject");
47427
+ function getObject(idx) {
47428
+ return heap[idx];
47429
+ }
47430
+ __name(getObject, "getObject");
47431
+ function dropObject(idx) {
47432
+ if (idx < 36)
47433
+ return;
47434
+ heap[idx] = heap_next;
47435
+ heap_next = idx;
47436
+ }
47437
+ __name(dropObject, "dropObject");
47438
+ function takeObject(idx) {
47439
+ const ret = getObject(idx);
47440
+ dropObject(idx);
47441
+ return ret;
47442
+ }
47443
+ __name(takeObject, "takeObject");
47444
+ var WASM_VECTOR_LEN = 0;
47445
+ var cachedTextEncoder = new TextEncoder("utf-8");
47446
+ var encodeString2 = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
47447
+ return cachedTextEncoder.encodeInto(arg, view);
47448
+ } : function(arg, view) {
47449
+ const buf2 = cachedTextEncoder.encode(arg);
47450
+ view.set(buf2);
47451
+ return {
47452
+ read: arg.length,
47453
+ written: buf2.length
47454
+ };
47455
+ };
47456
+ function passStringToWasm0(arg, malloc, realloc) {
47457
+ if (realloc === void 0) {
47458
+ const buf2 = cachedTextEncoder.encode(arg);
47459
+ const ptr2 = malloc(buf2.length);
47460
+ getUint8Memory0().subarray(ptr2, ptr2 + buf2.length).set(buf2);
47461
+ WASM_VECTOR_LEN = buf2.length;
47462
+ return ptr2;
47463
+ }
47464
+ let len = arg.length;
47465
+ let ptr = malloc(len);
47466
+ const mem = getUint8Memory0();
47467
+ let offset = 0;
47468
+ for (; offset < len; offset++) {
47469
+ const code5 = arg.charCodeAt(offset);
47470
+ if (code5 > 127)
47471
+ break;
47472
+ mem[ptr + offset] = code5;
47473
+ }
47474
+ if (offset !== len) {
47475
+ if (offset !== 0) {
47476
+ arg = arg.slice(offset);
47645
47477
  }
47646
- return lightFormatters_default.s(date, token);
47647
- },
47648
- S: function(date, token) {
47649
- return lightFormatters_default.S(date, token);
47650
- },
47651
- X: function(date, token, _localize, options) {
47652
- var originalDate = options._originalDate || date;
47653
- var timezoneOffset = originalDate.getTimezoneOffset();
47654
- if (timezoneOffset === 0) {
47655
- return "Z";
47478
+ ptr = realloc(ptr, len, len = offset + arg.length * 3);
47479
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
47480
+ const ret = encodeString2(arg, view);
47481
+ offset += ret.written;
47482
+ }
47483
+ WASM_VECTOR_LEN = offset;
47484
+ return ptr;
47485
+ }
47486
+ __name(passStringToWasm0, "passStringToWasm0");
47487
+ function isLikeNone(x) {
47488
+ return x === void 0 || x === null;
47489
+ }
47490
+ __name(isLikeNone, "isLikeNone");
47491
+ var cachegetInt32Memory0 = null;
47492
+ function getInt32Memory0() {
47493
+ if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
47494
+ cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
47495
+ }
47496
+ return cachegetInt32Memory0;
47497
+ }
47498
+ __name(getInt32Memory0, "getInt32Memory0");
47499
+ function debugString(val) {
47500
+ const type = typeof val;
47501
+ if (type == "number" || type == "boolean" || val == null) {
47502
+ return `${val}`;
47503
+ }
47504
+ if (type == "string") {
47505
+ return `"${val}"`;
47506
+ }
47507
+ if (type == "symbol") {
47508
+ const description = val.description;
47509
+ if (description == null) {
47510
+ return "Symbol";
47511
+ } else {
47512
+ return `Symbol(${description})`;
47656
47513
  }
47657
- switch (token) {
47658
- case "X":
47659
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
47660
- case "XXXX":
47661
- case "XX":
47662
- return formatTimezone(timezoneOffset);
47663
- case "XXXXX":
47664
- case "XXX":
47665
- default:
47666
- return formatTimezone(timezoneOffset, ":");
47514
+ }
47515
+ if (type == "function") {
47516
+ const name5 = val.name;
47517
+ if (typeof name5 == "string" && name5.length > 0) {
47518
+ return `Function(${name5})`;
47519
+ } else {
47520
+ return "Function";
47667
47521
  }
47668
- },
47669
- x: function(date, token, _localize, options) {
47670
- var originalDate = options._originalDate || date;
47671
- var timezoneOffset = originalDate.getTimezoneOffset();
47672
- switch (token) {
47673
- case "x":
47674
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
47675
- case "xxxx":
47676
- case "xx":
47677
- return formatTimezone(timezoneOffset);
47678
- case "xxxxx":
47679
- case "xxx":
47680
- default:
47681
- return formatTimezone(timezoneOffset, ":");
47522
+ }
47523
+ if (Array.isArray(val)) {
47524
+ const length2 = val.length;
47525
+ let debug = "[";
47526
+ if (length2 > 0) {
47527
+ debug += debugString(val[0]);
47682
47528
  }
47683
- },
47684
- O: function(date, token, _localize, options) {
47685
- var originalDate = options._originalDate || date;
47686
- var timezoneOffset = originalDate.getTimezoneOffset();
47687
- switch (token) {
47688
- case "O":
47689
- case "OO":
47690
- case "OOO":
47691
- return "GMT" + formatTimezoneShort(timezoneOffset, ":");
47692
- case "OOOO":
47693
- default:
47694
- return "GMT" + formatTimezone(timezoneOffset, ":");
47529
+ for (let i = 1; i < length2; i++) {
47530
+ debug += ", " + debugString(val[i]);
47695
47531
  }
47696
- },
47697
- z: function(date, token, _localize, options) {
47698
- var originalDate = options._originalDate || date;
47699
- var timezoneOffset = originalDate.getTimezoneOffset();
47700
- switch (token) {
47701
- case "z":
47702
- case "zz":
47703
- case "zzz":
47704
- return "GMT" + formatTimezoneShort(timezoneOffset, ":");
47705
- case "zzzz":
47706
- default:
47707
- return "GMT" + formatTimezone(timezoneOffset, ":");
47532
+ debug += "]";
47533
+ return debug;
47534
+ }
47535
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
47536
+ let className;
47537
+ if (builtInMatches.length > 1) {
47538
+ className = builtInMatches[1];
47539
+ } else {
47540
+ return toString.call(val);
47541
+ }
47542
+ if (className == "Object") {
47543
+ try {
47544
+ return "Object(" + JSON.stringify(val) + ")";
47545
+ } catch (_) {
47546
+ return "Object";
47708
47547
  }
47709
- },
47710
- t: function(date, token, _localize, options) {
47711
- var originalDate = options._originalDate || date;
47712
- var timestamp = Math.floor(originalDate.getTime() / 1e3);
47713
- return addLeadingZeros(timestamp, token.length);
47714
- },
47715
- T: function(date, token, _localize, options) {
47716
- var originalDate = options._originalDate || date;
47717
- var timestamp = originalDate.getTime();
47718
- return addLeadingZeros(timestamp, token.length);
47719
47548
  }
47720
- };
47721
- function formatTimezoneShort(offset, dirtyDelimiter) {
47722
- var sign5 = offset > 0 ? "-" : "+";
47723
- var absOffset = Math.abs(offset);
47724
- var hours = Math.floor(absOffset / 60);
47725
- var minutes = absOffset % 60;
47726
- if (minutes === 0) {
47727
- return sign5 + String(hours);
47549
+ if (val instanceof Error) {
47550
+ return `${val.name}: ${val.message}
47551
+ ${val.stack}`;
47728
47552
  }
47729
- var delimiter = dirtyDelimiter || "";
47730
- return sign5 + String(hours) + delimiter + addLeadingZeros(minutes, 2);
47553
+ return className;
47731
47554
  }
47732
- __name(formatTimezoneShort, "formatTimezoneShort");
47733
- function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
47734
- if (offset % 60 === 0) {
47735
- var sign5 = offset > 0 ? "-" : "+";
47736
- return sign5 + addLeadingZeros(Math.abs(offset) / 60, 2);
47737
- }
47738
- return formatTimezone(offset, dirtyDelimiter);
47555
+ __name(debugString, "debugString");
47556
+ function makeMutClosure(arg0, arg1, dtor, f) {
47557
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
47558
+ const real = /* @__PURE__ */ __name((...args) => {
47559
+ state.cnt++;
47560
+ const a = state.a;
47561
+ state.a = 0;
47562
+ try {
47563
+ return f(a, state.b, ...args);
47564
+ } finally {
47565
+ if (--state.cnt === 0) {
47566
+ wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
47567
+ } else {
47568
+ state.a = a;
47569
+ }
47570
+ }
47571
+ }, "real");
47572
+ real.original = state;
47573
+ return real;
47739
47574
  }
47740
- __name(formatTimezoneWithOptionalMinutes, "formatTimezoneWithOptionalMinutes");
47741
- function formatTimezone(offset, dirtyDelimiter) {
47742
- var delimiter = dirtyDelimiter || "";
47743
- var sign5 = offset > 0 ? "-" : "+";
47744
- var absOffset = Math.abs(offset);
47745
- var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
47746
- var minutes = addLeadingZeros(absOffset % 60, 2);
47747
- return sign5 + hours + delimiter + minutes;
47575
+ __name(makeMutClosure, "makeMutClosure");
47576
+ function __wbg_adapter_24(arg0, arg1, arg2) {
47577
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h91a8814f66f14b17(arg0, arg1, addHeapObject(arg2));
47748
47578
  }
47749
- __name(formatTimezone, "formatTimezone");
47750
- var formatters_default = formatters2;
47751
-
47752
- // ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/format/longFormatters/index.js
47753
- function dateLongFormatter(pattern, formatLong2) {
47754
- switch (pattern) {
47755
- case "P":
47756
- return formatLong2.date({
47757
- width: "short"
47758
- });
47759
- case "PP":
47760
- return formatLong2.date({
47761
- width: "medium"
47762
- });
47763
- case "PPP":
47764
- return formatLong2.date({
47765
- width: "long"
47766
- });
47767
- case "PPPP":
47768
- default:
47769
- return formatLong2.date({
47770
- width: "full"
47771
- });
47772
- }
47579
+ __name(__wbg_adapter_24, "__wbg_adapter_24");
47580
+ function passArray8ToWasm0(arg, malloc) {
47581
+ const ptr = malloc(arg.length * 1);
47582
+ getUint8Memory0().set(arg, ptr / 1);
47583
+ WASM_VECTOR_LEN = arg.length;
47584
+ return ptr;
47773
47585
  }
47774
- __name(dateLongFormatter, "dateLongFormatter");
47775
- function timeLongFormatter(pattern, formatLong2) {
47776
- switch (pattern) {
47777
- case "p":
47778
- return formatLong2.time({
47779
- width: "short"
47780
- });
47781
- case "pp":
47782
- return formatLong2.time({
47783
- width: "medium"
47784
- });
47785
- case "ppp":
47786
- return formatLong2.time({
47787
- width: "long"
47788
- });
47789
- case "pppp":
47790
- default:
47791
- return formatLong2.time({
47792
- width: "full"
47793
- });
47586
+ __name(passArray8ToWasm0, "passArray8ToWasm0");
47587
+ function generateEd25519KeyFromBytes(bytes) {
47588
+ try {
47589
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
47590
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
47591
+ const len0 = WASM_VECTOR_LEN;
47592
+ wasm.generateEd25519KeyFromBytes(retptr, ptr0, len0);
47593
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
47594
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
47595
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
47596
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
47597
+ var ptr1 = r0;
47598
+ var len1 = r1;
47599
+ if (r3) {
47600
+ ptr1 = 0;
47601
+ len1 = 0;
47602
+ throw takeObject(r2);
47603
+ }
47604
+ return getStringFromWasm0(ptr1, len1);
47605
+ } finally {
47606
+ wasm.__wbindgen_add_to_stack_pointer(16);
47607
+ wasm.__wbindgen_free(ptr1, len1);
47794
47608
  }
47795
47609
  }
47796
- __name(timeLongFormatter, "timeLongFormatter");
47797
- function dateTimeLongFormatter(pattern, formatLong2) {
47798
- var matchResult = pattern.match(/(P+)(p+)?/) || [];
47799
- var datePattern = matchResult[1];
47800
- var timePattern = matchResult[2];
47801
- if (!timePattern) {
47802
- return dateLongFormatter(pattern, formatLong2);
47610
+ __name(generateEd25519KeyFromBytes, "generateEd25519KeyFromBytes");
47611
+ function generateSecp256k1KeyFromBytes(bytes) {
47612
+ try {
47613
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
47614
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
47615
+ const len0 = WASM_VECTOR_LEN;
47616
+ wasm.generateSecp256k1KeyFromBytes(retptr, ptr0, len0);
47617
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
47618
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
47619
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
47620
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
47621
+ var ptr1 = r0;
47622
+ var len1 = r1;
47623
+ if (r3) {
47624
+ ptr1 = 0;
47625
+ len1 = 0;
47626
+ throw takeObject(r2);
47627
+ }
47628
+ return getStringFromWasm0(ptr1, len1);
47629
+ } finally {
47630
+ wasm.__wbindgen_add_to_stack_pointer(16);
47631
+ wasm.__wbindgen_free(ptr1, len1);
47803
47632
  }
47804
- var dateTimeFormat;
47805
- switch (datePattern) {
47806
- case "P":
47807
- dateTimeFormat = formatLong2.dateTime({
47808
- width: "short"
47809
- });
47810
- break;
47811
- case "PP":
47812
- dateTimeFormat = formatLong2.dateTime({
47813
- width: "medium"
47814
- });
47815
- break;
47816
- case "PPP":
47817
- dateTimeFormat = formatLong2.dateTime({
47818
- width: "long"
47819
- });
47820
- break;
47821
- case "PPPP":
47822
- default:
47823
- dateTimeFormat = formatLong2.dateTime({
47824
- width: "full"
47825
- });
47826
- break;
47633
+ }
47634
+ __name(generateSecp256k1KeyFromBytes, "generateSecp256k1KeyFromBytes");
47635
+ function keyToDID(method_pattern, jwk) {
47636
+ try {
47637
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
47638
+ const ptr0 = passStringToWasm0(method_pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47639
+ const len0 = WASM_VECTOR_LEN;
47640
+ const ptr1 = passStringToWasm0(jwk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47641
+ const len1 = WASM_VECTOR_LEN;
47642
+ wasm.keyToDID(retptr, ptr0, len0, ptr1, len1);
47643
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
47644
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
47645
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
47646
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
47647
+ var ptr2 = r0;
47648
+ var len2 = r1;
47649
+ if (r3) {
47650
+ ptr2 = 0;
47651
+ len2 = 0;
47652
+ throw takeObject(r2);
47653
+ }
47654
+ return getStringFromWasm0(ptr2, len2);
47655
+ } finally {
47656
+ wasm.__wbindgen_add_to_stack_pointer(16);
47657
+ wasm.__wbindgen_free(ptr2, len2);
47827
47658
  }
47828
- return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
47829
47659
  }
47830
- __name(dateTimeLongFormatter, "dateTimeLongFormatter");
47831
- var longFormatters = {
47832
- p: timeLongFormatter,
47833
- P: dateTimeLongFormatter
47834
- };
47835
- var longFormatters_default = longFormatters;
47836
-
47837
- // ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/protectedTokens/index.js
47838
- var protectedDayOfYearTokens = ["D", "DD"];
47839
- var protectedWeekYearTokens = ["YY", "YYYY"];
47840
- function isProtectedDayOfYearToken(token) {
47841
- return protectedDayOfYearTokens.indexOf(token) !== -1;
47660
+ __name(keyToDID, "keyToDID");
47661
+ function keyToVerificationMethod(method_pattern, jwk) {
47662
+ const ptr0 = passStringToWasm0(method_pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47663
+ const len0 = WASM_VECTOR_LEN;
47664
+ const ptr1 = passStringToWasm0(jwk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47665
+ const len1 = WASM_VECTOR_LEN;
47666
+ const ret = wasm.keyToVerificationMethod(ptr0, len0, ptr1, len1);
47667
+ return takeObject(ret);
47842
47668
  }
47843
- __name(isProtectedDayOfYearToken, "isProtectedDayOfYearToken");
47844
- function isProtectedWeekYearToken(token) {
47845
- return protectedWeekYearTokens.indexOf(token) !== -1;
47669
+ __name(keyToVerificationMethod, "keyToVerificationMethod");
47670
+ function issueCredential2(credential, proof_options, key2) {
47671
+ const ptr0 = passStringToWasm0(credential, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47672
+ const len0 = WASM_VECTOR_LEN;
47673
+ const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47674
+ const len1 = WASM_VECTOR_LEN;
47675
+ const ptr2 = passStringToWasm0(key2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47676
+ const len2 = WASM_VECTOR_LEN;
47677
+ const ret = wasm.issueCredential(ptr0, len0, ptr1, len1, ptr2, len2);
47678
+ return takeObject(ret);
47679
+ }
47680
+ __name(issueCredential2, "issueCredential");
47681
+ function verifyCredential3(vc, proof_options) {
47682
+ const ptr0 = passStringToWasm0(vc, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47683
+ const len0 = WASM_VECTOR_LEN;
47684
+ const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47685
+ const len1 = WASM_VECTOR_LEN;
47686
+ const ret = wasm.verifyCredential(ptr0, len0, ptr1, len1);
47687
+ return takeObject(ret);
47688
+ }
47689
+ __name(verifyCredential3, "verifyCredential");
47690
+ function issuePresentation2(presentation, proof_options, key2) {
47691
+ const ptr0 = passStringToWasm0(presentation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47692
+ const len0 = WASM_VECTOR_LEN;
47693
+ const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47694
+ const len1 = WASM_VECTOR_LEN;
47695
+ const ptr2 = passStringToWasm0(key2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47696
+ const len2 = WASM_VECTOR_LEN;
47697
+ const ret = wasm.issuePresentation(ptr0, len0, ptr1, len1, ptr2, len2);
47698
+ return takeObject(ret);
47846
47699
  }
47847
- __name(isProtectedWeekYearToken, "isProtectedWeekYearToken");
47848
- function throwProtectedError(token, format2, input) {
47849
- if (token === "YYYY") {
47850
- throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
47851
- } else if (token === "YY") {
47852
- throw new RangeError("Use `yy` instead of `YY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
47853
- } else if (token === "D") {
47854
- 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"));
47855
- } else if (token === "DD") {
47856
- 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"));
47857
- }
47700
+ __name(issuePresentation2, "issuePresentation");
47701
+ function verifyPresentation2(vp, proof_options) {
47702
+ const ptr0 = passStringToWasm0(vp, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47703
+ const len0 = WASM_VECTOR_LEN;
47704
+ const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47705
+ const len1 = WASM_VECTOR_LEN;
47706
+ const ret = wasm.verifyPresentation(ptr0, len0, ptr1, len1);
47707
+ return takeObject(ret);
47858
47708
  }
47859
- __name(throwProtectedError, "throwProtectedError");
47860
-
47861
- // ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/format/index.js
47862
- var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
47863
- var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
47864
- var escapedStringRegExp = /^'([^]*?)'?$/;
47865
- var doubleQuoteRegExp = /''/g;
47866
- var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
47867
- function format(dirtyDate, dirtyFormatStr, dirtyOptions) {
47868
- requiredArgs(2, arguments);
47869
- var formatStr = String(dirtyFormatStr);
47870
- var options = dirtyOptions || {};
47871
- var locale2 = options.locale || en_US_default;
47872
- var localeFirstWeekContainsDate = locale2.options && locale2.options.firstWeekContainsDate;
47873
- var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
47874
- var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
47875
- if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
47876
- throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");
47877
- }
47878
- var localeWeekStartsOn = locale2.options && locale2.options.weekStartsOn;
47879
- var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
47880
- var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn);
47881
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
47882
- throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");
47883
- }
47884
- if (!locale2.localize) {
47885
- throw new RangeError("locale must contain localize property");
47886
- }
47887
- if (!locale2.formatLong) {
47888
- throw new RangeError("locale must contain formatLong property");
47889
- }
47890
- var originalDate = toDate(dirtyDate);
47891
- if (!isValid2(originalDate)) {
47892
- throw new RangeError("Invalid time value");
47709
+ __name(verifyPresentation2, "verifyPresentation");
47710
+ function handleError(f, args) {
47711
+ try {
47712
+ return f.apply(this, args);
47713
+ } catch (e) {
47714
+ wasm.__wbindgen_exn_store(addHeapObject(e));
47893
47715
  }
47894
- var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
47895
- var utcDate = subMilliseconds(originalDate, timezoneOffset);
47896
- var formatterOptions = {
47897
- firstWeekContainsDate,
47898
- weekStartsOn,
47899
- locale: locale2,
47900
- _originalDate: originalDate
47901
- };
47902
- var result = formatStr.match(longFormattingTokensRegExp).map(function(substring) {
47903
- var firstCharacter = substring[0];
47904
- if (firstCharacter === "p" || firstCharacter === "P") {
47905
- var longFormatter = longFormatters_default[firstCharacter];
47906
- return longFormatter(substring, locale2.formatLong, formatterOptions);
47907
- }
47908
- return substring;
47909
- }).join("").match(formattingTokensRegExp).map(function(substring) {
47910
- if (substring === "''") {
47911
- return "'";
47716
+ }
47717
+ __name(handleError, "handleError");
47718
+ function getArrayU8FromWasm0(ptr, len) {
47719
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
47720
+ }
47721
+ __name(getArrayU8FromWasm0, "getArrayU8FromWasm0");
47722
+ function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
47723
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h3ecfeb7a01c1be81(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
47724
+ }
47725
+ __name(__wbg_adapter_110, "__wbg_adapter_110");
47726
+ function load(module2, imports) {
47727
+ return __async(this, null, function* () {
47728
+ if (typeof Response === "function" && module2 instanceof Response) {
47729
+ if (typeof WebAssembly.instantiateStreaming === "function") {
47730
+ try {
47731
+ return yield WebAssembly.instantiateStreaming(module2, imports);
47732
+ } catch (e) {
47733
+ if (module2.headers.get("Content-Type") != "application/wasm") {
47734
+ 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);
47735
+ } else {
47736
+ throw e;
47737
+ }
47738
+ }
47739
+ }
47740
+ const bytes = yield module2.arrayBuffer();
47741
+ return yield WebAssembly.instantiate(bytes, imports);
47742
+ } else {
47743
+ const instance = yield WebAssembly.instantiate(module2, imports);
47744
+ if (instance instanceof WebAssembly.Instance) {
47745
+ return { instance, module: module2 };
47746
+ } else {
47747
+ return instance;
47748
+ }
47912
47749
  }
47913
- var firstCharacter = substring[0];
47914
- if (firstCharacter === "'") {
47915
- return cleanEscapedString(substring);
47750
+ });
47751
+ }
47752
+ __name(load, "load");
47753
+ function init2(input) {
47754
+ return __async(this, null, function* () {
47755
+ if (typeof input === "undefined") {
47916
47756
  }
47917
- var formatter = formatters_default[firstCharacter];
47918
- if (formatter) {
47919
- if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
47920
- throwProtectedError(substring, dirtyFormatStr, dirtyDate);
47757
+ const imports = {};
47758
+ imports.wbg = {};
47759
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
47760
+ const ret = getStringFromWasm0(arg0, arg1);
47761
+ return addHeapObject(ret);
47762
+ };
47763
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
47764
+ takeObject(arg0);
47765
+ };
47766
+ imports.wbg.__wbindgen_cb_drop = function(arg0) {
47767
+ const obj = takeObject(arg0).original;
47768
+ if (obj.cnt-- == 1) {
47769
+ obj.a = 0;
47770
+ return true;
47921
47771
  }
47922
- if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
47923
- throwProtectedError(substring, dirtyFormatStr, dirtyDate);
47772
+ const ret = false;
47773
+ return ret;
47774
+ };
47775
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
47776
+ const ret = getObject(arg0);
47777
+ return addHeapObject(ret);
47778
+ };
47779
+ imports.wbg.__wbg_fetch_811d43d6bdcad5b1 = function(arg0) {
47780
+ const ret = fetch(getObject(arg0));
47781
+ return addHeapObject(ret);
47782
+ };
47783
+ imports.wbg.__wbg_fetch_bf56e2a9f0644e3f = function(arg0, arg1) {
47784
+ const ret = getObject(arg0).fetch(getObject(arg1));
47785
+ return addHeapObject(ret);
47786
+ };
47787
+ imports.wbg.__wbg_new_89d7f088c1c45353 = function() {
47788
+ return handleError(function() {
47789
+ const ret = new Headers();
47790
+ return addHeapObject(ret);
47791
+ }, arguments);
47792
+ };
47793
+ imports.wbg.__wbg_append_f4f93bc73c45ee3e = function() {
47794
+ return handleError(function(arg0, arg1, arg2, arg3, arg4) {
47795
+ getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
47796
+ }, arguments);
47797
+ };
47798
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
47799
+ const obj = getObject(arg1);
47800
+ const ret = typeof obj === "string" ? obj : void 0;
47801
+ var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47802
+ var len0 = WASM_VECTOR_LEN;
47803
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
47804
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
47805
+ };
47806
+ imports.wbg.__wbg_instanceof_Response_ccfeb62399355bcd = function(arg0) {
47807
+ const ret = getObject(arg0) instanceof Response;
47808
+ return ret;
47809
+ };
47810
+ imports.wbg.__wbg_url_06c0f822d68d195c = function(arg0, arg1) {
47811
+ const ret = getObject(arg1).url;
47812
+ const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47813
+ const len0 = WASM_VECTOR_LEN;
47814
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
47815
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
47816
+ };
47817
+ imports.wbg.__wbg_status_600fd8b881393898 = function(arg0) {
47818
+ const ret = getObject(arg0).status;
47819
+ return ret;
47820
+ };
47821
+ imports.wbg.__wbg_headers_9e7f2c05a9b962ea = function(arg0) {
47822
+ const ret = getObject(arg0).headers;
47823
+ return addHeapObject(ret);
47824
+ };
47825
+ imports.wbg.__wbg_arrayBuffer_5a99283a3954c850 = function() {
47826
+ return handleError(function(arg0) {
47827
+ const ret = getObject(arg0).arrayBuffer();
47828
+ return addHeapObject(ret);
47829
+ }, arguments);
47830
+ };
47831
+ imports.wbg.__wbg_newwithstrandinit_fd99688f189f053e = function() {
47832
+ return handleError(function(arg0, arg1, arg2) {
47833
+ const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
47834
+ return addHeapObject(ret);
47835
+ }, arguments);
47836
+ };
47837
+ imports.wbg.__wbindgen_is_object = function(arg0) {
47838
+ const val = getObject(arg0);
47839
+ const ret = typeof val === "object" && val !== null;
47840
+ return ret;
47841
+ };
47842
+ imports.wbg.__wbg_self_86b4b13392c7af56 = function() {
47843
+ return handleError(function() {
47844
+ const ret = self.self;
47845
+ return addHeapObject(ret);
47846
+ }, arguments);
47847
+ };
47848
+ imports.wbg.__wbg_crypto_b8c92eaac23d0d80 = function(arg0) {
47849
+ const ret = getObject(arg0).crypto;
47850
+ return addHeapObject(ret);
47851
+ };
47852
+ imports.wbg.__wbg_msCrypto_9ad6677321a08dd8 = function(arg0) {
47853
+ const ret = getObject(arg0).msCrypto;
47854
+ return addHeapObject(ret);
47855
+ };
47856
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
47857
+ const ret = getObject(arg0) === void 0;
47858
+ return ret;
47859
+ };
47860
+ imports.wbg.__wbg_static_accessor_MODULE_452b4680e8614c81 = function() {
47861
+ const ret = module2;
47862
+ return addHeapObject(ret);
47863
+ };
47864
+ imports.wbg.__wbg_require_f5521a5b85ad2542 = function(arg0, arg1, arg2) {
47865
+ const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
47866
+ return addHeapObject(ret);
47867
+ };
47868
+ imports.wbg.__wbg_getRandomValues_dd27e6b0652b3236 = function(arg0) {
47869
+ const ret = getObject(arg0).getRandomValues;
47870
+ return addHeapObject(ret);
47871
+ };
47872
+ imports.wbg.__wbg_getRandomValues_e57c9b75ddead065 = function(arg0, arg1) {
47873
+ getObject(arg0).getRandomValues(getObject(arg1));
47874
+ };
47875
+ imports.wbg.__wbg_randomFillSync_d2ba53160aec6aba = function(arg0, arg1, arg2) {
47876
+ getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
47877
+ };
47878
+ imports.wbg.__wbindgen_is_function = function(arg0) {
47879
+ const ret = typeof getObject(arg0) === "function";
47880
+ return ret;
47881
+ };
47882
+ imports.wbg.__wbg_newnoargs_e23b458e372830de = function(arg0, arg1) {
47883
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
47884
+ return addHeapObject(ret);
47885
+ };
47886
+ imports.wbg.__wbg_next_cabb70b365520721 = function(arg0) {
47887
+ const ret = getObject(arg0).next;
47888
+ return addHeapObject(ret);
47889
+ };
47890
+ imports.wbg.__wbg_next_bf3d83fc18df496e = function() {
47891
+ return handleError(function(arg0) {
47892
+ const ret = getObject(arg0).next();
47893
+ return addHeapObject(ret);
47894
+ }, arguments);
47895
+ };
47896
+ imports.wbg.__wbg_done_040f966faa9a72b3 = function(arg0) {
47897
+ const ret = getObject(arg0).done;
47898
+ return ret;
47899
+ };
47900
+ imports.wbg.__wbg_value_419afbd9b9574c4c = function(arg0) {
47901
+ const ret = getObject(arg0).value;
47902
+ return addHeapObject(ret);
47903
+ };
47904
+ imports.wbg.__wbg_iterator_4832ef1f15b0382b = function() {
47905
+ const ret = Symbol.iterator;
47906
+ return addHeapObject(ret);
47907
+ };
47908
+ imports.wbg.__wbg_get_a9cab131e3152c49 = function() {
47909
+ return handleError(function(arg0, arg1) {
47910
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
47911
+ return addHeapObject(ret);
47912
+ }, arguments);
47913
+ };
47914
+ imports.wbg.__wbg_call_ae78342adc33730a = function() {
47915
+ return handleError(function(arg0, arg1) {
47916
+ const ret = getObject(arg0).call(getObject(arg1));
47917
+ return addHeapObject(ret);
47918
+ }, arguments);
47919
+ };
47920
+ imports.wbg.__wbg_new_36359baae5a47e27 = function() {
47921
+ const ret = new Object();
47922
+ return addHeapObject(ret);
47923
+ };
47924
+ imports.wbg.__wbg_call_3ed288a247f13ea5 = function() {
47925
+ return handleError(function(arg0, arg1, arg2) {
47926
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
47927
+ return addHeapObject(ret);
47928
+ }, arguments);
47929
+ };
47930
+ imports.wbg.__wbg_getTime_bffb1c09df09618b = function(arg0) {
47931
+ const ret = getObject(arg0).getTime();
47932
+ return ret;
47933
+ };
47934
+ imports.wbg.__wbg_new0_0ff7eb5c1486f3ec = function() {
47935
+ const ret = new Date();
47936
+ return addHeapObject(ret);
47937
+ };
47938
+ imports.wbg.__wbg_new_37705eed627d5ed9 = function(arg0, arg1) {
47939
+ try {
47940
+ var state0 = { a: arg0, b: arg1 };
47941
+ var cb0 = /* @__PURE__ */ __name((arg02, arg12) => {
47942
+ const a = state0.a;
47943
+ state0.a = 0;
47944
+ try {
47945
+ return __wbg_adapter_110(a, state0.b, arg02, arg12);
47946
+ } finally {
47947
+ state0.a = a;
47948
+ }
47949
+ }, "cb0");
47950
+ const ret = new Promise(cb0);
47951
+ return addHeapObject(ret);
47952
+ } finally {
47953
+ state0.a = state0.b = 0;
47924
47954
  }
47925
- return formatter(utcDate, substring, locale2.localize, formatterOptions);
47926
- }
47927
- if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
47928
- throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
47955
+ };
47956
+ imports.wbg.__wbg_resolve_a9a87bdd64e9e62c = function(arg0) {
47957
+ const ret = Promise.resolve(getObject(arg0));
47958
+ return addHeapObject(ret);
47959
+ };
47960
+ imports.wbg.__wbg_then_ce526c837d07b68f = function(arg0, arg1) {
47961
+ const ret = getObject(arg0).then(getObject(arg1));
47962
+ return addHeapObject(ret);
47963
+ };
47964
+ imports.wbg.__wbg_then_842e65b843962f56 = function(arg0, arg1, arg2) {
47965
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
47966
+ return addHeapObject(ret);
47967
+ };
47968
+ imports.wbg.__wbg_self_99737b4dcdf6f0d8 = function() {
47969
+ return handleError(function() {
47970
+ const ret = self.self;
47971
+ return addHeapObject(ret);
47972
+ }, arguments);
47973
+ };
47974
+ imports.wbg.__wbg_window_9b61fbbf3564c4fb = function() {
47975
+ return handleError(function() {
47976
+ const ret = window.window;
47977
+ return addHeapObject(ret);
47978
+ }, arguments);
47979
+ };
47980
+ imports.wbg.__wbg_globalThis_8e275ef40caea3a3 = function() {
47981
+ return handleError(function() {
47982
+ const ret = globalThis.globalThis;
47983
+ return addHeapObject(ret);
47984
+ }, arguments);
47985
+ };
47986
+ imports.wbg.__wbg_global_5de1e0f82bddcd27 = function() {
47987
+ return handleError(function() {
47988
+ const ret = global.global;
47989
+ return addHeapObject(ret);
47990
+ }, arguments);
47991
+ };
47992
+ imports.wbg.__wbg_buffer_7af23f65f6c64548 = function(arg0) {
47993
+ const ret = getObject(arg0).buffer;
47994
+ return addHeapObject(ret);
47995
+ };
47996
+ imports.wbg.__wbg_newwithbyteoffsetandlength_ce1e75f0ce5f7974 = function(arg0, arg1, arg2) {
47997
+ const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
47998
+ return addHeapObject(ret);
47999
+ };
48000
+ imports.wbg.__wbg_new_cc9018bd6f283b6f = function(arg0) {
48001
+ const ret = new Uint8Array(getObject(arg0));
48002
+ return addHeapObject(ret);
48003
+ };
48004
+ imports.wbg.__wbg_set_f25e869e4565d2a2 = function(arg0, arg1, arg2) {
48005
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
48006
+ };
48007
+ imports.wbg.__wbg_length_0acb1cf9bbaf8519 = function(arg0) {
48008
+ const ret = getObject(arg0).length;
48009
+ return ret;
48010
+ };
48011
+ imports.wbg.__wbg_newwithlength_8f0657faca9f1422 = function(arg0) {
48012
+ const ret = new Uint8Array(arg0 >>> 0);
48013
+ return addHeapObject(ret);
48014
+ };
48015
+ imports.wbg.__wbg_subarray_da527dbd24eafb6b = function(arg0, arg1, arg2) {
48016
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
48017
+ return addHeapObject(ret);
48018
+ };
48019
+ imports.wbg.__wbg_has_ce995ec88636803d = function() {
48020
+ return handleError(function(arg0, arg1) {
48021
+ const ret = Reflect.has(getObject(arg0), getObject(arg1));
48022
+ return ret;
48023
+ }, arguments);
48024
+ };
48025
+ imports.wbg.__wbg_set_93b1c87ee2af852e = function() {
48026
+ return handleError(function(arg0, arg1, arg2) {
48027
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
48028
+ return ret;
48029
+ }, arguments);
48030
+ };
48031
+ imports.wbg.__wbg_stringify_c760003feffcc1f2 = function() {
48032
+ return handleError(function(arg0) {
48033
+ const ret = JSON.stringify(getObject(arg0));
48034
+ return addHeapObject(ret);
48035
+ }, arguments);
48036
+ };
48037
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
48038
+ const ret = debugString(getObject(arg1));
48039
+ const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
48040
+ const len0 = WASM_VECTOR_LEN;
48041
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
48042
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
48043
+ };
48044
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
48045
+ throw new Error(getStringFromWasm0(arg0, arg1));
48046
+ };
48047
+ imports.wbg.__wbindgen_memory = function() {
48048
+ const ret = wasm.memory;
48049
+ return addHeapObject(ret);
48050
+ };
48051
+ imports.wbg.__wbindgen_closure_wrapper10913 = function(arg0, arg1, arg2) {
48052
+ const ret = makeMutClosure(arg0, arg1, 3725, __wbg_adapter_24);
48053
+ return addHeapObject(ret);
48054
+ };
48055
+ if (typeof input === "string" || typeof Request === "function" && input instanceof Request || typeof URL === "function" && input instanceof URL) {
48056
+ input = fetch(input);
47929
48057
  }
47930
- return substring;
47931
- }).join("");
47932
- return result;
47933
- }
47934
- __name(format, "format");
47935
- function cleanEscapedString(input) {
47936
- return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
48058
+ const { instance, module: module2 } = yield load(yield input, imports);
48059
+ wasm = instance.exports;
48060
+ init2.__wbindgen_wasm_module = module2;
48061
+ return wasm;
48062
+ });
47937
48063
  }
47938
- __name(cleanEscapedString, "cleanEscapedString");
48064
+ __name(init2, "init");
48065
+ var didkit_wasm_default = init2;
47939
48066
 
47940
- // src/wallet/verify.ts
47941
- var transformErrorCheck = /* @__PURE__ */ __name((error, _credential) => {
47942
- const prefix = error.split(" error")[0];
47943
- return prefix || error;
47944
- }, "transformErrorCheck");
47945
- var transformErrorMessage = /* @__PURE__ */ __name((error, credential) => {
47946
- if (error.startsWith("expiration")) {
47947
- return credential.expirationDate ? `Invalid \u2022 Expired ${format(new Date(credential.expirationDate), "dd MMM yyyy").toUpperCase()}` : "Invalid \u2022 Expired";
47948
- }
47949
- return error;
47950
- }, "transformErrorMessage");
47951
- var transformCheckMessage = /* @__PURE__ */ __name((check, credential) => {
47952
- return {
47953
- proof: "Valid",
47954
- expiration: credential.expirationDate ? `Valid \u2022 Expires ${format(new Date(credential.expirationDate), "dd MMM yyyy").toUpperCase()}` : "Valid \u2022 Does Not Expire"
47955
- }[check] || check;
47956
- }, "transformCheckMessage");
47957
- var verifyCredential3 = /* @__PURE__ */ __name((wallet) => {
47958
- return (credential) => __async(void 0, null, function* () {
47959
- const rawVerificationCheck = yield wallet.pluginMethods.verifyCredential(credential);
47960
- const verificationItems = [];
47961
- rawVerificationCheck.errors.forEach((error) => {
47962
- verificationItems.push({
47963
- status: VerificationStatusEnum.Failed,
47964
- check: transformErrorCheck(error, credential),
47965
- details: transformErrorMessage(error, credential)
47966
- });
47967
- });
47968
- rawVerificationCheck.warnings.forEach((warning) => {
47969
- verificationItems.push({
47970
- status: VerificationStatusEnum.Error,
47971
- check: "hmm",
47972
- message: warning
47973
- });
47974
- });
47975
- rawVerificationCheck.checks.forEach((check) => {
47976
- verificationItems.push({
47977
- status: VerificationStatusEnum.Success,
47978
- check,
47979
- message: transformCheckMessage(check, credential)
47980
- });
47981
- });
47982
- return verificationItems;
47983
- });
47984
- }, "verifyCredential");
48067
+ // src/didkit/index.ts
48068
+ var initialized = false;
48069
+ var init3 = /* @__PURE__ */ __name((arg = "https://cdn.filestackcontent.com/dlXanMvQCGDR76JXcBkA") => __async(void 0, null, function* () {
48070
+ if (initialized)
48071
+ return;
48072
+ initialized = true;
48073
+ return didkit_wasm_default(arg);
48074
+ }), "init");
48075
+ var didkit_default = init3;
47985
48076
 
47986
- // src/wallet/defaults.ts
47987
- var defaultCeramicIDXArgs = {
47988
- modelData: {
47989
- definitions: {
47990
- MyVerifiableCredentials: "kjzl6cwe1jw14am5tu5hh412s19o4zm8aq3g2lpd6s4paxj2nly2lj4drp3pun2"
47991
- },
47992
- schemas: {
47993
- AchievementVerifiableCredential: "ceramic://k3y52l7qbv1frylibw2725v8gem3hxs1onoh6pvux0szdduugczh0hddxo6qsd6o0",
47994
- VerifiableCredentialsList: "ceramic://k3y52l7qbv1frxkcwfpyauky3fyl4n44izridy3blvjjzgftis40sk9w8g3remghs"
47995
- },
47996
- tiles: {}
47997
- },
47998
- credentialAlias: "MyVerifiableCredentials",
47999
- ceramicEndpoint: "https://ceramic-node.welibrary.io:7007",
48000
- defaultContentFamily: "SuperSkills"
48001
- };
48077
+ // src/wallet/plugins/didkit/index.ts
48078
+ var getDidKitPlugin = /* @__PURE__ */ __name((input) => __async(void 0, null, function* () {
48079
+ yield didkit_default(input);
48080
+ const memoizedDids = {};
48081
+ return {
48082
+ pluginMethods: {
48083
+ generateEd25519KeyFromBytes: (_wallet, bytes) => JSON.parse(generateEd25519KeyFromBytes(bytes)),
48084
+ generateSecp256k1KeyFromBytes: (_wallet, bytes) => JSON.parse(generateSecp256k1KeyFromBytes(bytes)),
48085
+ keyToDid: (_wallet, type, keypair) => {
48086
+ const memoizedDid = memoizedDids[type];
48087
+ if (!memoizedDid) {
48088
+ const did = keyToDID(type, JSON.stringify(keypair));
48089
+ memoizedDids[type] = did;
48090
+ return did;
48091
+ }
48092
+ return memoizedDid;
48093
+ },
48094
+ keyToVerificationMethod: (_wallet, type, keypair) => __async(void 0, null, function* () {
48095
+ return keyToVerificationMethod(type, JSON.stringify(keypair));
48096
+ }),
48097
+ issueCredential: (_wallet, credential, options, keypair) => __async(void 0, null, function* () {
48098
+ return JSON.parse(yield issueCredential2(JSON.stringify(credential), JSON.stringify(options), JSON.stringify(keypair)));
48099
+ }),
48100
+ verifyCredential: (_wallet, credential) => __async(void 0, null, function* () {
48101
+ return JSON.parse(yield verifyCredential3(JSON.stringify(credential), "{}"));
48102
+ }),
48103
+ issuePresentation: (_wallet, presentation, options, keypair) => __async(void 0, null, function* () {
48104
+ return JSON.parse(yield issuePresentation2(JSON.stringify(presentation), JSON.stringify(options), JSON.stringify(keypair)));
48105
+ }),
48106
+ verifyPresentation: (_wallet, presentation) => __async(void 0, null, function* () {
48107
+ return JSON.parse(yield verifyPresentation2(JSON.stringify(presentation), "{}"));
48108
+ })
48109
+ }
48110
+ };
48111
+ }), "getDidKitPlugin");
48002
48112
 
48003
48113
  // src/wallet/init.ts
48004
48114
  var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async(void 0, [_0, ..._1], function* (key2, {
@@ -48006,21 +48116,17 @@ var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async(void 0, [_0, .
48006
48116
  didkit,
48007
48117
  defaultContents = []
48008
48118
  } = {}) {
48009
- yield didkit_default(didkit);
48010
- const didkeyWallet = yield (yield generateWallet(defaultContents)).addPlugin(yield getDidKeyPlugin(key2));
48119
+ const didkitWallet = yield (yield generateWallet(defaultContents)).addPlugin(yield getDidKitPlugin(didkit));
48120
+ const didkeyWallet = yield didkitWallet.addPlugin(yield getDidKeyPlugin(didkitWallet, key2));
48011
48121
  const didkeyAndVCWallet = yield didkeyWallet.addPlugin(yield getVCPlugin(didkeyWallet));
48012
48122
  const idxWallet = yield didkeyAndVCWallet.addPlugin(yield getIDXPlugin(didkeyAndVCWallet, ceramicIdx));
48013
48123
  const wallet = yield idxWallet.addPlugin(ExpirationPlugin(idxWallet));
48014
48124
  return {
48015
48125
  _wallet: wallet,
48016
- get did() {
48017
- return wallet.pluginMethods.getSubjectDid();
48018
- },
48019
- get keypair() {
48020
- return wallet.pluginMethods.getSubjectKeypair();
48021
- },
48126
+ did: (type = "key") => wallet.pluginMethods.getSubjectDid(type),
48127
+ keypair: (type = "ed25519") => wallet.pluginMethods.getSubjectKeypair(type),
48022
48128
  issueCredential: wallet.pluginMethods.issueCredential,
48023
- verifyCredential: verifyCredential3(wallet),
48129
+ verifyCredential: verifyCredential2(wallet),
48024
48130
  issuePresentation: wallet.pluginMethods.issuePresentation,
48025
48131
  verifyPresentation: wallet.pluginMethods.verifyPresentation,
48026
48132
  getCredential: wallet.pluginMethods.getVerifiableCredentialFromIndex,
@@ -48051,3 +48157,4 @@ var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async(void 0, [_0, .
48051
48157
  * @copyright Chen, Yi-Cyuan 2015-2018
48052
48158
  * @license MIT
48053
48159
  */
48160
+ //# sourceMappingURL=core.cjs.development.js.map