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