@learncard/react 2.3.6 → 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/{VCCard-37198c86.js → VCCard-5e260b6b.js} +76 -14
- package/dist/{esm/VCCard-27020ddd.js.map → cjs/VCCard-5e260b6b.js.map} +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index14.js +1 -1
- package/dist/cjs/index5.js +1 -1
- package/dist/esm/{VCCard-27020ddd.js → VCCard-d5bd0a82.js} +76 -14
- package/dist/{cjs/VCCard-37198c86.js.map → esm/VCCard-d5bd0a82.js.map} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index14.js +1 -1
- package/dist/esm/index5.js +1 -1
- package/package.json +2 -2
|
@@ -131917,7 +131917,30 @@ var getIDXPlugin = /* @__PURE__ */ __name((_0, _1) => __async$1(void 0, [_0, _1]
|
|
|
131917
131917
|
}
|
|
131918
131918
|
};
|
|
131919
131919
|
}), "getIDXPlugin");
|
|
131920
|
+
var ED25519_METHODS = ["key", "tz", "pkh:tz", "pkh:tezos", "pkh:sol", "pkh:solana"];
|
|
131921
|
+
var SECP256K1_METHODS = [
|
|
131922
|
+
"key",
|
|
131923
|
+
"tz",
|
|
131924
|
+
"ethr",
|
|
131925
|
+
"pkh:tz",
|
|
131926
|
+
"pkh:tezos",
|
|
131927
|
+
"pkh:eth",
|
|
131928
|
+
"pkh:celo",
|
|
131929
|
+
"pkh:poly",
|
|
131930
|
+
"pkh:btc",
|
|
131931
|
+
"pkh:doge",
|
|
131932
|
+
"pkh:eip155",
|
|
131933
|
+
"pkh:bip122"
|
|
131934
|
+
];
|
|
131920
131935
|
var isHex = /* @__PURE__ */ __name((str) => /^[0-9a-f]+$/i.test(str), "isHex");
|
|
131936
|
+
var getAlgorithmForDidMethod = /* @__PURE__ */ __name((didMethod) => {
|
|
131937
|
+
if (ED25519_METHODS.includes(didMethod))
|
|
131938
|
+
return "ed25519";
|
|
131939
|
+
if (SECP256K1_METHODS.includes(didMethod) || didMethod.startsWith("pkh:eip155:") || didMethod.startsWith("pkh:bip122:")) {
|
|
131940
|
+
return "secp256k1";
|
|
131941
|
+
}
|
|
131942
|
+
throw new Error("Unspported Did Method");
|
|
131943
|
+
}, "getAlgorithmForDidMethod");
|
|
131921
131944
|
var getDidKeyPlugin = /* @__PURE__ */ __name((wallet, key2) => __async$1(void 0, null, function* () {
|
|
131922
131945
|
if (key2.length === 0)
|
|
131923
131946
|
throw new Error("Please don't use an empty string for a key!");
|
|
@@ -131925,12 +131948,28 @@ var getDidKeyPlugin = /* @__PURE__ */ __name((wallet, key2) => __async$1(void 0,
|
|
|
131925
131948
|
throw new Error("Key must be a hexadecimal string!");
|
|
131926
131949
|
if (key2.length > 64)
|
|
131927
131950
|
throw new Error("Key must be less than 64 characters");
|
|
131928
|
-
const
|
|
131951
|
+
const seed = key2.padStart(64, "0");
|
|
131952
|
+
const seedBytes = toUint8Array(seed);
|
|
131953
|
+
const memoizedDids = {};
|
|
131954
|
+
const keyPairs = {
|
|
131955
|
+
ed25519: wallet.pluginMethods.generateEd25519KeyFromBytes(seedBytes),
|
|
131956
|
+
secp256k1: wallet.pluginMethods.generateSecp256k1KeyFromBytes(seedBytes)
|
|
131957
|
+
};
|
|
131929
131958
|
return {
|
|
131930
131959
|
pluginMethods: {
|
|
131931
|
-
getSubjectDid: (_wallet, type) =>
|
|
131932
|
-
|
|
131933
|
-
|
|
131960
|
+
getSubjectDid: (_wallet, type) => {
|
|
131961
|
+
if (!memoizedDids[type]) {
|
|
131962
|
+
const algorithm = getAlgorithmForDidMethod(type);
|
|
131963
|
+
memoizedDids[type] = wallet.pluginMethods.keyToDid(type, keyPairs[algorithm]);
|
|
131964
|
+
}
|
|
131965
|
+
return memoizedDids[type];
|
|
131966
|
+
},
|
|
131967
|
+
getSubjectKeypair: (_wallet, type = "ed25519") => {
|
|
131968
|
+
if (!keyPairs[type])
|
|
131969
|
+
throw new Error("Unsupported algorithm");
|
|
131970
|
+
return keyPairs[type];
|
|
131971
|
+
},
|
|
131972
|
+
getKey: () => seed
|
|
131934
131973
|
}
|
|
131935
131974
|
};
|
|
131936
131975
|
}), "getDidKeyPlugin");
|
|
@@ -136825,6 +136864,30 @@ function generateEd25519KeyFromBytes(bytes) {
|
|
|
136825
136864
|
}
|
|
136826
136865
|
}
|
|
136827
136866
|
__name(generateEd25519KeyFromBytes, "generateEd25519KeyFromBytes");
|
|
136867
|
+
function generateSecp256k1KeyFromBytes(bytes) {
|
|
136868
|
+
try {
|
|
136869
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
136870
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
136871
|
+
const len0 = WASM_VECTOR_LEN;
|
|
136872
|
+
wasm.generateSecp256k1KeyFromBytes(retptr, ptr0, len0);
|
|
136873
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
136874
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
136875
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
136876
|
+
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
136877
|
+
var ptr1 = r0;
|
|
136878
|
+
var len1 = r1;
|
|
136879
|
+
if (r3) {
|
|
136880
|
+
ptr1 = 0;
|
|
136881
|
+
len1 = 0;
|
|
136882
|
+
throw takeObject(r2);
|
|
136883
|
+
}
|
|
136884
|
+
return getStringFromWasm0(ptr1, len1);
|
|
136885
|
+
} finally {
|
|
136886
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
136887
|
+
wasm.__wbindgen_free(ptr1, len1);
|
|
136888
|
+
}
|
|
136889
|
+
}
|
|
136890
|
+
__name(generateSecp256k1KeyFromBytes, "generateSecp256k1KeyFromBytes");
|
|
136828
136891
|
function keyToDID(method_pattern, jwk) {
|
|
136829
136892
|
try {
|
|
136830
136893
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
@@ -136912,10 +136975,10 @@ function getArrayU8FromWasm0(ptr, len) {
|
|
|
136912
136975
|
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
136913
136976
|
}
|
|
136914
136977
|
__name(getArrayU8FromWasm0, "getArrayU8FromWasm0");
|
|
136915
|
-
function
|
|
136978
|
+
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
136916
136979
|
wasm.wasm_bindgen__convert__closures__invoke2_mut__h3ecfeb7a01c1be81(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
136917
136980
|
}
|
|
136918
|
-
__name(
|
|
136981
|
+
__name(__wbg_adapter_110, "__wbg_adapter_110");
|
|
136919
136982
|
function load(module, imports) {
|
|
136920
136983
|
return __async$1(this, null, function* () {
|
|
136921
136984
|
if (typeof Response === "function" && module instanceof Response) {
|
|
@@ -137133,7 +137196,7 @@ function init2(input) {
|
|
|
137133
137196
|
const a = state0.a;
|
|
137134
137197
|
state0.a = 0;
|
|
137135
137198
|
try {
|
|
137136
|
-
return
|
|
137199
|
+
return __wbg_adapter_110(a, state0.b, arg02, arg12);
|
|
137137
137200
|
} finally {
|
|
137138
137201
|
state0.a = a;
|
|
137139
137202
|
}
|
|
@@ -137239,8 +137302,8 @@ function init2(input) {
|
|
|
137239
137302
|
const ret = wasm.memory;
|
|
137240
137303
|
return addHeapObject(ret);
|
|
137241
137304
|
};
|
|
137242
|
-
imports.wbg.
|
|
137243
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
137305
|
+
imports.wbg.__wbindgen_closure_wrapper10913 = function(arg0, arg1, arg2) {
|
|
137306
|
+
const ret = makeMutClosure(arg0, arg1, 3725, __wbg_adapter_24);
|
|
137244
137307
|
return addHeapObject(ret);
|
|
137245
137308
|
};
|
|
137246
137309
|
if (typeof input === "string" || typeof Request === "function" && input instanceof Request || typeof URL === "function" && input instanceof URL) {
|
|
@@ -137255,7 +137318,7 @@ function init2(input) {
|
|
|
137255
137318
|
__name(init2, "init");
|
|
137256
137319
|
var didkit_wasm_default = init2;
|
|
137257
137320
|
var initialized = false;
|
|
137258
|
-
var init3 = /* @__PURE__ */ __name((arg = "https://cdn.filestackcontent.com/
|
|
137321
|
+
var init3 = /* @__PURE__ */ __name((arg = "https://cdn.filestackcontent.com/dlXanMvQCGDR76JXcBkA") => __async$1(void 0, null, function* () {
|
|
137259
137322
|
if (initialized)
|
|
137260
137323
|
return;
|
|
137261
137324
|
initialized = true;
|
|
@@ -137268,6 +137331,7 @@ var getDidKitPlugin = /* @__PURE__ */ __name((input) => __async$1(void 0, null,
|
|
|
137268
137331
|
return {
|
|
137269
137332
|
pluginMethods: {
|
|
137270
137333
|
generateEd25519KeyFromBytes: (_wallet, bytes) => JSON.parse(generateEd25519KeyFromBytes(bytes)),
|
|
137334
|
+
generateSecp256k1KeyFromBytes: (_wallet, bytes) => JSON.parse(generateSecp256k1KeyFromBytes(bytes)),
|
|
137271
137335
|
keyToDid: (_wallet, type, keypair) => {
|
|
137272
137336
|
const memoizedDid = memoizedDids[type];
|
|
137273
137337
|
if (!memoizedDid) {
|
|
@@ -137308,9 +137372,7 @@ var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async$1(void 0, [_0,
|
|
|
137308
137372
|
return {
|
|
137309
137373
|
_wallet: wallet,
|
|
137310
137374
|
did: (type = "key") => wallet.pluginMethods.getSubjectDid(type),
|
|
137311
|
-
|
|
137312
|
-
return wallet.pluginMethods.getSubjectKeypair();
|
|
137313
|
-
},
|
|
137375
|
+
keypair: (type = "ed25519") => wallet.pluginMethods.getSubjectKeypair(type),
|
|
137314
137376
|
issueCredential: wallet.pluginMethods.issueCredential,
|
|
137315
137377
|
verifyCredential: verifyCredential2(wallet),
|
|
137316
137378
|
issuePresentation: wallet.pluginMethods.issuePresentation,
|
|
@@ -137386,4 +137448,4 @@ const VCCard = ({ credential, issueeOverride, className = "" }) => {
|
|
|
137386
137448
|
};
|
|
137387
137449
|
|
|
137388
137450
|
exports.VCCard = VCCard;
|
|
137389
|
-
//# sourceMappingURL=VCCard-
|
|
137451
|
+
//# sourceMappingURL=VCCard-5e260b6b.js.map
|