=> {
- if (coreKitInstance.keyType === "secp256k1") {
- const [precomputedTssClient, precomputedTssClient2] = await Promise.all([coreKitInstance.precompute_secp256k1(), coreKitInstance.precompute_secp256k1()]);
+ if (coreKitInstance.current.keyType === "secp256k1") {
+ const [precomputedTssClient, precomputedTssClient2] = await Promise.all([coreKitInstance.current.precompute_secp256k1(), coreKitInstance.current.precompute_secp256k1()]);
const msg = Buffer.from("hello signer!");
- const sig = await coreKitInstance.sign(msg, false, precomputedTssClient);
+ const sig = await coreKitInstance.current.sign(msg, { secp256k1Precompute: precomputedTssClient });
const msg2 = Buffer.from("hello signer2!");
- const sig2 = await coreKitInstance.sign(msg2, false, precomputedTssClient2);
+ const sig2 = await coreKitInstance.current.sign(msg2, { secp256k1Precompute: precomputedTssClient2 });
uiConsole("Sig1: ", sig.toString("hex"), "Sig2: ", sig2.toString("hex"));
- } else if (coreKitInstance.keyType === "ed25519") {
- const msg = Buffer.from("hello signer!");
- const sig = await coreKitInstance.sign(msg);
- uiConsole(sig.toString("hex"));
+ } else {
+ throw new Error("Not supported for this key type");
}
};
const switchChainSepolia = async () => {
@@ -428,7 +481,7 @@ function App() {
logo: "https://cryptologos.cc/logos/ethereum-eth-logo.png",
};
- if (coreKitInstance.status === COREKIT_STATUS.LOGGED_IN) {
+ if (coreKitInstance.current.status === COREKIT_STATUS.LOGGED_IN) {
await setupProvider(newChainConfig);
}
uiConsole("Changed to Sepolia Network");
@@ -450,7 +503,7 @@ function App() {
ticker: "MATIC",
tickerName: "MATIC",
};
- if (coreKitInstance.status === COREKIT_STATUS.LOGGED_IN) {
+ if (coreKitInstance.current.status === COREKIT_STATUS.LOGGED_IN) {
await setupProvider(newChainConfig);
}
uiConsole("Changed to Sepolia Network");
@@ -496,8 +549,8 @@ function App() {
// if (selectedNetwork === WEB3AUTH_NETWORK.MAINNET) {
// throw new Error("reset account is not recommended on mainnet");
// }
- await coreKitInstance.tKey.storageLayer.setMetadata({
- privKey: new BN(coreKitInstance.state.postBoxKey!, "hex"),
+ await coreKitInstance.current.tKey.storageLayer.setMetadata({
+ privKey: new BN(coreKitInstance.current.state.postBoxKey!, "hex"),
input: { message: "KEY_NOT_FOUND" },
});
uiConsole("reset");
@@ -512,7 +565,7 @@ function App() {
const fromAddress = (await web3.eth.getAccounts())[0];
const destination = "0x2E464670992574A613f10F7682D5057fB507Cc21";
- const amount = web3.utils.toWei("0.0001"); // Convert 1 ether to wei
+ const amount = web3.utils.toWei("0.0001", "ether"); // Convert 1 ether to wei
// Submit transaction to the blockchain and wait for it to be mined
uiConsole("Sending transaction...");
@@ -528,9 +581,9 @@ function App() {
if (!coreKitInstance) {
throw new Error("coreKitInstance is not set");
}
- await securityQuestion.setSecurityQuestion({ mpcCoreKit: coreKitInstance, question, answer, shareType: TssShareType.RECOVERY });
+ await securityQuestion.setSecurityQuestion({ mpcCoreKit: coreKitInstance.current, question, answer, shareType: TssShareType.RECOVERY });
setNewQuestion(undefined);
- let result = await securityQuestion.getQuestion(coreKitInstance);
+ let result = await securityQuestion.getQuestion(coreKitInstance.current);
if (result) {
setQuestion(question);
}
@@ -540,8 +593,8 @@ function App() {
if (!coreKitInstance) {
throw new Error("coreKitInstance is not set");
}
- await securityQuestion.changeSecurityQuestion({ mpcCoreKit: coreKitInstance, newQuestion, newAnswer, answer });
- let result = await securityQuestion.getQuestion(coreKitInstance);
+ await securityQuestion.changeSecurityQuestion({ mpcCoreKit: coreKitInstance.current, newQuestion, newAnswer, answer });
+ let result = await securityQuestion.getQuestion(coreKitInstance.current);
if (result) {
setQuestion(question);
}
@@ -551,7 +604,7 @@ function App() {
if (!coreKitInstance) {
throw new Error("coreKitInstance is not set");
}
- await securityQuestion.deleteSecurityQuestion(coreKitInstance);
+ await securityQuestion.deleteSecurityQuestion(coreKitInstance.current);
setQuestion(undefined);
};
@@ -559,19 +612,125 @@ function App() {
if (!coreKitInstance) {
throw new Error("coreKitInstance is not set");
}
- const factorKey = await coreKitInstance.enableMFA({});
+ const factorKey = await coreKitInstance.current.enableMFA({});
const factorKeyMnemonic = await keyToMnemonic(factorKey);
uiConsole("MFA enabled, device factor stored in local store, deleted hashed cloud key, your backup factor key: ", factorKeyMnemonic);
};
+ const registerPasskey = async () => {
+ if (!coreKitInstance) {
+ throw new Error("coreKitInstance is not set");
+ }
+ if (!passkeyPlugin?.current) {
+ throw new Error("passkeyPlugin is not set");
+ }
+ const result = shouldSupportPasskey();
+ if (!result.isBrowserSupported) {
+ uiConsole("Browser not supported");
+ return;
+ }
+ await passkeyPlugin.current.registerPasskey()
+ };
+ const loginWithPasskey = async () => {
+ if (!coreKitInstance) {
+ throw new Error("coreKitInstance is not set");
+ }
+ if (!passkeyPlugin?.current) {
+ throw new Error("passkeyPlugin is not set");
+ }
+ const result = shouldSupportPasskey();
+ if (!result.isBrowserSupported) {
+ uiConsole("Browser not supported");
+ return;
+ }
+ await passkeyPlugin.current.authenticateWithPasskey()
+ if (coreKitInstance.current.status === COREKIT_STATUS.LOGGED_IN) {
+ await setupProvider();
+ }
+ setCoreKitStatus(coreKitInstance.current.status);
+ };
+ const listPasskeys = async () => {
+ if (!coreKitInstance) {
+ throw new Error("coreKitInstance is not set");
+ }
+ if (!passkeyPlugin?.current) {
+ throw new Error("passkeyPlugin is not set");
+ }
+ const passkeys = await passkeyPlugin.current.listPasskeys()
+ uiConsole(passkeys)
+ };
+ const enableStrictPasskey = async () => {
+ if (!coreKitInstance) {
+ throw new Error("coreKitInstance is not set");
+ }
+ if (!passkeyPlugin?.current) {
+ throw new Error("passkeyPlugin is not set");
+ }
+ const result = shouldSupportPasskey();
+ if (!result.isBrowserSupported) {
+ uiConsole("Browser not supported");
+ return;
+ }
+ await passkeyPlugin.current.enableStrictPasskeyAuth()
+ uiConsole("Strict Passkey Auth Enabled")
+ };
+ const disableStrictPasskey = async () => {
+ if (!passkeyPlugin?.current) {
+ throw new Error("passkeyPlugin not found");
+ }
+ const isEnabled = await passkeyPlugin.current.isStrictPasskeyEnabled()
+ if (!isEnabled) {
+ uiConsole("Strict Passkey Auth is not enabled")
+ return
+ }
+ if (!coreKitInstance) {
+ throw new Error("coreKitInstance is not set");
+ }
+ if (!passkeyPlugin?.current) {
+ throw new Error("passkeyPlugin is not set");
+ }
+ const result = shouldSupportPasskey();
+ if (!result.isBrowserSupported) {
+ uiConsole("Browser not supported");
+ return;
+ }
+ await passkeyPlugin.current.disableStrictPasskeyAuth()
+ uiConsole("Strict Passkey Auth Disabled")
+ };
const commit = async () => {
if (!coreKitInstance) {
throw new Error("coreKitInstance is not set");
}
- await coreKitInstance.commitChanges();
+ await coreKitInstance.current.commitChanges();
};
+ const tssLibSelector = (
+
+
+
+
+ );
+
const loggedInView = (
<>
Account Details
@@ -580,7 +739,7 @@ function App() {
Get User Info
-
- uiConsole(await coreKitInstance._UNSAFE_exportTssKey())} className="card">
+ uiConsole(await coreKitInstance.current._UNSAFE_exportTssKey())} className="card">
[CAUTION] Export TSS Private Key
@@ -617,6 +776,22 @@ function App() {
Enable MFA
+
+ Register Passkey
+
+
+ Register Passkey
+
+
+ List Passkeys
+
+
+ Enable Transaction MFA with Passkey
+
+
+ Disable Transaction MFA with Passkey
+
+
Manual Factors Manipulation
@@ -701,8 +876,12 @@ function App() {
Sign Message
+
+ Sign with Key Tweak
+
+
- Sign Msgwith precomputed TSS
+ Sign with precomputed TSS
@@ -730,11 +909,16 @@ function App() {
const unloggedInView = (
<>
+ {tssLibSelector}
setMockEmail(e.target.value)}>
loginWithMock()} className="card">
MockLogin
+
+ Login with Passkey
+
+
login()} className="card">
Login
diff --git a/demo/redirect-flow-example/src/index.tsx b/demo/redirect-flow-example/src/index.tsx
index c333ebd2..0b480ef8 100644
--- a/demo/redirect-flow-example/src/index.tsx
+++ b/demo/redirect-flow-example/src/index.tsx
@@ -7,7 +7,5 @@ import App from "./App";
const root = ReactDOM.createRoot(document.getElementById("root") as HTMLElement);
root.render(
-
-
-
+
);
diff --git a/package-lock.json b/package-lock.json
index 42818c30..d2fa201f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@web3auth/mpc-core-kit",
- "version": "3.2.7",
+ "version": "4.1.7-alpha.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@web3auth/mpc-core-kit",
- "version": "3.2.7",
+ "version": "4.1.7-alpha.0",
"license": "ISC",
"dependencies": {
"@tkey/common-types": "^15.1.0",
@@ -14,18 +14,19 @@
"@tkey/share-serialization": "^15.1.0",
"@tkey/storage-layer-torus": "^15.1.0",
"@tkey/tss": "^15.1.0",
- "@toruslabs/constants": "^14.0.0",
+ "@toruslabs/constants": "^14.2.0",
"@toruslabs/customauth": "^20.3.0",
- "@toruslabs/elliptic-wrapper": "^0.1.0",
- "@toruslabs/fetch-node-details": "^14.0.1",
- "@toruslabs/fnd-base": "^14.0.0",
+ "@toruslabs/elliptic-wrapper": "^0.1.1",
+ "@toruslabs/fetch-node-details": "^14.2.0",
+ "@toruslabs/fnd-base": "^14.2.0",
"@toruslabs/metadata-helpers": "^6.0.0",
"@toruslabs/openlogin-utils": "^8.2.1",
"@toruslabs/session-manager": "^3.1.0",
- "@toruslabs/torus.js": "^15.1.0",
- "@toruslabs/tss-client": "^3.1.0",
- "@toruslabs/tss-frost-client": "0.3.1",
- "@toruslabs/tss-frost-common": "^1.0.1",
+ "@toruslabs/torus.js": "15.2.0-alpha.0",
+ "@toruslabs/tss-client": "^3.3.0-alpha.0",
+ "@toruslabs/tss-frost-client": "^1.0.1-alpha.0",
+ "@toruslabs/tss-frost-common": "^1.0.2-alpha.0",
+ "@web3auth/auth": "^9.6.1",
"bn.js": "^5.2.1",
"bowser": "^2.11.0",
"elliptic": "^6.5.7",
@@ -33,11 +34,12 @@
},
"devDependencies": {
"@babel/register": "^7.25.7",
+ "@noble/curves": "^1.6.0",
"@toruslabs/config": "^2.2.0",
"@toruslabs/eslint-config-typescript": "^3.3.3",
"@toruslabs/torus-scripts": "^6.1.2",
- "@toruslabs/tss-dkls-lib": "^4.0.0",
- "@toruslabs/tss-frost-lib": "^1.0.0",
+ "@toruslabs/tss-dkls-lib": "^5.0.0-alpha.0",
+ "@toruslabs/tss-frost-lib": "^2.0.0-alpha.0",
"@types/chai": "^4.3.16",
"@types/elliptic": "^6.4.18",
"@types/jsonwebtoken": "^9.0.7",
@@ -66,8 +68,9 @@
},
"peerDependencies": {
"@babel/runtime": "^7.x",
- "@toruslabs/tss-dkls-lib": "^4.0.0",
- "@toruslabs/tss-frost-lib": "^1.0.0"
+ "@toruslabs/tss-dkls-lib": "^5.0.0-alpha.0",
+ "@toruslabs/tss-frost-lib": "^2.0.0-alpha.0",
+ "@toruslabs/tss-frost-lib-bip340": "^0.1.0-alpha.0"
},
"peerDependenciesMeta": {
"@toruslabs/tss-dkls-lib": {
@@ -75,6 +78,9 @@
},
"@toruslabs/tss-frost-lib": {
"optional": true
+ },
+ "@toruslabs/tss-frost-lib-bip340": {
+ "optional": true
}
}
},
@@ -2557,6 +2563,31 @@
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
+ "node_modules/@ethereumjs/rlp": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-5.0.2.tgz",
+ "integrity": "sha512-DziebCdg4JpGlEqEdGgXmjqcFoJi+JGulUXwEjsZGAscAQ7MyD/7LE/GVCP29vEQxKc7AAwjT3A2ywHp2xfoCA==",
+ "license": "MPL-2.0",
+ "bin": {
+ "rlp": "bin/rlp.cjs"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@ethereumjs/util": {
+ "version": "9.1.0",
+ "resolved": "https://registry.npmjs.org/@ethereumjs/util/-/util-9.1.0.tgz",
+ "integrity": "sha512-XBEKsYqLGXLah9PNJbgdkigthkG7TAGvlD/sH12beMXEyHDyigfcbdvHhmLyDWgDyOJn4QwiQUaF7yeuhnjdog==",
+ "license": "MPL-2.0",
+ "dependencies": {
+ "@ethereumjs/rlp": "^5.0.2",
+ "ethereum-cryptography": "^2.2.1"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/@humanwhocodes/config-array": {
"version": "0.11.14",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz",
@@ -2945,13 +2976,40 @@
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
"license": "MIT"
},
+ "node_modules/@noble/ciphers": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.0.0.tgz",
+ "integrity": "sha512-wH5EHOmLi0rEazphPbecAzmjd12I6/Yv/SiHdkA9LSycsQk7RuuTp7am5/o62qYr0RScE7Pc9icXGBbsr6cesA==",
+ "license": "MIT",
+ "engines": {
+ "node": "^14.21.3 || >=16"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
"node_modules/@noble/curves": {
- "version": "1.4.2",
- "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz",
- "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==",
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.6.0.tgz",
+ "integrity": "sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==",
"license": "MIT",
"dependencies": {
- "@noble/hashes": "1.4.0"
+ "@noble/hashes": "1.5.0"
+ },
+ "engines": {
+ "node": "^14.21.3 || >=16"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@noble/curves/node_modules/@noble/hashes": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz",
+ "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==",
+ "license": "MIT",
+ "engines": {
+ "node": "^14.21.3 || >=16"
},
"funding": {
"url": "https://paulmillr.com/funding/"
@@ -3004,6 +3062,22 @@
"node": ">= 8"
}
},
+ "node_modules/@nx/nx-linux-x64-gnu": {
+ "version": "20.2.2",
+ "resolved": "https://registry.npmjs.org/@nx/nx-linux-x64-gnu/-/nx-linux-x64-gnu-20.2.2.tgz",
+ "integrity": "sha512-K1Z2DVTnyCGl4nolhZ8fvHEixoe1pZOY256LD6D0lGca4Fsi3mHQ7lDU237Pzyc91+cfLva/OAvrivRPeU+DMA==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
"node_modules/@octokit/auth-token": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz",
@@ -3580,9 +3654,9 @@
"license": "MIT"
},
"node_modules/@scure/base": {
- "version": "1.1.7",
- "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.7.tgz",
- "integrity": "sha512-PPNYBslrLNNUQ/Yad37MHYsNQtK67EhWb6WtSvNLLPo7SdVZgkUjD6Dg+5On7zNwmskf8OX7I7Nx5oN+MIWE0g==",
+ "version": "1.1.9",
+ "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz",
+ "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==",
"license": "MIT",
"funding": {
"url": "https://paulmillr.com/funding/"
@@ -3602,6 +3676,18 @@
"url": "https://paulmillr.com/funding/"
}
},
+ "node_modules/@scure/bip32/node_modules/@noble/curves": {
+ "version": "1.4.2",
+ "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz",
+ "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==",
+ "license": "MIT",
+ "dependencies": {
+ "@noble/hashes": "1.4.0"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
"node_modules/@scure/bip39": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz",
@@ -3688,6 +3774,30 @@
"@babel/runtime": "7.x"
}
},
+ "node_modules/@tkey/common-types/node_modules/@toruslabs/torus.js": {
+ "version": "15.1.1",
+ "resolved": "https://registry.npmjs.org/@toruslabs/torus.js/-/torus.js-15.1.1.tgz",
+ "integrity": "sha512-sLaXA1/R8KTTjU4t+teL3PPaJr2+j01QLYn5IY/t5uTD+1G2nzzfVWpkMDYrk9EfQYw0u4aKJ1lT7j9uKafMlg==",
+ "license": "MIT",
+ "dependencies": {
+ "@toruslabs/bs58": "^1.0.0",
+ "@toruslabs/constants": "^14.0.0",
+ "@toruslabs/eccrypto": "^5.0.4",
+ "@toruslabs/http-helpers": "^7.0.0",
+ "bn.js": "^5.2.1",
+ "elliptic": "^6.5.7",
+ "ethereum-cryptography": "^2.2.1",
+ "json-stable-stringify": "^1.1.1",
+ "loglevel": "^1.9.2"
+ },
+ "engines": {
+ "node": ">=18.x",
+ "npm": ">=9.x"
+ },
+ "peerDependencies": {
+ "@babel/runtime": "7.x"
+ }
+ },
"node_modules/@tkey/core": {
"version": "15.1.0",
"resolved": "https://registry.npmjs.org/@tkey/core/-/core-15.1.0.tgz",
@@ -3711,6 +3821,30 @@
"@babel/runtime": "7.x"
}
},
+ "node_modules/@tkey/core/node_modules/@toruslabs/torus.js": {
+ "version": "15.1.1",
+ "resolved": "https://registry.npmjs.org/@toruslabs/torus.js/-/torus.js-15.1.1.tgz",
+ "integrity": "sha512-sLaXA1/R8KTTjU4t+teL3PPaJr2+j01QLYn5IY/t5uTD+1G2nzzfVWpkMDYrk9EfQYw0u4aKJ1lT7j9uKafMlg==",
+ "license": "MIT",
+ "dependencies": {
+ "@toruslabs/bs58": "^1.0.0",
+ "@toruslabs/constants": "^14.0.0",
+ "@toruslabs/eccrypto": "^5.0.4",
+ "@toruslabs/http-helpers": "^7.0.0",
+ "bn.js": "^5.2.1",
+ "elliptic": "^6.5.7",
+ "ethereum-cryptography": "^2.2.1",
+ "json-stable-stringify": "^1.1.1",
+ "loglevel": "^1.9.2"
+ },
+ "engines": {
+ "node": ">=18.x",
+ "npm": ">=9.x"
+ },
+ "peerDependencies": {
+ "@babel/runtime": "7.x"
+ }
+ },
"node_modules/@tkey/service-provider-base": {
"version": "15.1.0",
"resolved": "https://registry.npmjs.org/@tkey/service-provider-base/-/service-provider-base-15.1.0.tgz",
@@ -3750,6 +3884,30 @@
"@babel/runtime": "7.x"
}
},
+ "node_modules/@tkey/service-provider-torus/node_modules/@toruslabs/torus.js": {
+ "version": "15.1.1",
+ "resolved": "https://registry.npmjs.org/@toruslabs/torus.js/-/torus.js-15.1.1.tgz",
+ "integrity": "sha512-sLaXA1/R8KTTjU4t+teL3PPaJr2+j01QLYn5IY/t5uTD+1G2nzzfVWpkMDYrk9EfQYw0u4aKJ1lT7j9uKafMlg==",
+ "license": "MIT",
+ "dependencies": {
+ "@toruslabs/bs58": "^1.0.0",
+ "@toruslabs/constants": "^14.0.0",
+ "@toruslabs/eccrypto": "^5.0.4",
+ "@toruslabs/http-helpers": "^7.0.0",
+ "bn.js": "^5.2.1",
+ "elliptic": "^6.5.7",
+ "ethereum-cryptography": "^2.2.1",
+ "json-stable-stringify": "^1.1.1",
+ "loglevel": "^1.9.2"
+ },
+ "engines": {
+ "node": ">=18.x",
+ "npm": ">=9.x"
+ },
+ "peerDependencies": {
+ "@babel/runtime": "7.x"
+ }
+ },
"node_modules/@tkey/share-serialization": {
"version": "15.1.0",
"resolved": "https://registry.npmjs.org/@tkey/share-serialization/-/share-serialization-15.1.0.tgz",
@@ -3807,6 +3965,30 @@
"ethereum-cryptography": "^2.1.3"
}
},
+ "node_modules/@tkey/tss/node_modules/@toruslabs/torus.js": {
+ "version": "15.1.1",
+ "resolved": "https://registry.npmjs.org/@toruslabs/torus.js/-/torus.js-15.1.1.tgz",
+ "integrity": "sha512-sLaXA1/R8KTTjU4t+teL3PPaJr2+j01QLYn5IY/t5uTD+1G2nzzfVWpkMDYrk9EfQYw0u4aKJ1lT7j9uKafMlg==",
+ "license": "MIT",
+ "dependencies": {
+ "@toruslabs/bs58": "^1.0.0",
+ "@toruslabs/constants": "^14.0.0",
+ "@toruslabs/eccrypto": "^5.0.4",
+ "@toruslabs/http-helpers": "^7.0.0",
+ "bn.js": "^5.2.1",
+ "elliptic": "^6.5.7",
+ "ethereum-cryptography": "^2.2.1",
+ "json-stable-stringify": "^1.1.1",
+ "loglevel": "^1.9.2"
+ },
+ "engines": {
+ "node": ">=18.x",
+ "npm": ">=9.x"
+ },
+ "peerDependencies": {
+ "@babel/runtime": "7.x"
+ }
+ },
"node_modules/@tootallnate/quickjs-emscripten": {
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz",
@@ -3860,9 +4042,9 @@
}
},
"node_modules/@toruslabs/constants": {
- "version": "14.0.0",
- "resolved": "https://registry.npmjs.org/@toruslabs/constants/-/constants-14.0.0.tgz",
- "integrity": "sha512-c0lrqxxiR0FL+XdtbX+77PWTeB8izFUrnPwkF2pjjfXlMJLukAWPLhALpmZmqlGmJApT8kJbMN7be2LurAGa1g==",
+ "version": "14.2.0",
+ "resolved": "https://registry.npmjs.org/@toruslabs/constants/-/constants-14.2.0.tgz",
+ "integrity": "sha512-Mb5EfYNSPyvvw5s1JXnpZwritCgp4NmLni1imTqrSKGV3yikYhUn1ufyLMAHGnBBgv4AuMIXBIe3EpJJ+SpA0g==",
"license": "MIT",
"engines": {
"node": ">=18.x",
@@ -3907,22 +4089,28 @@
}
}
},
- "node_modules/@toruslabs/customauth/node_modules/@toruslabs/session-manager": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/@toruslabs/session-manager/-/session-manager-3.1.0.tgz",
- "integrity": "sha512-VTaYjTTGTqpUm14YWRsSmY0Tt5z7evC0aOdVW7Ahw/jzyb1witNL4Va2+7XzunziEkLJS3luH+LkziHx67jyQg==",
+ "node_modules/@toruslabs/customauth/node_modules/@toruslabs/torus.js": {
+ "version": "15.1.1",
+ "resolved": "https://registry.npmjs.org/@toruslabs/torus.js/-/torus.js-15.1.1.tgz",
+ "integrity": "sha512-sLaXA1/R8KTTjU4t+teL3PPaJr2+j01QLYn5IY/t5uTD+1G2nzzfVWpkMDYrk9EfQYw0u4aKJ1lT7j9uKafMlg==",
"license": "MIT",
"dependencies": {
+ "@toruslabs/bs58": "^1.0.0",
+ "@toruslabs/constants": "^14.0.0",
"@toruslabs/eccrypto": "^5.0.4",
"@toruslabs/http-helpers": "^7.0.0",
- "@toruslabs/metadata-helpers": "^6.0.0"
+ "bn.js": "^5.2.1",
+ "elliptic": "^6.5.7",
+ "ethereum-cryptography": "^2.2.1",
+ "json-stable-stringify": "^1.1.1",
+ "loglevel": "^1.9.2"
},
"engines": {
"node": ">=18.x",
"npm": ">=9.x"
},
- "optionalDependencies": {
- "@rollup/rollup-linux-x64-gnu": "^4.22.4"
+ "peerDependencies": {
+ "@babel/runtime": "7.x"
}
},
"node_modules/@toruslabs/eccrypto": {
@@ -3939,9 +4127,9 @@
}
},
"node_modules/@toruslabs/elliptic-wrapper": {
- "version": "0.1.0",
- "resolved": "https://registry.npmjs.org/@toruslabs/elliptic-wrapper/-/elliptic-wrapper-0.1.0.tgz",
- "integrity": "sha512-h9H2GfLLihSCDJiaTiePLLsrW/i9xupmn8pLE7XaKNyHUlujVFGWyk/ySZK9rlHjVRhLddy4ylb59BCdP81KMg==",
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/@toruslabs/elliptic-wrapper/-/elliptic-wrapper-0.1.1.tgz",
+ "integrity": "sha512-2IehQMK+OfRnJPcwNuM5b+je3+8XlPqjbQVPm85vjsSoliWO23G/2OK1635melTZYcjbxa+88l2m0wWuK/YTSg==",
"license": "ISC",
"dependencies": {
"@toruslabs/config": "^2.0.2",
@@ -4208,15 +4396,15 @@
}
},
"node_modules/@toruslabs/fetch-node-details": {
- "version": "14.0.1",
- "resolved": "https://registry.npmjs.org/@toruslabs/fetch-node-details/-/fetch-node-details-14.0.1.tgz",
- "integrity": "sha512-cV/X8d97W9kU/ibycV/4rfkDSjl+MIgwbKhsVqvgDtoE1mdjMSeCxJTfEDgjxqzUcVlHjcbeUpzCe8qa/Gvs6A==",
+ "version": "14.2.0",
+ "resolved": "https://registry.npmjs.org/@toruslabs/fetch-node-details/-/fetch-node-details-14.2.0.tgz",
+ "integrity": "sha512-k14RazfY4wKIUtdpfrSoUJasRNp2EMgv6ky4bGT1HYMPGU2JUNhvb6XTw5ISxfMrZuk04dLOhC4/XOtynFeFmQ==",
"license": "MIT",
"dependencies": {
- "@toruslabs/constants": "^14.0.0",
- "@toruslabs/fnd-base": "^14.0.0",
+ "@toruslabs/constants": "^14.2.0",
+ "@toruslabs/fnd-base": "^14.2.0",
"@toruslabs/http-helpers": "^7.0.0",
- "loglevel": "^1.9.1"
+ "loglevel": "^1.9.2"
},
"engines": {
"node": ">=18.x",
@@ -4226,13 +4414,23 @@
"@babel/runtime": "7.x"
}
},
+ "node_modules/@toruslabs/ffjavascript": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/@toruslabs/ffjavascript/-/ffjavascript-4.0.0.tgz",
+ "integrity": "sha512-sGPKK0xZ7KDLOsVc8/rCb83iCT1xD12+yfl3eoVNppr4vMcPJcXGwqpw4r1nP3Ln10UHvTCduxjUr3axdoxOSw==",
+ "license": "GPL-3.0",
+ "engines": {
+ "node": ">=18.x",
+ "npm": ">=9.x"
+ }
+ },
"node_modules/@toruslabs/fnd-base": {
- "version": "14.0.0",
- "resolved": "https://registry.npmjs.org/@toruslabs/fnd-base/-/fnd-base-14.0.0.tgz",
- "integrity": "sha512-zaYrm/HHHU4Evj/Et1HrVT8hmMaUpVw3Rcx2Gvp1W5pWZybbdEVoa0uqIANYxcr/NH7PUIU3DoRbk+bXx0kkYg==",
+ "version": "14.2.0",
+ "resolved": "https://registry.npmjs.org/@toruslabs/fnd-base/-/fnd-base-14.2.0.tgz",
+ "integrity": "sha512-nqfcigOuz3pQJi+Q+tdCaDUVCaSUkGqqmw0bGnaKK2/PyXBlZhnEDzReM3aUbApJn3xitfrJEhnRvOJhzog/og==",
"license": "MIT",
"dependencies": {
- "@toruslabs/constants": "^14.0.0"
+ "@toruslabs/constants": "^14.2.0"
},
"engines": {
"node": ">=18.x",
@@ -4337,12 +4535,34 @@
"@babel/runtime": "7.x"
}
},
+ "node_modules/@toruslabs/secure-pub-sub": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@toruslabs/secure-pub-sub/-/secure-pub-sub-1.1.0.tgz",
+ "integrity": "sha512-OFN0Zsa37+c9aStHd4wzau+IYPY+gve9fBPDuPSIuS06cz/bov39DvCP0LaTQUKxK4eQMZENcPu6PeyBvQYQQA==",
+ "license": "MIT",
+ "dependencies": {
+ "@toruslabs/constants": "^14.1.1",
+ "@toruslabs/eccrypto": "^5.0.0",
+ "@toruslabs/http-helpers": "^7.0.0",
+ "@toruslabs/metadata-helpers": "^6.0.0",
+ "loglevel": "^1.9.1",
+ "socket.io-client": "^4.7.5"
+ },
+ "engines": {
+ "node": ">=18.x",
+ "npm": ">=9.x"
+ },
+ "peerDependencies": {
+ "@babel/runtime": "7.x"
+ }
+ },
"node_modules/@toruslabs/session-manager": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/@toruslabs/session-manager/-/session-manager-3.1.0.tgz",
- "integrity": "sha512-VTaYjTTGTqpUm14YWRsSmY0Tt5z7evC0aOdVW7Ahw/jzyb1witNL4Va2+7XzunziEkLJS3luH+LkziHx67jyQg==",
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/@toruslabs/session-manager/-/session-manager-3.2.0.tgz",
+ "integrity": "sha512-t+EGFZhn8pxZ5Gjhxr99qNmK20zZD/RYEMRROBuwsETyy/QU17H6dKhqIb306GjmwUPkz2VKKTtJcOg9Ifijuw==",
"license": "MIT",
"dependencies": {
+ "@toruslabs/constants": "^14.1.1",
"@toruslabs/eccrypto": "^5.0.4",
"@toruslabs/http-helpers": "^7.0.0",
"@toruslabs/metadata-helpers": "^6.0.0"
@@ -4352,7 +4572,29 @@
"npm": ">=9.x"
},
"optionalDependencies": {
- "@rollup/rollup-linux-x64-gnu": "^4.22.4"
+ "@rollup/rollup-linux-x64-gnu": "^4.24.4"
+ }
+ },
+ "node_modules/@toruslabs/starkware-crypto": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/@toruslabs/starkware-crypto/-/starkware-crypto-4.0.1.tgz",
+ "integrity": "sha512-AhnXUscFN2+oLeQuOEbi8vvrQnxUKnE0USWpg7eFHmqUBV8kg6+PAFiWsvJ01+GMQPTMKhKZHyMysxW5AFHc6Q==",
+ "license": "MIT",
+ "dependencies": {
+ "assert": "^2.1.0",
+ "bip39": "^3.1.0",
+ "bn.js": "^5.2.1",
+ "elliptic": "^6.6.1",
+ "enc-utils": "^3.0.0",
+ "ethereum-cryptography": "^2.2.1",
+ "hash.js": "^1.1.7"
+ },
+ "engines": {
+ "node": ">=18.x",
+ "npm": ">=9.x"
+ },
+ "peerDependencies": {
+ "@babel/runtime": "7.x"
}
},
"node_modules/@toruslabs/torus-scripts": {
@@ -4431,9 +4673,9 @@
}
},
"node_modules/@toruslabs/torus.js": {
- "version": "15.1.0",
- "resolved": "https://registry.npmjs.org/@toruslabs/torus.js/-/torus.js-15.1.0.tgz",
- "integrity": "sha512-ZVQzeRl8qXbaw6jVUvPjNnuY6fJjxX4k8NoNfdp+8F2Og1rBiINnASMfRVeDajc4Bg+rfbsX5HZ+T0S+F6lv1A==",
+ "version": "15.2.0-alpha.0",
+ "resolved": "https://registry.npmjs.org/@toruslabs/torus.js/-/torus.js-15.2.0-alpha.0.tgz",
+ "integrity": "sha512-W0HXmffYTbA9pFC3gdj6ON+FsmzJlSksT6hW5mDkRLZp1qSprYppjHnnnelq5n46yOs+290En8LP5s/U5viluw==",
"license": "MIT",
"dependencies": {
"@toruslabs/bs58": "^1.0.0",
@@ -4441,10 +4683,10 @@
"@toruslabs/eccrypto": "^5.0.4",
"@toruslabs/http-helpers": "^7.0.0",
"bn.js": "^5.2.1",
- "elliptic": "^6.5.6",
+ "elliptic": "^6.5.7",
"ethereum-cryptography": "^2.2.1",
"json-stable-stringify": "^1.1.1",
- "loglevel": "^1.9.1"
+ "loglevel": "^1.9.2"
},
"engines": {
"node": ">=18.x",
@@ -4455,17 +4697,17 @@
}
},
"node_modules/@toruslabs/tss-client": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/@toruslabs/tss-client/-/tss-client-3.1.0.tgz",
- "integrity": "sha512-XhQG0lkbWS6KQ5mn9Mr+73c7HUE8RhbIPrkjZso2Bd9SJV4fwHgSLjDMPkvvTCBhrr3Fumw17akfL9tEvTLJZw==",
+ "version": "3.3.0-alpha.0",
+ "resolved": "https://registry.npmjs.org/@toruslabs/tss-client/-/tss-client-3.3.0-alpha.0.tgz",
+ "integrity": "sha512-osExXxucMAlQQnyYS9el870xeILPj1Cv7QFCy2Nk+NsJQ9DW9uK9F3/n9Do8mn5C8POOEyXSwrobxGdypN1MxQ==",
"license": "ISC",
"dependencies": {
- "@toruslabs/eccrypto": "^4.0.0",
- "@types/chrome": "^0.0.268",
+ "@toruslabs/eccrypto": "^5.0.4",
+ "@toruslabs/tss-client-util": "^0.1.1",
"bn.js": "^5.2.1",
- "elliptic": "^6.5.4",
- "ethereum-cryptography": "^2.1.3",
- "socket.io-client": "^4.7.4"
+ "elliptic": "^6.5.7",
+ "ethereum-cryptography": "^3.0.0",
+ "socket.io-client": "^4.8.0"
}
},
"node_modules/@toruslabs/tss-client-util": {
@@ -4477,48 +4719,117 @@
"bn.js": "^5.2.1"
}
},
- "node_modules/@toruslabs/tss-client/node_modules/@toruslabs/eccrypto": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/@toruslabs/eccrypto/-/eccrypto-4.0.0.tgz",
- "integrity": "sha512-Z3EINkbsgJx1t6jCDVIJjLSUEGUtNIeDjhMWmeDGOWcP/+v/yQ1hEvd1wfxEz4q5WqIHhevacmPiVxiJ4DljGQ==",
- "license": "CC0-1.0",
+ "node_modules/@toruslabs/tss-client/node_modules/@noble/hashes": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz",
+ "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==",
+ "license": "MIT",
+ "engines": {
+ "node": "^14.21.3 || >=16"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@toruslabs/tss-client/node_modules/@scure/bip32": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.5.0.tgz",
+ "integrity": "sha512-8EnFYkqEQdnkuGBVpCzKxyIwDCBLDVj3oiX0EKUFre/tOjL/Hqba1D6n/8RcmaQy4f95qQFrO2A8Sr6ybh4NRw==",
+ "license": "MIT",
"dependencies": {
- "elliptic": "^6.5.4"
+ "@noble/curves": "~1.6.0",
+ "@noble/hashes": "~1.5.0",
+ "@scure/base": "~1.1.7"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@toruslabs/tss-client/node_modules/@scure/bip39": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.4.0.tgz",
+ "integrity": "sha512-BEEm6p8IueV/ZTfQLp/0vhw4NPnT9oWf5+28nvmeUICjP99f4vr2d+qc7AVGDDtwRep6ifR43Yed9ERVmiITzw==",
+ "license": "MIT",
+ "dependencies": {
+ "@noble/hashes": "~1.5.0",
+ "@scure/base": "~1.1.8"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@toruslabs/tss-client/node_modules/ethereum-cryptography": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-3.0.0.tgz",
+ "integrity": "sha512-Ij7U9OgVZc4MAui8BttPCEaWUrAXy+eo2IbVfIxZyfzfFxMQrbIWXRUbrsRBqRrIhJ75T8P+KQRKpKTaG0Du8Q==",
+ "license": "MIT",
+ "dependencies": {
+ "@noble/ciphers": "1.0.0",
+ "@noble/curves": "1.6.0",
+ "@noble/hashes": "1.5.0",
+ "@scure/bip32": "1.5.0",
+ "@scure/bip39": "1.4.0"
},
"engines": {
- "node": ">=18.x",
- "npm": ">=9.x"
+ "node": "^14.21.3 || >=16",
+ "npm": ">=9"
}
},
"node_modules/@toruslabs/tss-dkls-lib": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/@toruslabs/tss-dkls-lib/-/tss-dkls-lib-4.0.0.tgz",
- "integrity": "sha512-XIYv4M6el0wlX/I4WEJjxDS/TcUKRrG/+PTljNumh3UrchfkNpm4uW4+d4aOHclAXbX42pi1SkRpz81+YM+Gsg==",
+ "version": "5.0.0-alpha.0",
+ "resolved": "https://registry.npmjs.org/@toruslabs/tss-dkls-lib/-/tss-dkls-lib-5.0.0-alpha.0.tgz",
+ "integrity": "sha512-htUWzL2JZoKTtw++WLdQ1AK3wPTe0yezv/twWjpQIzLFkkfoO9Urnl5n9S6jFx98Z1dDRJRBWSED9PSuqY/x7w==",
"dev": true
},
"node_modules/@toruslabs/tss-frost-client": {
- "version": "0.3.1",
- "resolved": "https://registry.npmjs.org/@toruslabs/tss-frost-client/-/tss-frost-client-0.3.1.tgz",
- "integrity": "sha512-x19hWpbbAHVRWSUPt6FB4VH1vdQGiOe/aSJTts2HZtXRph/LzEGuT7FXyIOnglocYf58t5Z1nXqFEzn0rgQ49Q==",
+ "version": "1.0.1-alpha.0",
+ "resolved": "https://registry.npmjs.org/@toruslabs/tss-frost-client/-/tss-frost-client-1.0.1-alpha.0.tgz",
+ "integrity": "sha512-4J7m818lsRhSwQKGVK6PvSJ+7hFLhKamMQ+CHo0DmfDD8WZNgWFqqfkNSscd5n/DZnmMl6g3KRLHAPsD9KAiTQ==",
"license": "ISC",
"dependencies": {
+ "@toruslabs/elliptic-wrapper": "^0.1.2-alpha.0",
"@toruslabs/tss-client-util": "^0.1.1",
- "@toruslabs/tss-frost-common": "^1.0.1",
+ "@toruslabs/tss-frost-common": "^1.0.2-alpha.0",
"socket.io-client": "^4.7.2"
}
},
+ "node_modules/@toruslabs/tss-frost-client/node_modules/@toruslabs/elliptic-wrapper": {
+ "version": "0.1.2-alpha.0",
+ "resolved": "https://registry.npmjs.org/@toruslabs/elliptic-wrapper/-/elliptic-wrapper-0.1.2-alpha.0.tgz",
+ "integrity": "sha512-GO5gAb6uGslKVmxsW7d/EwEKisJJjobbbqbvmtT/C0ZxJb9Xb3Xa5WtRTuy2gUDioXIRR970vl08TM71uGETkQ==",
+ "license": "ISC",
+ "dependencies": {
+ "@toruslabs/config": "^2.0.2",
+ "@toruslabs/eslint-config-typescript": "^3.0.3",
+ "bn.js": "^5.2.1",
+ "elliptic": "^6.5.4"
+ }
+ },
"node_modules/@toruslabs/tss-frost-common": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/@toruslabs/tss-frost-common/-/tss-frost-common-1.0.1.tgz",
- "integrity": "sha512-WmunNSH9XOM/oHQ/CjsTCn4KN9eqxo4keTRV6Yf6roq/S5hzKjOoowWM86vpwPJ6mfa2Qho9bndE2CCS11nKwg==",
+ "version": "1.0.2-alpha.0",
+ "resolved": "https://registry.npmjs.org/@toruslabs/tss-frost-common/-/tss-frost-common-1.0.2-alpha.0.tgz",
+ "integrity": "sha512-nNpXdVfcM6OMxIehMXQVJIs/0Cw8xSfrd9VcKMeAt0xuS1Fn+pFtFn46n5Wj0Ato58GeE6uGNyfIqtmw6LQa1Q==",
"license": "ISC"
},
"node_modules/@toruslabs/tss-frost-lib": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/@toruslabs/tss-frost-lib/-/tss-frost-lib-1.0.0.tgz",
- "integrity": "sha512-uDsM7f6NiVvNKVOfTUK+CucZUy1TjvTSYvk5LL8t2i/izWzNbBg4NO9qAFws3Kp9Kt1hG0xo8FkWzh3+oJ82xA==",
+ "version": "2.0.0-alpha.0",
+ "resolved": "https://registry.npmjs.org/@toruslabs/tss-frost-lib/-/tss-frost-lib-2.0.0-alpha.0.tgz",
+ "integrity": "sha512-oZy99HiES3OR8t6rrV6ccxwbrq38kxzz1C/5UIdqUVd2IRSWZzrcD+J4Q2/yR5bDMoK1HrucLShK96uMoXyv/A==",
"dev": true
},
+ "node_modules/@toruslabs/tss-frost-lib-bip340": {
+ "version": "0.1.0-alpha.0",
+ "resolved": "https://registry.npmjs.org/@toruslabs/tss-frost-lib-bip340/-/tss-frost-lib-bip340-0.1.0-alpha.0.tgz",
+ "integrity": "sha512-2dK/fhIfkxdbI/WPCRc1nJlL81nu70VMJyj313eJbO6oU13S92YjzoIhiCvBn6G/F3XpftD44wqNkr+S3QbAuA==",
+ "optional": true,
+ "peer": true
+ },
+ "node_modules/@toruslabs/tweetnacl-js": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@toruslabs/tweetnacl-js/-/tweetnacl-js-1.0.4.tgz",
+ "integrity": "sha512-h8fVemW5pstsKbm/fTx+y61dZkh5Pepy/92lsyKp83KErf96jT+w4LGx4nEgeAVrdYQDTLg2tO7vu/boEb23Iw==",
+ "license": "Unlicense"
+ },
"node_modules/@tsconfig/node10": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz",
@@ -4563,16 +4874,6 @@
"dev": true,
"license": "MIT"
},
- "node_modules/@types/chrome": {
- "version": "0.0.268",
- "resolved": "https://registry.npmjs.org/@types/chrome/-/chrome-0.0.268.tgz",
- "integrity": "sha512-7N1QH9buudSJ7sI8Pe4mBHJr5oZ48s0hcanI9w3wgijAlv1OZNUZve9JR4x42dn5lJ5Sm87V1JNfnoh10EnQlA==",
- "license": "MIT",
- "dependencies": {
- "@types/filesystem": "*",
- "@types/har-format": "*"
- }
- },
"node_modules/@types/elliptic": {
"version": "6.4.18",
"resolved": "https://registry.npmjs.org/@types/elliptic/-/elliptic-6.4.18.tgz",
@@ -4601,27 +4902,6 @@
"devOptional": true,
"license": "MIT"
},
- "node_modules/@types/filesystem": {
- "version": "0.0.36",
- "resolved": "https://registry.npmjs.org/@types/filesystem/-/filesystem-0.0.36.tgz",
- "integrity": "sha512-vPDXOZuannb9FZdxgHnqSwAG/jvdGM8Wq+6N4D/d80z+D4HWH+bItqsZaVRQykAn6WEVeEkLm2oQigyHtgb0RA==",
- "license": "MIT",
- "dependencies": {
- "@types/filewriter": "*"
- }
- },
- "node_modules/@types/filewriter": {
- "version": "0.0.33",
- "resolved": "https://registry.npmjs.org/@types/filewriter/-/filewriter-0.0.33.tgz",
- "integrity": "sha512-xFU8ZXTw4gd358lb2jw25nxY9QAgqn2+bKKjKOYfNCzN4DKCFetK7sPtrlpg66Ywe3vWY9FNxprZawAh9wfJ3g==",
- "license": "MIT"
- },
- "node_modules/@types/har-format": {
- "version": "1.2.15",
- "resolved": "https://registry.npmjs.org/@types/har-format/-/har-format-1.2.15.tgz",
- "integrity": "sha512-RpQH4rXLuvTXKR0zqHq3go0RVXYv/YVqv4TnPH95VbwUxZdQlK1EtcMvQvMpDngHbt13Csh9Z4qT9AbkiQH5BA==",
- "license": "MIT"
- },
"node_modules/@types/http-cache-semantics": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz",
@@ -4963,6 +5243,87 @@
"integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==",
"license": "ISC"
},
+ "node_modules/@web3auth/auth": {
+ "version": "9.6.1",
+ "resolved": "https://registry.npmjs.org/@web3auth/auth/-/auth-9.6.1.tgz",
+ "integrity": "sha512-6iYmjhDtZcXGph3pPTVLShMv/xN+eLnc/+g04rqM34pfb85CK2OsvnufCxWcNpEuS/n5yo5voALPE4s/s2BXWw==",
+ "license": "MIT",
+ "dependencies": {
+ "@ethereumjs/util": "^9.1.0",
+ "@toruslabs/constants": "^14.2.0",
+ "@toruslabs/ffjavascript": "^4.0.0",
+ "@toruslabs/metadata-helpers": "^6.0.0",
+ "@toruslabs/secure-pub-sub": "^1.1.0",
+ "@toruslabs/session-manager": "^3.2.0",
+ "@toruslabs/starkware-crypto": "^4.0.1",
+ "@toruslabs/tweetnacl-js": "^1.0.4",
+ "base64url": "^3.0.1",
+ "bip39": "^3.1.0",
+ "bn.js": "^5.2.1",
+ "bowser": "^2.11.0",
+ "color": "^4.2.3",
+ "enc-utils": "^3.0.0",
+ "end-of-stream": "^1.4.4",
+ "events": "^3.3.0",
+ "fast-safe-stringify": "^2.1.1",
+ "json-stable-stringify": "^1.1.1",
+ "loglevel": "^1.9.2",
+ "once": "^1.4.0",
+ "pump": "^3.0.2",
+ "readable-stream": "^4.5.2",
+ "ts-custom-error": "^3.3.1",
+ "typed-emitter": "^2.1.0"
+ },
+ "engines": {
+ "node": ">=18.x",
+ "npm": ">=9.x"
+ },
+ "optionalDependencies": {
+ "@nx/nx-linux-x64-gnu": "^20.2.2",
+ "@rollup/rollup-linux-x64-gnu": "^4.28.1"
+ },
+ "peerDependencies": {
+ "@babel/runtime": "7.x"
+ }
+ },
+ "node_modules/@web3auth/auth/node_modules/@rollup/rollup-linux-x64-gnu": {
+ "version": "4.28.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.28.1.tgz",
+ "integrity": "sha512-fzgeABz7rrAlKYB0y2kSEiURrI0691CSL0+KXwKwhxvj92VULEDQLpBYLHpF49MSiPG4sq5CK3qHMnb9tlCjBw==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@web3auth/auth/node_modules/readable-stream": {
+ "version": "4.5.2",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz",
+ "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==",
+ "license": "MIT",
+ "dependencies": {
+ "abort-controller": "^3.0.0",
+ "buffer": "^6.0.3",
+ "events": "^3.3.0",
+ "process": "^0.11.10",
+ "string_decoder": "^1.3.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ }
+ },
+ "node_modules/@web3auth/auth/node_modules/string_decoder": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
+ "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "license": "MIT",
+ "dependencies": {
+ "safe-buffer": "~5.2.0"
+ }
+ },
"node_modules/@webassemblyjs/ast": {
"version": "1.12.1",
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.12.1.tgz",
@@ -5185,6 +5546,18 @@
"dev": true,
"license": "Apache-2.0"
},
+ "node_modules/abort-controller": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
+ "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
+ "license": "MIT",
+ "dependencies": {
+ "event-target-shim": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=6.5"
+ }
+ },
"node_modules/acorn": {
"version": "8.12.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz",
@@ -5541,7 +5914,6 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/assert/-/assert-2.1.0.tgz",
"integrity": "sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw==",
- "dev": true,
"license": "MIT",
"dependencies": {
"call-bind": "^1.0.2",
@@ -5800,7 +6172,6 @@
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
- "dev": true,
"funding": [
{
"type": "github",
@@ -5856,6 +6227,15 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/bip39": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.1.0.tgz",
+ "integrity": "sha512-c9kiwdk45Do5GL0vJMe7tS95VjCii65mYAH7DfWl3uW8AVzXKQVUm64i3hzVybBDMp9r7j9iNxR85+ul8MdN/A==",
+ "license": "ISC",
+ "dependencies": {
+ "@noble/hashes": "^1.2.0"
+ }
+ },
"node_modules/biskviit": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/biskviit/-/biskviit-1.0.1.tgz",
@@ -6220,7 +6600,6 @@
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
"integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
- "dev": true,
"funding": [
{
"type": "github",
@@ -7469,6 +7848,16 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/enc-utils": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/enc-utils/-/enc-utils-3.0.0.tgz",
+ "integrity": "sha512-e57t/Z2HzWOLwOp7DZcV0VMEY8t7ptWwsxyp6kM2b2zrk6JqIpXxzkruHAMiBsy5wg9jp/183GdiRXCvBtzsYg==",
+ "license": "MIT",
+ "dependencies": {
+ "is-typedarray": "1.0.0",
+ "typedarray-to-buffer": "3.1.5"
+ }
+ },
"node_modules/encoding": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz",
@@ -7478,17 +7867,26 @@
"iconv-lite": "~0.4.13"
}
},
+ "node_modules/end-of-stream": {
+ "version": "1.4.4",
+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
+ "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
+ "license": "MIT",
+ "dependencies": {
+ "once": "^1.4.0"
+ }
+ },
"node_modules/engine.io-client": {
- "version": "6.5.4",
- "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.4.tgz",
- "integrity": "sha512-GeZeeRjpD2qf49cZQ0Wvh/8NJNfeXkXXcoGh+F77oEAgo9gUHwT1fCRxSNU+YEEaysOJTnsFHmM5oAcPy4ntvQ==",
+ "version": "6.6.2",
+ "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.6.2.tgz",
+ "integrity": "sha512-TAr+NKeoVTjEVW8P3iHguO1LO6RlUz9O5Y8o7EY0fU+gY1NYqas7NN3slpFtbXEsLMHk0h90fJMfKjRkQ0qUIw==",
"license": "MIT",
"dependencies": {
"@socket.io/component-emitter": "~3.1.0",
"debug": "~4.3.1",
"engine.io-parser": "~5.2.1",
"ws": "~8.17.1",
- "xmlhttprequest-ssl": "~2.0.0"
+ "xmlhttprequest-ssl": "~2.1.1"
}
},
"node_modules/engine.io-parser": {
@@ -8570,6 +8968,27 @@
"@scure/bip39": "1.3.0"
}
},
+ "node_modules/ethereum-cryptography/node_modules/@noble/curves": {
+ "version": "1.4.2",
+ "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz",
+ "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==",
+ "license": "MIT",
+ "dependencies": {
+ "@noble/hashes": "1.4.0"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/event-target-shim": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
+ "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/eventemitter3": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz",
@@ -8580,7 +8999,6 @@
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
"integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
- "dev": true,
"license": "MIT",
"engines": {
"node": ">=0.8.x"
@@ -8688,6 +9106,12 @@
"integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==",
"license": "MIT"
},
+ "node_modules/fast-safe-stringify": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz",
+ "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==",
+ "license": "MIT"
+ },
"node_modules/fast-uri": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.1.tgz",
@@ -9773,7 +10197,6 @@
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
- "dev": true,
"funding": [
{
"type": "github",
@@ -10230,7 +10653,6 @@
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz",
"integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==",
- "dev": true,
"license": "MIT",
"dependencies": {
"call-bind": "^1.0.2",
@@ -10448,7 +10870,6 @@
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz",
"integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==",
- "dev": true,
"license": "MIT",
"dependencies": {
"has-tostringtag": "^1.0.0"
@@ -10561,7 +10982,6 @@
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz",
"integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==",
- "dev": true,
"license": "MIT",
"dependencies": {
"call-bind": "^1.0.0",
@@ -10768,7 +11188,6 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
"integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==",
- "dev": true,
"license": "MIT"
},
"node_modules/is-unicode-supported": {
@@ -12331,7 +12750,6 @@
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.6.tgz",
"integrity": "sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==",
- "dev": true,
"license": "MIT",
"dependencies": {
"call-bind": "^1.0.7",
@@ -13236,7 +13654,6 @@
"version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
"integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
- "dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.6.0"
@@ -13328,6 +13745,16 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/pump": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.2.tgz",
+ "integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==",
+ "license": "MIT",
+ "dependencies": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.1"
+ }
+ },
"node_modules/punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
@@ -14326,7 +14753,7 @@
"version": "7.8.1",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz",
"integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==",
- "dev": true,
+ "devOptional": true,
"license": "Apache-2.0",
"dependencies": {
"tslib": "^2.1.0"
@@ -14354,7 +14781,6 @@
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
- "dev": true,
"funding": [
{
"type": "github",
@@ -14755,14 +15181,14 @@
}
},
"node_modules/socket.io-client": {
- "version": "4.7.5",
- "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.7.5.tgz",
- "integrity": "sha512-sJ/tqHOCe7Z50JCBCXrsY3I2k03iOiUe+tj1OmKeD2lXPiGH/RUCdTZFoqVyN7l1MnpIzPrGtLcijffmeouNlQ==",
+ "version": "4.8.1",
+ "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.8.1.tgz",
+ "integrity": "sha512-hJVXfu3E28NmzGk8o1sHhN3om52tRvwYeidbj7xKy2eIIse5IoKX3USlS6Tqt3BHAtflLIkCQBkzVrEEfWUyYQ==",
"license": "MIT",
"dependencies": {
"@socket.io/component-emitter": "~3.1.0",
"debug": "~4.3.2",
- "engine.io-client": "~6.5.2",
+ "engine.io-client": "~6.6.1",
"socket.io-parser": "~4.2.4"
},
"engines": {
@@ -15607,11 +16033,19 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/typed-emitter": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/typed-emitter/-/typed-emitter-2.1.0.tgz",
+ "integrity": "sha512-g/KzbYKbH5C2vPkaXGu8DJlHrGKHLsM25Zg9WuC9pMGfuvT+X25tZQWo5fK1BjBm8+UrVE9LDCvaY0CQk+fXDA==",
+ "license": "MIT",
+ "optionalDependencies": {
+ "rxjs": "*"
+ }
+ },
"node_modules/typedarray-to-buffer": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz",
"integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==",
- "dev": true,
"license": "MIT",
"dependencies": {
"is-typedarray": "^1.0.0"
@@ -15876,7 +16310,6 @@
"version": "0.12.5",
"resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz",
"integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==",
- "dev": true,
"license": "MIT",
"dependencies": {
"inherits": "^2.0.3",
@@ -16668,9 +17101,9 @@
}
},
"node_modules/xmlhttprequest-ssl": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz",
- "integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==",
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.1.2.tgz",
+ "integrity": "sha512-TEU+nJVUUnA4CYJFLvK5X9AOeH4KvDvhIfm0vV1GaQRtchnG0hgK5p8hw/xjv8cunWYCsiPCSDzObPyhEwq3KQ==",
"engines": {
"node": ">=0.4.0"
}
diff --git a/package.json b/package.json
index 849401d0..15a15e16 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@web3auth/mpc-core-kit",
- "version": "3.2.7",
+ "version": "4.1.7-alpha.0",
"description": "MPC CoreKit SDK for web3Auth",
"keywords": [
"web3Auth/mpc-core-kit",
@@ -31,8 +31,9 @@
],
"peerDependencies": {
"@babel/runtime": "^7.x",
- "@toruslabs/tss-dkls-lib": "^4.0.0",
- "@toruslabs/tss-frost-lib": "^1.0.0"
+ "@toruslabs/tss-dkls-lib": "^5.0.0-alpha.0",
+ "@toruslabs/tss-frost-lib": "^2.0.0-alpha.0",
+ "@toruslabs/tss-frost-lib-bip340": "^0.1.0-alpha.0"
},
"peerDependenciesMeta": {
"@toruslabs/tss-dkls-lib": {
@@ -40,6 +41,9 @@
},
"@toruslabs/tss-frost-lib": {
"optional": true
+ },
+ "@toruslabs/tss-frost-lib-bip340": {
+ "optional": true
}
},
"dependencies": {
@@ -48,18 +52,19 @@
"@tkey/share-serialization": "^15.1.0",
"@tkey/storage-layer-torus": "^15.1.0",
"@tkey/tss": "^15.1.0",
- "@toruslabs/constants": "^14.0.0",
+ "@toruslabs/constants": "^14.2.0",
"@toruslabs/customauth": "^20.3.0",
- "@toruslabs/elliptic-wrapper": "^0.1.0",
- "@toruslabs/fetch-node-details": "^14.0.1",
- "@toruslabs/fnd-base": "^14.0.0",
+ "@toruslabs/elliptic-wrapper": "^0.1.1",
+ "@toruslabs/fetch-node-details": "^14.2.0",
+ "@toruslabs/fnd-base": "^14.2.0",
"@toruslabs/metadata-helpers": "^6.0.0",
- "@toruslabs/session-manager": "^3.1.0",
"@toruslabs/openlogin-utils": "^8.2.1",
- "@toruslabs/torus.js": "^15.1.0",
- "@toruslabs/tss-client": "^3.1.0",
- "@toruslabs/tss-frost-client": "0.3.1",
- "@toruslabs/tss-frost-common": "^1.0.1",
+ "@toruslabs/torus.js": "15.2.0-alpha.0",
+ "@toruslabs/session-manager": "^3.1.0",
+ "@toruslabs/tss-client": "^3.3.0-alpha.0",
+ "@toruslabs/tss-frost-client": "^1.0.1-alpha.0",
+ "@toruslabs/tss-frost-common": "^1.0.2-alpha.0",
+ "@web3auth/auth": "^9.6.1",
"bn.js": "^5.2.1",
"bowser": "^2.11.0",
"elliptic": "^6.5.7",
@@ -67,11 +72,12 @@
},
"devDependencies": {
"@babel/register": "^7.25.7",
+ "@noble/curves": "^1.6.0",
"@toruslabs/config": "^2.2.0",
"@toruslabs/eslint-config-typescript": "^3.3.3",
"@toruslabs/torus-scripts": "^6.1.2",
- "@toruslabs/tss-dkls-lib": "^4.0.0",
- "@toruslabs/tss-frost-lib": "^1.0.0",
+ "@toruslabs/tss-dkls-lib": "^5.0.0-alpha.0",
+ "@toruslabs/tss-frost-lib": "^2.0.0-alpha.0",
"@types/chai": "^4.3.16",
"@types/elliptic": "^6.4.18",
"@types/jsonwebtoken": "^9.0.7",
diff --git a/src/constants.ts b/src/constants.ts
index e29a4b9b..d927cfcd 100644
--- a/src/constants.ts
+++ b/src/constants.ts
@@ -1,4 +1,4 @@
-import { TORUS_SAPPHIRE_NETWORK } from "@toruslabs/constants";
+import { SIG_TYPE, TORUS_SAPPHIRE_NETWORK } from "@toruslabs/constants";
export const WEB3AUTH_NETWORK = {
MAINNET: TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET,
@@ -51,3 +51,5 @@ export const FIELD_ELEMENT_HEX_LEN = 32 * 2; // Length of secp256k1 field elemen
export const MAX_FACTORS = 10; // Maximum number of factors that can be added to an account.
export const SOCIAL_TKEY_INDEX = 1;
+
+export { SIG_TYPE };
diff --git a/src/helper/errors.ts b/src/helper/errors.ts
index a622e75a..f22c3131 100644
--- a/src/helper/errors.ts
+++ b/src/helper/errors.ts
@@ -135,6 +135,8 @@ class CoreKitError extends AbstractCoreKitError {
1005: "No valid storage option found.",
1006: "No data found in storage.",
1007: "Invalid config.",
+ 1008: "Invalid key type.",
+ 1009: "Invalid signature type.",
// TSS and key management errors
1101: "'tssLib' is required when running in this UX mode.",
@@ -215,6 +217,14 @@ class CoreKitError extends AbstractCoreKitError {
return CoreKitError.fromCode(1007, extraMessage);
}
+ public static invalidKeyType(extraMessage = ""): ICoreKitError {
+ return CoreKitError.fromCode(1008, extraMessage);
+ }
+
+ public static invalidSigType(extraMessage = ""): ICoreKitError {
+ return CoreKitError.fromCode(1009, extraMessage);
+ }
+
// TSS and key management errors
public static tssLibRequired(extraMessage = ""): ICoreKitError {
return CoreKitError.fromCode(1101, extraMessage);
diff --git a/src/index.ts b/src/index.ts
index 3e41424a..3a4bd8d6 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -2,5 +2,6 @@ export * from "./constants";
export * from "./helper";
export * from "./interfaces";
export * from "./mpcCoreKit";
+export * from "./plugins";
export * from "./utils";
export { factorKeyCurve } from "@tkey/tss";
diff --git a/src/interfaces.ts b/src/interfaces.ts
index ef5f64d7..ccfb484d 100644
--- a/src/interfaces.ts
+++ b/src/interfaces.ts
@@ -1,28 +1,34 @@
import { KeyType, Point as TkeyPoint, ShareDescriptionMap } from "@tkey/common-types";
-import { TKeyTSS } from "@tkey/tss";
+import { TKeyTSS, TSSTorusServiceProvider } from "@tkey/tss";
+import { WEB3AUTH_SIG_TYPE } from "@toruslabs/constants";
import type {
AGGREGATE_VERIFIER_TYPE,
ExtraParams,
LoginWindowResponse,
PasskeyExtraParams,
SubVerifierDetails,
+ TorusAggregateLoginResponse,
+ TorusLoginResponse,
TorusVerifierResponse,
UX_MODE_TYPE,
} from "@toruslabs/customauth";
+import { TorusKey } from "@toruslabs/torus.js";
import { Client } from "@toruslabs/tss-client";
// TODO: move the types to a base class for both dkls and frost in future
import type { tssLib as TssDklsLib } from "@toruslabs/tss-dkls-lib";
-import type { tssLib as TssFrostLib } from "@toruslabs/tss-frost-lib";
+import type { tssLib as TssFrostLibEd25519 } from "@toruslabs/tss-frost-lib";
+import type { tssLib as TssFrostLibBip340 } from "@toruslabs/tss-frost-lib-bip340";
+import { SafeEventEmitter } from "@web3auth/auth";
import BN from "bn.js";
import { FactorKeyTypeShareDescription, TssShareType, USER_PATH, WEB3AUTH_NETWORK } from "./constants";
+import { ISessionSigGenerator } from "./plugins/ISessionSigGenerator";
export type CoreKitMode = UX_MODE_TYPE | "nodejs" | "react-native";
-export type V3TSSLibType = { keyType: string; lib: unknown };
+export type V4TSSLibType = typeof TssDklsLib | typeof TssFrostLibEd25519 | typeof TssFrostLibBip340;
+export type TssLibType = typeof TssDklsLib | typeof TssFrostLibEd25519 | typeof TssFrostLibBip340;
-export type V4TSSLibType = typeof TssFrostLib | typeof TssDklsLib;
-export type TssLibType = V4TSSLibType | V3TSSLibType;
export interface IStorage {
getItem(key: string): string | null;
setItem(key: string, value: string): void;
@@ -182,131 +188,6 @@ export interface Web3AuthState {
factorKey?: BN;
}
-export interface ICoreKit {
- /**
- * The tKey instance, if initialized.
- * TKey is the core module on which this wrapper SDK sits for easy integration.
- **/
- tKey: TKeyTSS | null;
-
- /**
- * Signatures generated from the OAuth Login.
- **/
- signatures: string[] | null;
-
- /**
- * Status of the current MPC Core Kit Instance
- **/
- status: COREKIT_STATUS;
-
- /**
- * The current sdk state.
- */
- state: Web3AuthState;
-
- /**
- * The current session id.
- */
- sessionId: string;
-
- /**
- * The function used to initailise the state of MPCCoreKit
- * Also is useful to resume an existing session.
- * @param initParams - Contains flag for handleRedirectResult. Default is true.
- */
- init(initParams?: InitParams): Promise;
-
- /**
- * Login using OAuth flow and initialize all relevant components.
- * @param loginParams - Parameters for OAuth-based Login.
- */
- loginWithOAuth(loginParams: OAuthLoginParams): Promise;
-
- /**
- * Login using JWT Token and initialize all relevant components.
- * @param loginParams - Parameters for JWT-based Login.
- */
- loginWithJWT(loginParams: JWTLoginParams): Promise;
-
- /**
- * Enable MFA for the user. Deletes the Cloud factor and generates a new
- * factor key and a backup factor key. Recommended for Non Custodial Flow.
- * Stores the factor key in browser storage and returns the backup factor key.
- *
- * ** NOTE before enableMFA, you will need to commitChanges if manualSync is true.
- *
- * @param enableMFAParams - Parameters for recovery factor for MFA.
- * @param recoveryFactor - Default is true. If false, recovery factor will NOT be created.
- * @returns The backup factor key if if recoveryFacort is true else empty string.
- */
- enableMFA(enableMFAParams: EnableMFAParams, recoveryFactor?: boolean): Promise;
-
- /**
- * Second step for login where the user inputs their factor key.
- * @param factorKey - A BN used for encrypting your Device/ Recovery TSS Key
- * Share. You can generate it using `generateFactorKey()` function or use an
- * existing one.
- */
- inputFactorKey(factorKey: BN): Promise;
-
- /**
- * Returns the current Factor Key and TssShareType in MPC Core Kit State
- **/
- getCurrentFactorKey(): IFactorKey;
-
- /**
- * Creates a new factor for authentication. Generates and returns a new factor
- * key if no factor key is provided in `params`.
- * @param createFactorParams - Parameters for creating a new factor.
- * @returns The factor key.
- */
- createFactor(createFactorParams: CreateFactorParams): Promise;
-
- /**
- * Deletes the factor identified by the given public key, including all
- * associated metadata.
- * @param factorPub - The public key of the factor to delete.
- */
- deleteFactor(factorPub: TkeyPoint): Promise;
-
- /**
- * Logs out the user, terminating the session.
- */
- logout(): Promise;
-
- /**
- * Get user information provided by the OAuth provider.
- */
- getUserInfo(): UserInfo;
-
- /**
- * Get information about how the keys of the user is managed according to the information in the metadata server.
- */
- getKeyDetails(): MPCKeyDetails;
-
- /**
- * Commit the changes made to the user's account when in manual sync mode.
- */
- commitChanges(): Promise;
-
- /**
- * WARNING: Use with caution. This will export the private signing key.
- *
- * Exports the private key scalar for the current account index.
- *
- * For keytype ed25519, consider using _UNSAFE_exportTssEd25519Seed.
- */
- _UNSAFE_exportTssKey(): Promise;
-
- /**
- * WARNING: Use with caution. This will export the private signing key.
- *
- * Attempts to export the ed25519 private key seed. Only works if import key
- * flow has been used.
- */
- _UNSAFE_exportTssEd25519Seed(): Promise;
-}
-
export type WEB3AUTH_NETWORK_TYPE = (typeof WEB3AUTH_NETWORK)[keyof typeof WEB3AUTH_NETWORK];
export type USER_PATH_TYPE = (typeof USER_PATH)[keyof typeof USER_PATH];
@@ -453,9 +334,173 @@ export interface Web3AuthOptions {
*/
useClientGeneratedTSSKey?: boolean;
}
-
export type Web3AuthOptionsWithDefaults = Required;
+export interface IMPCContext {
+ stateEmitter: SafeEventEmitter;
+ config: Web3AuthOptionsWithDefaults;
+ status: COREKIT_STATUS;
+ state: Web3AuthState;
+ torusSp: TSSTorusServiceProvider | null;
+ updateState: (newState: Partial) => void;
+ getUserInfo: () => UserInfo;
+ setupTkey: (params?: {
+ providedImportKey?: string;
+ sfaLoginResponse?: TorusKey | TorusLoginResponse | TorusAggregateLoginResponse;
+ userInfo?: UserInfo;
+ importingSFAKey?: boolean;
+ persistSessionSigs?: boolean;
+ }) => Promise;
+ setCustomSessionSigGenerator: (sessionSigGenerator: ISessionSigGenerator) => void;
+}
+
+export interface Secp256k1PrecomputedClient {
+ client: Client;
+ serverCoeffs: Record;
+ signatures: string[];
+}
+
+export interface ICoreKit {
+ /**
+ * The tKey instance, if initialized.
+ * TKey is the core module on which this wrapper SDK sits for easy integration.
+ **/
+ tKey: TKeyTSS | null;
+
+ /**
+ * Status of the current MPC Core Kit Instance
+ **/
+ status: COREKIT_STATUS;
+
+ /**
+ * The current sdk state.
+ */
+ state: Web3AuthState;
+
+ /**
+ * The current session id.
+ */
+ sessionId: string;
+
+ /**
+ * The function used to initailise the state of MPCCoreKit
+ * Also is useful to resume an existing session.
+ * @param initParams - Contains flag for handleRedirectResult. Default is true.
+ */
+ init(initParams?: InitParams): Promise;
+
+ /**
+ * Login using OAuth flow and initialize all relevant components.
+ * @param loginParams - Parameters for OAuth-based Login.
+ */
+ loginWithOAuth(loginParams: OAuthLoginParams): Promise;
+
+ /**
+ * Login using JWT Token and initialize all relevant components.
+ * @param loginParams - Parameters for JWT-based Login.
+ */
+ loginWithJWT(loginParams: JWTLoginParams): Promise;
+
+ /**
+ * Enable MFA for the user. Deletes the Cloud factor and generates a new
+ * factor key and a backup factor key. Recommended for Non Custodial Flow.
+ * Stores the factor key in browser storage and returns the backup factor key.
+ *
+ * ** NOTE before enableMFA, you will need to commitChanges if manualSync is true.
+ *
+ * @param enableMFAParams - Parameters for recovery factor for MFA.
+ * @param recoveryFactor - Default is true. If false, recovery factor will NOT be created.
+ * @returns The backup factor key if if recoveryFacort is true else empty string.
+ */
+ enableMFA(enableMFAParams: EnableMFAParams, recoveryFactor?: boolean): Promise;
+
+ /**
+ * Second step for login where the user inputs their factor key.
+ * @param factorKey - A BN used for encrypting your Device/ Recovery TSS Key
+ * Share. You can generate it using `generateFactorKey()` function or use an
+ * existing one.
+ */
+ inputFactorKey(factorKey: BN): Promise;
+
+ /**
+ * Returns the current Factor Key and TssShareType in MPC Core Kit State
+ **/
+ getCurrentFactorKey(): IFactorKey;
+
+ /**
+ * Creates a new factor for authentication. Generates and returns a new factor
+ * key if no factor key is provided in `params`.
+ * @param createFactorParams - Parameters for creating a new factor.
+ * @returns The factor key.
+ */
+ createFactor(createFactorParams: CreateFactorParams): Promise;
+
+ /**
+ * Deletes the factor identified by the given public key, including all
+ * associated metadata.
+ * @param factorPub - The public key of the factor to delete.
+ */
+ deleteFactor(factorPub: TkeyPoint): Promise;
+
+ /**
+ * Logs out the user, terminating the session.
+ */
+ logout(): Promise;
+
+ /**
+ * Get user information provided by the OAuth provider.
+ */
+ getUserInfo(): UserInfo;
+
+ /**
+ * Get information about how the keys of the user is managed according to the information in the metadata server.
+ */
+ getKeyDetails(): MPCKeyDetails;
+
+ getSessionSignatures(): Promise;
+
+ setCustomSessionSigGenerator(sessionSigGenerator: ISessionSigGenerator): void;
+
+ /**
+ * Commit the changes made to the user's account when in manual sync mode.
+ */
+ commitChanges(): Promise;
+
+ /**
+ * Create a signature for the given data.
+ *
+ * Options:
+ * - hashed: The data is already hashed. Do not hash again. Only works for ecdsa-secp256k1.
+ * - secp256k1Precompute: Provide a precomputed client for faster signing. Only works for ecdsa-secp256k1.
+ * - keyTweak: Provide a bip340 key tweak. Only works for bip340.
+ */
+ sign(
+ data: Buffer,
+ opts?: {
+ hashed?: boolean;
+ secp256k1Precompute?: Secp256k1PrecomputedClient;
+ keyTweak?: BN;
+ }
+ ): Promise;
+
+ /**
+ * WARNING: Use with caution. This will export the private signing key.
+ *
+ * Exports the private key scalar for the current account index.
+ *
+ * For keytype ed25519, consider using _UNSAFE_exportTssEd25519Seed.
+ */
+ _UNSAFE_exportTssKey(): Promise;
+
+ /**
+ * WARNING: Use with caution. This will export the private signing key.
+ *
+ * Attempts to export the ed25519 private key seed. Only works if import key
+ * flow has been used.
+ */
+ _UNSAFE_exportTssEd25519Seed(): Promise;
+}
+
export interface SessionData {
/**
* @deprecated Use `postBoxKey` instead.
@@ -474,9 +519,12 @@ export interface TkeyLocalStoreData {
factorKey: string;
}
+export type SigType = WEB3AUTH_SIG_TYPE;
+
export interface CoreKitSigner {
keyType: KeyType;
- sign(data: Buffer, hashed?: boolean): Promise;
+ sigType: SigType;
+ sign(data: Buffer, opts?: { hashed?: boolean }): Promise;
getPubKey(): Buffer;
}
@@ -491,7 +539,6 @@ export interface EthereumSigner {
getPublic: () => Promise;
}
-export interface Secp256k1PrecomputedClient {
- client: Client;
- serverCoeffs: Record;
-}
+export type StateEmitterEvents = {
+ LOGOUT: () => void;
+};
diff --git a/src/mpcCoreKit.ts b/src/mpcCoreKit.ts
index 505629bb..44b7fc1d 100644
--- a/src/mpcCoreKit.ts
+++ b/src/mpcCoreKit.ts
@@ -3,18 +3,20 @@ import { CoreError } from "@tkey/core";
import { ShareSerializationModule } from "@tkey/share-serialization";
import { TorusStorageLayer } from "@tkey/storage-layer-torus";
import { factorKeyCurve, getPubKeyPoint, lagrangeInterpolation, TKeyTSS, TSSTorusServiceProvider } from "@tkey/tss";
-import { KEY_TYPE, SIGNER_MAP } from "@toruslabs/constants";
+import { SIGNER_MAP } from "@toruslabs/constants";
import { AGGREGATE_VERIFIER, TORUS_METHOD, TorusAggregateLoginResponse, TorusLoginResponse, UX_MODE } from "@toruslabs/customauth";
import type { UX_MODE_TYPE } from "@toruslabs/customauth/dist/types/utils/enums";
-import { Ed25519Curve } from "@toruslabs/elliptic-wrapper";
+import { Ed25519Curve, Secp256k1Curve } from "@toruslabs/elliptic-wrapper";
import { fetchLocalConfig } from "@toruslabs/fnd-base";
import { keccak256 } from "@toruslabs/metadata-helpers";
import { SessionManager } from "@toruslabs/session-manager";
import { Torus as TorusUtils, TorusKey } from "@toruslabs/torus.js";
import { Client, getDKLSCoeff, setupSockets } from "@toruslabs/tss-client";
import type { WasmLib as DKLSWasmLib } from "@toruslabs/tss-dkls-lib";
-import { sign as signEd25519 } from "@toruslabs/tss-frost-client";
-import type { WasmLib as FrostWasmLib } from "@toruslabs/tss-frost-lib";
+import { sign as signFrost } from "@toruslabs/tss-frost-client";
+import type { WasmLib as FrostWasmLibEd25519 } from "@toruslabs/tss-frost-lib";
+import type { WasmLib as FrostWasmLibBip340 } from "@toruslabs/tss-frost-lib-bip340";
+import { SafeEventEmitter } from "@web3auth/auth";
import BN from "bn.js";
import bowser from "bowser";
import { ec as EC } from "elliptic";
@@ -39,22 +41,25 @@ import {
EnableMFAParams,
ICoreKit,
IFactorKey,
+ IMPCContext,
InitParams,
JWTLoginParams,
MPCKeyDetails,
OAuthLoginParams,
Secp256k1PrecomputedClient,
SessionData,
+ SigType,
+ StateEmitterEvents,
SubVerifierDetailsParams,
TkeyLocalStoreData,
TssLibType,
UserInfo,
- V3TSSLibType,
- V4TSSLibType,
Web3AuthOptions,
Web3AuthOptionsWithDefaults,
Web3AuthState,
} from "./interfaces";
+import { DefaultSessionSigGeneratorPlugin } from "./plugins/DefaultSessionSigGenerator";
+import { ISessionSigGenerator } from "./plugins/ISessionSigGenerator";
import {
deriveShareCoefficients,
ed25519,
@@ -70,11 +75,13 @@ import {
scalarBNToBufferSEC1,
} from "./utils";
-export class Web3AuthMPCCoreKit implements ICoreKit {
+export class Web3AuthMPCCoreKit implements ICoreKit, IMPCContext {
public state: Web3AuthState = { accountIndex: 0 };
public torusSp: TSSTorusServiceProvider | null = null;
+ public stateEmitter: SafeEventEmitter;
+
private options: Web3AuthOptionsWithDefaults;
private storageLayer: TorusStorageLayer | null = null;
@@ -93,12 +100,16 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
private _tssLib: TssLibType;
- private wasmLib: DKLSWasmLib | FrostWasmLib;
+ private wasmLib: DKLSWasmLib | FrostWasmLibEd25519 | FrostWasmLibBip340;
private _keyType: KeyType;
+ private _sigType: SigType;
+
private atomicCallStackCounter: number = 0;
+ private sessionSigGenerator: ISessionSigGenerator;
+
constructor(options: Web3AuthOptions) {
if (!options.web3AuthClientId) {
throw CoreKitError.clientIdInvalid();
@@ -106,6 +117,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
this._tssLib = options.tssLib;
this._keyType = options.tssLib.keyType as KeyType;
+ this._sigType = options.tssLib.sigType as SigType;
const isNodejsOrRN = this.isNodejsOrRN(options.uxMode);
@@ -124,11 +136,11 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
if (!options.disableHashedFactorKey) options.disableHashedFactorKey = false;
if (!options.hashedFactorNonce) options.hashedFactorNonce = options.web3AuthClientId;
if (options.disableSessionManager === undefined) options.disableSessionManager = false;
-
+ this.sessionSigGenerator = new DefaultSessionSigGeneratorPlugin(this);
this.options = options as Web3AuthOptionsWithDefaults;
this.currentStorage = new AsyncStorage(this._storageBaseKey, options.storage);
-
+ this.stateEmitter = new SafeEventEmitter();
if (!options.disableSessionManager) {
this.sessionManager = new SessionManager({
sessionTime: options.sessionTime,
@@ -149,8 +161,12 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
return this._keyType;
}
- get signatures(): string[] {
- return this.state?.signatures ? this.state.signatures : [];
+ get sigType(): SigType {
+ return this._sigType;
+ }
+
+ get config(): Web3AuthOptionsWithDefaults {
+ return this.options;
}
public get _storageKey(): string {
@@ -175,7 +191,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
}
get supportsAccountIndex(): boolean {
- return this._keyType !== KeyType.ed25519;
+ return this._sigType !== "ed25519";
}
private get verifier(): string {
@@ -194,7 +210,15 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
}
private get useClientGeneratedTSSKey(): boolean {
- return this.keyType === KeyType.ed25519 && this.options.useClientGeneratedTSSKey === undefined ? true : !!this.options.useClientGeneratedTSSKey;
+ return this._sigType === "ed25519" && this.options.useClientGeneratedTSSKey === undefined ? true : !!this.options.useClientGeneratedTSSKey;
+ }
+
+ public setCustomSessionSigGenerator(sessionSigGenerator: ISessionSigGenerator) {
+ this.sessionSigGenerator = sessionSigGenerator;
+ }
+
+ async getSessionSignatures(): Promise {
+ return this.sessionSigGenerator.getSessionSigs();
}
// RecoverTssKey only valid for user that enable MFA where user has 2 type shares :
@@ -233,8 +257,8 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
const nodeDetails = fetchLocalConfig(this.options.web3AuthNetwork, this.keyType);
- if (this.keyType === KEY_TYPE.ED25519 && this.options.useDKG) {
- throw CoreKitError.invalidConfig("DKG is not supported for ed25519 key type");
+ if (this._sigType === "ed25519" && this.options.useDKG) {
+ throw CoreKitError.invalidConfig("DKG is not supported for ed25519 signature type");
}
this.torusSp = new TSSTorusServiceProvider({
@@ -333,33 +357,20 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
const verifierParams = params as SubVerifierDetailsParams;
const aggregateParams = params as AggregateVerifierLoginParams;
let loginResponse: TorusLoginResponse | TorusAggregateLoginResponse;
+ let userInfo;
if (verifierParams.subVerifierDetails) {
// single verifier login.
loginResponse = await tkeyServiceProvider.triggerLogin((params as SubVerifierDetailsParams).subVerifierDetails);
-
+ userInfo = loginResponse.userInfo;
if (this.isRedirectMode) return;
-
- this.updateState({
- postBoxKey: this._getPostBoxKey(loginResponse),
- postboxKeyNodeIndexes: loginResponse.nodesData?.nodeIndexes,
- userInfo: loginResponse.userInfo,
- signatures: this._getSignatures(loginResponse.sessionData.sessionTokenData),
- });
} else if (aggregateParams.subVerifierDetailsArray) {
loginResponse = await tkeyServiceProvider.triggerAggregateLogin({
aggregateVerifierType: aggregateParams.aggregateVerifierType || AGGREGATE_VERIFIER.SINGLE_VERIFIER_ID,
verifierIdentifier: aggregateParams.aggregateVerifierIdentifier as string,
subVerifierDetailsArray: aggregateParams.subVerifierDetailsArray,
});
-
+ userInfo = loginResponse.userInfo[0];
if (this.isRedirectMode) return;
-
- this.updateState({
- postBoxKey: this._getPostBoxKey(loginResponse),
- postboxKeyNodeIndexes: loginResponse.nodesData?.nodeIndexes,
- userInfo: loginResponse.userInfo[0],
- signatures: this._getSignatures(loginResponse.sessionData.sessionTokenData),
- });
}
if (loginResponse && registerExistingSFAKey && loginResponse.finalKeyData.privKey) {
@@ -367,9 +378,21 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
throw CoreKitError.invalidConfig("Cannot register existing SFA key for v1 users, please contact web3auth support.");
}
const existingSFAKey = loginResponse.finalKeyData.privKey.padStart(64, "0");
- await this.setupTkey(existingSFAKey, loginResponse, true);
+ await this.setupTkey({
+ providedImportKey: existingSFAKey,
+ sfaLoginResponse: loginResponse,
+ userInfo,
+ importingSFAKey: true,
+ persistSessionSigs: true,
+ });
} else {
- await this.setupTkey(importTssKey, loginResponse, false);
+ await this.setupTkey({
+ providedImportKey: importTssKey,
+ sfaLoginResponse: loginResponse,
+ userInfo,
+ importingSFAKey: true,
+ persistSessionSigs: true,
+ });
}
} catch (err: unknown) {
log.error("login error", err);
@@ -422,24 +445,26 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
// wait for prefetch completed before setup tkey
const [loginResponse] = await Promise.all([loginPromise, ...prefetchTssPubs]);
- const postBoxKey = this._getPostBoxKey(loginResponse);
-
- this.torusSp.postboxKey = new BN(postBoxKey, "hex");
-
- this.updateState({
- postBoxKey,
- postboxKeyNodeIndexes: loginResponse.nodesData?.nodeIndexes || [],
- userInfo: { ...parseToken(idToken), verifier, verifierId },
- signatures: this._getSignatures(loginResponse.sessionData.sessionTokenData),
- });
if (registerExistingSFAKey && loginResponse.finalKeyData.privKey) {
if (loginResponse.metadata.typeOfUser === "v1") {
throw CoreKitError.invalidConfig("Cannot register existing SFA key for v1 users, please contact web3auth support.");
}
const existingSFAKey = loginResponse.finalKeyData.privKey.padStart(64, "0");
- await this.setupTkey(existingSFAKey, loginResponse, true);
+ await this.setupTkey({
+ providedImportKey: existingSFAKey,
+ importingSFAKey: true,
+ sfaLoginResponse: loginResponse,
+ userInfo: { ...parseToken(idToken), verifier, verifierId },
+ persistSessionSigs: true,
+ });
} else {
- await this.setupTkey(importTssKey, loginResponse, false);
+ await this.setupTkey({
+ providedImportKey: importTssKey,
+ importingSFAKey: false,
+ sfaLoginResponse: loginResponse,
+ userInfo: { ...parseToken(idToken), verifier, verifierId },
+ persistSessionSigs: true,
+ });
}
} catch (err: unknown) {
log.error("login error", err);
@@ -462,43 +487,33 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
try {
const result = await this.torusSp.customAuthInstance.getRedirectResult();
let loginResponse: TorusLoginResponse | TorusAggregateLoginResponse;
+ let userInfo;
if (result.method === TORUS_METHOD.TRIGGER_LOGIN) {
loginResponse = result.result as TorusLoginResponse;
if (!loginResponse) {
throw CoreKitError.invalidTorusLoginResponse();
}
- this.updateState({
- postBoxKey: this._getPostBoxKey(loginResponse),
- postboxKeyNodeIndexes: loginResponse.nodesData?.nodeIndexes || [],
- userInfo: loginResponse.userInfo,
- signatures: this._getSignatures(loginResponse.sessionData.sessionTokenData),
- });
- const userInfo = this.getUserInfo();
+ userInfo = loginResponse.userInfo;
this.torusSp.verifierName = userInfo.verifier;
} else if (result.method === TORUS_METHOD.TRIGGER_AGGREGATE_LOGIN) {
loginResponse = result.result as TorusAggregateLoginResponse;
if (!loginResponse) {
throw CoreKitError.invalidTorusAggregateLoginResponse();
}
- this.updateState({
- postBoxKey: this._getPostBoxKey(loginResponse),
- postboxKeyNodeIndexes: loginResponse.nodesData?.nodeIndexes || [],
- userInfo: loginResponse.userInfo[0],
- signatures: this._getSignatures(loginResponse.sessionData.sessionTokenData),
- });
- const userInfo = this.getUserInfo();
+ userInfo = loginResponse.userInfo[0];
this.torusSp.verifierName = userInfo.aggregateVerifier;
} else {
throw CoreKitError.unsupportedRedirectMethod();
}
- const userInfo = this.getUserInfo();
- if (!this.state.postBoxKey) {
- throw CoreKitError.postBoxKeyMissing("postBoxKey not present in state after processing redirect result.");
- }
this.torusSp.postboxKey = new BN(this.state.postBoxKey, "hex");
this.torusSp.verifierId = userInfo.verifierId;
- await this.setupTkey();
+ await this.setupTkey({
+ importingSFAKey: false,
+ userInfo,
+ sfaLoginResponse: loginResponse,
+ persistSessionSigs: true,
+ });
} catch (error: unknown) {
this.resetState();
log.error("error while handling redirect result", error);
@@ -676,17 +691,37 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
/**
* Get public key in ed25519 format.
*
- * Throws an error if keytype is not compatible with ed25519.
+ * Throws an error if signature type is not ed25519.
*/
public getPubKeyEd25519(): Buffer {
+ if (this._sigType !== "ed25519") {
+ throw CoreKitError.default(`getPubKeyEd25519 not supported for signature type ${this.sigType}`);
+ }
+
const p = this.tkey.tssCurve.keyFromPublic(this.getPubKey()).getPublic();
return ed25519().keyFromPublic(p).getPublic();
}
- public async precompute_secp256k1(): Promise<{
+ /**
+ * Get public key in bip340 format.
+ *
+ * Throws an error if signature type is not bip340.
+ */
+ public getPubKeyBip340(): Buffer {
+ if (this._sigType !== "bip340") {
+ throw CoreKitError.default(`getPubKeyBip340 not supported for signature type ${this.sigType}`);
+ }
+
+ const p = this.tkey.tssCurve.keyFromPublic(this.getPubKey()).getPublic();
+ return p.getX().toBuffer("be", 32);
+ }
+
+ public async precompute_secp256k1(params?: { sessionSignatures?: string[] }): Promise<{
client: Client;
serverCoeffs: Record;
+ signatures: string[];
}> {
+ const { sessionSignatures } = params || {};
this.wasmLib = await this.loadTssWasm();
// PreSetup
const { tssShareIndex } = this.state;
@@ -735,7 +770,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
throw CoreKitError.activeSessionNotFound();
}
- const { signatures } = this;
+ const signatures = sessionSignatures || (await this.getSessionSignatures());
if (!signatures) {
throw CoreKitError.signaturesNotPresent();
}
@@ -755,6 +790,13 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
this.wasmLib as DKLSWasmLib
);
+ // Suppress client logs if logging is disabled.
+ client.log = (msg: string) => {
+ if (!this.enableLogging) return;
+ // eslint-disable-next-line no-console
+ console.log(msg);
+ };
+
const serverCoeffs: Record = {};
for (let i = 0; i < participatingServerDKGIndexes.length; i++) {
const serverIndex = participatingServerDKGIndexes[i];
@@ -768,16 +810,33 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
return {
client,
serverCoeffs,
+ signatures,
};
}
- public async sign(data: Buffer, hashed: boolean = false, secp256k1Precompute?: Secp256k1PrecomputedClient): Promise {
+ public async sign(
+ data: Buffer,
+ opts?: {
+ hashed?: boolean;
+ secp256k1Precompute?: Secp256k1PrecomputedClient;
+ keyTweak?: BN;
+ }
+ ): Promise {
this.wasmLib = await this.loadTssWasm();
- if (this.keyType === KeyType.secp256k1) {
- const sig = await this.sign_ECDSA_secp256k1(data, hashed, secp256k1Precompute);
+ if (this._sigType === "ecdsa-secp256k1") {
+ if (opts?.keyTweak) {
+ throw CoreKitError.default("key tweaking not supported for ecdsa-secp256k1");
+ }
+ const sig = await this.sign_ECDSA_secp256k1(data, opts?.hashed, opts?.secp256k1Precompute);
return Buffer.concat([sig.r, sig.s, Buffer.from([sig.v])]);
- } else if (this.keyType === KeyType.ed25519) {
- return this.sign_ed25519(data, hashed);
+ } else if (this._sigType === "ed25519" || this._sigType === "bip340") {
+ if (opts?.hashed) {
+ throw CoreKitError.default(`hashed data not supported for bip340`);
+ } else if (opts?.keyTweak && this._sigType !== "bip340") {
+ throw CoreKitError.default("key tweaking not supported for ed25519");
+ }
+
+ return this.sign_frost(data, opts?.keyTweak);
}
throw CoreKitError.default(`sign not supported for key type ${this.keyType}`);
}
@@ -802,7 +861,8 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
throw CoreKitError.factorInUseCannotBeDeleted("Cannot delete current active factor");
}
- await this.tKey.deleteFactorPub({ factorKey: this.state.factorKey, deleteFactorPub: factorPub, authSignatures: this.signatures });
+ const authSignatures = await this.getSessionSignatures();
+ await this.tKey.deleteFactorPub({ factorKey: this.state.factorKey, deleteFactorPub: factorPub, authSignatures });
const factorPubHex = fpp.toSEC1(factorKeyCurve, true).toString("hex");
const allDesc = this.tKey.metadata.getShareDescription();
const keyDesc = allDesc[factorPubHex];
@@ -831,6 +891,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
this.resetState();
await this.init({ handleRedirectResult: false, rehydrate: false });
+ this.stateEmitter.emit("LOGOUT");
}
public getUserInfo(): UserInfo {
@@ -918,12 +979,9 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
*
* Exports the private key scalar for the current account index.
*
- * For keytype ed25519, consider using _UNSAFE_exportTssEd25519Seed.
+ * For signature type ed25519, consider using _UNSAFE_exportTssEd25519Seed.
*/
public async _UNSAFE_exportTssKey(): Promise {
- if (this.keyType !== KeyType.secp256k1) {
- throw CoreKitError.default("Wrong KeyType. Method can only be used when KeyType is secp256k1");
- }
if (!this.state.factorKey) {
throw CoreKitError.factorKeyNotPresent("factorKey not present in state when exporting tss key.");
}
@@ -949,8 +1007,8 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
* flow has been used.
*/
public async _UNSAFE_exportTssEd25519Seed(): Promise {
- if (this.keyType !== KeyType.ed25519) {
- throw CoreKitError.default("Wrong KeyType. Method can only be used when KeyType is ed25519");
+ if (this._sigType !== "ed25519") {
+ throw CoreKitError.default("Wrong signature type. Method can only be used when signature type is ed25519.");
}
if (!this.state.factorKey) throw CoreKitError.factorKeyNotPresent("factorKey not present in state when exporting tss ed25519 seed.");
if (!this.state.signatures) throw CoreKitError.signaturesNotPresent("Signatures not present in state when exporting tss ed25519 seed.");
@@ -971,6 +1029,62 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
this.state = { ...this.state, ...newState };
}
+ public async setupTkey(params?: {
+ providedImportKey?: string;
+ sfaLoginResponse?: TorusKey | TorusLoginResponse | TorusAggregateLoginResponse;
+ userInfo?: UserInfo;
+ importingSFAKey?: boolean;
+ persistSessionSigs?: boolean;
+ }): Promise {
+ const { providedImportKey, sfaLoginResponse, userInfo, importingSFAKey, persistSessionSigs } = params;
+ if (importingSFAKey && !sfaLoginResponse) {
+ throw CoreKitError.default("SFA key registration requires SFA login response");
+ }
+ const postBoxKey = this._getPostBoxKey(sfaLoginResponse);
+ this.torusSp.postboxKey = new BN(postBoxKey, "hex");
+ this.updateState({
+ postBoxKey,
+ postboxKeyNodeIndexes: sfaLoginResponse.nodesData?.nodeIndexes,
+ userInfo,
+ signatures: persistSessionSigs ? this.extractSessionSignatures(sfaLoginResponse.sessionData.sessionTokenData) : [],
+ });
+ const sp = this.tkey.serviceProvider;
+ if (!sp) {
+ throw new Error("Oauth Service provider is missing in tkey");
+ }
+ if (!sp?.verifierId) {
+ sp.verifierId = userInfo.verifierId;
+ }
+ if (!sp?.verifierName) {
+ sp.verifierName = userInfo.aggregateVerifier || userInfo.verifier;
+ }
+
+ const existingUser = await this.isMetadataPresent(this.state.postBoxKey);
+ let importKey = providedImportKey;
+ if (!existingUser) {
+ if (!importKey && this.useClientGeneratedTSSKey) {
+ if (this.keyType === KeyType.ed25519) {
+ const k = generateEd25519Seed();
+ importKey = k.toString("hex");
+ } else if (this.keyType === KeyType.secp256k1) {
+ const k = secp256k1.genKeyPair().getPrivate();
+ importKey = scalarBNToBufferSEC1(k).toString("hex");
+ } else {
+ throw CoreKitError.default(`Unsupported key type and sig type combination: ${this.keyType}, ${this._sigType}`);
+ }
+ }
+ if (importingSFAKey && sfaLoginResponse && sfaLoginResponse.metadata.upgraded) {
+ throw CoreKitError.default("SFA key registration is not allowed for already upgraded users");
+ }
+ await this.handleNewUser(importKey, importingSFAKey);
+ } else {
+ if (importKey) {
+ throw CoreKitError.tssKeyImportNotAllowed();
+ }
+ await this.handleExistingUser();
+ }
+ }
+
protected async atomicSync(f: () => Promise): Promise {
this.atomicCallStackCounter += 1;
@@ -1012,43 +1126,6 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
return tssNonce;
}
- private async setupTkey(
- providedImportKey?: string,
- sfaLoginResponse?: TorusKey | TorusLoginResponse | TorusAggregateLoginResponse,
- importingSFAKey?: boolean
- ): Promise {
- if (importingSFAKey && !sfaLoginResponse) {
- throw CoreKitError.default("SFA key registration requires SFA login response");
- }
- if (!this.state.postBoxKey) {
- throw CoreKitError.userNotLoggedIn();
- }
- const existingUser = await this.isMetadataPresent(this.state.postBoxKey);
- let importKey = providedImportKey;
- if (!existingUser) {
- if (!importKey && this.useClientGeneratedTSSKey) {
- if (this.keyType === KeyType.ed25519) {
- const k = generateEd25519Seed();
- importKey = k.toString("hex");
- } else if (this.keyType === KeyType.secp256k1) {
- const k = secp256k1.genKeyPair().getPrivate();
- importKey = scalarBNToBufferSEC1(k).toString("hex");
- } else {
- throw CoreKitError.default("Unsupported key type");
- }
- }
- if (importingSFAKey && sfaLoginResponse && sfaLoginResponse.metadata.upgraded) {
- throw CoreKitError.default("SFA key registration is not allowed for already upgraded users");
- }
- await this.handleNewUser(importKey, importingSFAKey);
- } else {
- if (importKey) {
- throw CoreKitError.tssKeyImportNotAllowed();
- }
- await this.handleExistingUser();
- }
- }
-
// mutation function
private async handleNewUser(importTssKey?: string, isSfaKey?: boolean) {
await this.atomicSync(async () => {
@@ -1204,13 +1281,14 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
if (!postBoxKey || !factorKey || !tssShare || !tssPubKey || !userInfo) {
throw CoreKitError.userNotLoggedIn();
}
+ const sessionSigs = this.state.signatures;
const payload: SessionData = {
postBoxKey,
postboxKeyNodeIndexes: postboxKeyNodeIndexes || [],
factorKey: factorKey?.toString("hex"),
tssShareIndex: tssShareIndex as number,
tssPubKey: Buffer.from(tssPubKey).toString("hex"),
- signatures: this.signatures,
+ signatures: sessionSigs,
userInfo,
};
await this.sessionManager.createSession(payload);
@@ -1271,11 +1349,11 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
if (this.tKey.metadata.factorPubs[this.tKey.tssTag].length >= MAX_FACTORS) {
throw CoreKitError.maximumFactorsReached(`The maximum number of allowable factors (${MAX_FACTORS}) has been reached.`);
}
-
+ const authSignatures = await this.getSessionSignatures();
// Generate new share.
await this.tkey.addFactorPub({
existingFactorKey: this.state.factorKey,
- authSignatures: this.signatures,
+ authSignatures,
newFactorPub,
newTSSIndex: newFactorTSSIndex,
refreshShares: this.state.tssShareIndex !== newFactorTSSIndex, // Refresh shares if we have a new factor key index.
@@ -1357,7 +1435,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
return TorusUtils.getPostboxKey(result);
}
- private _getSignatures(sessionData: TorusKey["sessionData"]["sessionTokenData"]): string[] {
+ private extractSessionSignatures(sessionData: TorusKey["sessionData"]["sessionTokenData"]): string[] {
// There is a check in torus.js which pushes undefined to session data in case
// that particular node call fails.
// and before returning we are not filtering out undefined vals in torus.js
@@ -1411,9 +1489,8 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
}
const isAlreadyPrecomputed = precomputedTssClient?.client && precomputedTssClient?.serverCoeffs;
- const { client, serverCoeffs } = isAlreadyPrecomputed ? precomputedTssClient : await this.precompute_secp256k1();
+ const { client, serverCoeffs, signatures } = isAlreadyPrecomputed ? precomputedTssClient : await this.precompute_secp256k1();
- const { signatures } = this;
if (!signatures) {
throw CoreKitError.signaturesNotPresent();
}
@@ -1425,43 +1502,46 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
throw error;
}
// Retry with new client if precomputed client failed, this is to handle the case when precomputed session might have expired
- const { client: newClient, serverCoeffs: newServerCoeffs } = await this.precompute_secp256k1();
+ const { client: newClient, serverCoeffs: newServerCoeffs } = await this.precompute_secp256k1({ sessionSignatures: signatures });
const result = await executeSign(newClient, newServerCoeffs, data, signatures);
return result;
}
}
- private async sign_ed25519(data: Buffer, hashed: boolean = false): Promise {
- if (hashed) {
- throw CoreKitError.default("hashed data not supported for ed25519");
- }
-
- const nodeDetails = fetchLocalConfig(this.options.web3AuthNetwork, "ed25519");
+ private async sign_frost(data: Buffer, keyTweak?: BN): Promise {
+ const nodeDetails = fetchLocalConfig(this.options.web3AuthNetwork, this.keyType, this._sigType);
if (!nodeDetails.torusNodeTSSEndpoints) {
throw CoreKitError.default("could not fetch tss node endpoints");
}
// Endpoints must end with backslash, but URLs returned by
// `fetch-node-details` don't have it.
- const ED25519_ENDPOINTS = nodeDetails.torusNodeTSSEndpoints.map((ep, i) => ({ index: nodeDetails.torusIndexes[i], url: `${ep}/` }));
+ const serverEndpoints = nodeDetails.torusNodeTSSEndpoints.map((ep, i) => ({ index: nodeDetails.torusIndexes[i], url: `${ep}/` }));
// Select endpoints and derive party indices.
- const serverThreshold = Math.floor(ED25519_ENDPOINTS.length / 2) + 1;
- const endpoints = sampleEndpoints(ED25519_ENDPOINTS, serverThreshold);
+ const serverThreshold = Math.floor(serverEndpoints.length / 2) + 1;
+ const endpoints = sampleEndpoints(serverEndpoints, serverThreshold);
const serverXCoords = endpoints.map((x) => x.index);
const clientXCoord = Math.max(...endpoints.map((ep) => ep.index)) + 1;
// Derive share coefficients for flat hierarchy.
- const ec = new Ed25519Curve();
+ const ec = (() => {
+ if (this.keyType === KeyType.secp256k1) {
+ return new Secp256k1Curve();
+ } else if (this.keyType === KeyType.ed25519) {
+ return new Ed25519Curve();
+ }
+ throw CoreKitError.default(`key type ${this.keyType} not supported with FROST signing`);
+ })();
const { serverCoefficients, clientCoefficient } = deriveShareCoefficients(ec, serverXCoords, clientXCoord, this.state.tssShareIndex);
// Get pub key.
- const tssPubKey = await this.getPubKey();
+ const tssPubKey = this.getPubKey();
const tssPubKeyPoint = ec.keyFromPublic(tssPubKey).getPublic();
// Get client key share and adjust by coefficient.
- if (this.state.accountIndex !== 0) {
+ if (this._sigType === "ed25519" && this.state.accountIndex !== 0) {
throw CoreKitError.default("Account index not supported for ed25519");
}
const { tssShare } = await this.tKey.getTSSShare(this.state.factorKey);
@@ -1477,17 +1557,19 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
const serverURLs = endpoints.map((x) => x.url);
const pubKeyHex = ec.pointToBuffer(tssPubKeyPoint, Buffer).toString("hex");
const serverCoefficientsHex = serverCoefficients.map((c) => ec.scalarToBuffer(c, Buffer).toString("hex"));
- const signature = await signEd25519(
- this.wasmLib as FrostWasmLib,
+ const authSignatures = await this.getSessionSignatures();
+ const signature = await signFrost(
+ this.wasmLib as FrostWasmLibEd25519 | FrostWasmLibBip340,
session,
- this.signatures,
+ authSignatures,
serverXCoords,
serverURLs,
clientXCoord,
clientShareAdjustedHex,
pubKeyHex,
data,
- serverCoefficientsHex
+ serverCoefficientsHex,
+ keyTweak?.toString("hex")
);
log.info(`signature: ${signature}`);
@@ -1496,11 +1578,6 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
private async loadTssWasm() {
if (this.wasmLib) return this.wasmLib;
- if (typeof (this._tssLib as V4TSSLibType).load === "function") {
- // dont wait for wasm to be loaded, we can reload it during signing if not loaded
- return (this._tssLib as V4TSSLibType).load();
- } else if ((this._tssLib as V3TSSLibType).lib) {
- return (this._tssLib as V3TSSLibType).lib as DKLSWasmLib | FrostWasmLib;
- }
+ return this._tssLib.load();
}
}
diff --git a/src/plugins/DefaultSessionSigGenerator.ts b/src/plugins/DefaultSessionSigGenerator.ts
new file mode 100644
index 00000000..a0e40894
--- /dev/null
+++ b/src/plugins/DefaultSessionSigGenerator.ts
@@ -0,0 +1,14 @@
+import { IMPCContext } from "../interfaces";
+import { ISessionSigGenerator } from "./ISessionSigGenerator";
+
+export class DefaultSessionSigGeneratorPlugin implements ISessionSigGenerator {
+ private context: IMPCContext;
+
+ constructor(readonly mpcCorekitContext: IMPCContext) {
+ this.context = mpcCorekitContext;
+ }
+
+ async getSessionSigs() {
+ return this.context.state.signatures || [];
+ }
+}
diff --git a/src/plugins/ISessionSigGenerator.ts b/src/plugins/ISessionSigGenerator.ts
new file mode 100644
index 00000000..efa40c4f
--- /dev/null
+++ b/src/plugins/ISessionSigGenerator.ts
@@ -0,0 +1,3 @@
+export interface ISessionSigGenerator {
+ getSessionSigs: () => Promise;
+}
diff --git a/src/plugins/index.ts b/src/plugins/index.ts
new file mode 100644
index 00000000..789c86a3
--- /dev/null
+++ b/src/plugins/index.ts
@@ -0,0 +1,2 @@
+export * from "./DefaultSessionSigGenerator";
+export * from "./ISessionSigGenerator";
diff --git a/src/utils.ts b/src/utils.ts
index 16139d1e..43179a35 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -201,7 +201,7 @@ export function makeEthereumSigner(kit: CoreKitSigner): EthereumSigner {
}
return {
sign: async (msgHash: Buffer) => {
- const sig = await kit.sign(msgHash, true);
+ const sig = await kit.sign(msgHash, { hashed: true });
return sigToRSV(sig);
},
getPublic: async () => {
diff --git a/tests/backwardCompatible.spec.ts b/tests/backwardCompatible.spec.ts
index c2468de5..5c244c6d 100644
--- a/tests/backwardCompatible.spec.ts
+++ b/tests/backwardCompatible.spec.ts
@@ -119,7 +119,7 @@ variable.forEach((testVariable) => {
const msg = "hello world";
const msgBuffer = Buffer.from(msg);
const msgHash = keccak256(msgBuffer);
- const signature = sigToRSV(await coreKitInstance.sign(msgHash, true));
+ const signature = sigToRSV(await coreKitInstance.sign(msgHash, { hashed: true } ));
const secp256k1 = new EC("secp256k1");
const pubkey = secp256k1.recoverPubKey(msgHash, signature, signature.v) as EllipticPoint;
diff --git a/tests/bip340.spec.ts b/tests/bip340.spec.ts
new file mode 100644
index 00000000..298d1009
--- /dev/null
+++ b/tests/bip340.spec.ts
@@ -0,0 +1,153 @@
+import assert from "node:assert";
+import test from "node:test";
+
+import { EllipticPoint } from "@tkey/common-types";
+import { UX_MODE_TYPE } from "@toruslabs/customauth";
+import { tssLib } from "@toruslabs/tss-frost-lib-bip340";
+import BN from "bn.js";
+import { schnorr as bip340 } from '@noble/curves/secp256k1';
+
+import { AsyncStorage, COREKIT_STATUS, MemoryStorage, WEB3AUTH_NETWORK, WEB3AUTH_NETWORK_TYPE, Web3AuthMPCCoreKit } from "../src";
+import { bufferToElliptic, criticalResetAccount, mockLogin, mockLogin2 } from "./setup";
+
+type TestVariable = {
+ web3AuthNetwork: WEB3AUTH_NETWORK_TYPE;
+ uxMode: UX_MODE_TYPE | "nodejs";
+ manualSync?: boolean;
+ email: string;
+};
+
+const defaultTestEmail = "testEmailForLoginBip340";
+const variable: TestVariable[] = [
+ { web3AuthNetwork: WEB3AUTH_NETWORK.DEVNET, uxMode: "nodejs", email: defaultTestEmail },
+ // { web3AuthNetwork: WEB3AUTH_NETWORK.MAINNET, uxMode: UX_MODE.REDIRECT, email: defaultTestEmail },
+
+ { web3AuthNetwork: WEB3AUTH_NETWORK.DEVNET, uxMode: "nodejs", manualSync: true, email: defaultTestEmail },
+ // { web3AuthNetwork: WEB3AUTH_NETWORK.MAINNET, uxMode: UX_MODE.REDIRECT, manualSync: true, email: defaultTestEmail },
+];
+
+const checkLogin = async (coreKitInstance: Web3AuthMPCCoreKit, accountIndex = 0) => {
+ const keyDetails = coreKitInstance.getKeyDetails();
+ assert.strictEqual(coreKitInstance.status, COREKIT_STATUS.LOGGED_IN);
+ assert.strictEqual(keyDetails.requiredFactors, 0);
+ const factorkey = coreKitInstance.getCurrentFactorKey();
+ await coreKitInstance.tKey.getTSSShare(new BN(factorkey.factorKey, "hex"), {
+ accountIndex,
+ });
+};
+
+const storageInstance = new MemoryStorage();
+
+variable.forEach((testVariable) => {
+ const { web3AuthNetwork, uxMode, manualSync, email } = testVariable;
+ const newCoreKitInstance = () =>
+ new Web3AuthMPCCoreKit({
+ web3AuthClientId: "torus-key-test",
+ web3AuthNetwork,
+ baseUrl: "http://localhost:3000",
+ uxMode,
+ tssLib,
+ storage: storageInstance,
+ manualSync,
+ });
+
+ async function resetAccount() {
+ const resetInstance = newCoreKitInstance();
+ const { idToken, parsedToken } = await mockLogin(email);
+ await resetInstance.init({ handleRedirectResult: false, rehydrate: false });
+ await resetInstance.loginWithJWT({
+ verifier: "torus-test-health",
+ verifierId: parsedToken.email,
+ idToken,
+ });
+ await criticalResetAccount(resetInstance);
+ await new AsyncStorage(resetInstance._storageKey, storageInstance).resetStore();
+ }
+
+ const testNameSuffix = JSON.stringify(testVariable);
+
+ let checkPubKey: EllipticPoint;
+ let checkTssShare: BN;
+
+ test(`#Login Test with JWT + logout: ${testNameSuffix}`, async (t) => {
+ await resetAccount();
+ await t.test("#Login", async function () {
+ const coreKitInstance = newCoreKitInstance();
+
+ // mocklogin
+ const { idToken, parsedToken } = await mockLogin(email);
+ await coreKitInstance.init({ handleRedirectResult: false });
+ await coreKitInstance.loginWithJWT({
+ verifier: "torus-test-health",
+ verifierId: parsedToken.email,
+ idToken,
+ });
+ // get key details
+ await checkLogin(coreKitInstance);
+
+ checkPubKey = bufferToElliptic(coreKitInstance.getPubKey(), coreKitInstance.tKey.tssCurve);
+ const factorkey = coreKitInstance.getCurrentFactorKey();
+ const { tssShare } = await coreKitInstance.tKey.getTSSShare(new BN(factorkey.factorKey, "hex"), {
+ threshold: 0,
+ });
+ checkTssShare = tssShare;
+
+ if (manualSync) {
+ await coreKitInstance.commitChanges();
+ }
+ // check whether the public key and tss share is same as old sdks
+ });
+
+ await t.test("#relogin ", async function () {
+ const coreKitInstance = newCoreKitInstance();
+ // rehydrate
+ await coreKitInstance.init({ handleRedirectResult: false });
+ await checkLogin(coreKitInstance);
+
+ // logout
+ await coreKitInstance.logout();
+
+ // rehydrate should fail
+ await coreKitInstance.init({
+ rehydrate: false,
+ handleRedirectResult: false,
+ });
+ assert.strictEqual(coreKitInstance.status, COREKIT_STATUS.INITIALIZED);
+ assert.throws(() => coreKitInstance.getCurrentFactorKey());
+
+ // relogin
+ const { idToken, parsedToken } = await mockLogin(email);
+ await coreKitInstance.loginWithJWT({
+ verifier: "torus-test-health",
+ verifierId: parsedToken.email,
+ idToken,
+ });
+
+ // get key details
+ await checkLogin(coreKitInstance);
+ const newPubKey = bufferToElliptic(coreKitInstance.getPubKey(), coreKitInstance.tKey.tssCurve);
+ const factorkey = coreKitInstance.getCurrentFactorKey();
+ const { tssShare: newTssShare } = await coreKitInstance.tKey.getTSSShare(new BN(factorkey.factorKey, "hex"));
+ assert(checkPubKey.eq(newPubKey));
+ assert(checkTssShare.eq(newTssShare));
+ });
+
+ await t.test("#able to sign", async function () {
+ const coreKitInstance = newCoreKitInstance();
+ await coreKitInstance.init({ handleRedirectResult: false, rehydrate: false });
+ const localToken = await mockLogin2(email);
+ await coreKitInstance.loginWithJWT({
+ verifier: "torus-test-health",
+ verifierId: email,
+ idToken: localToken.idToken,
+ });
+ const msg = "hello world";
+ const msgBuffer = Buffer.from(msg);
+
+ const signature = await coreKitInstance.sign(msgBuffer);
+ const pk = coreKitInstance.getPubKeyBip340();
+ const valid = bip340.verify(signature, msgBuffer, pk);
+ assert(valid);
+ });
+ });
+});
diff --git a/tests/login.spec.ts b/tests/login.spec.ts
index 56a48512..33a45ef3 100644
--- a/tests/login.spec.ts
+++ b/tests/login.spec.ts
@@ -157,7 +157,7 @@ variable.forEach((testVariable) => {
const secp256k1 = new EC("secp256k1");
// Sign hash.
- const signature = sigToRSV(await coreKitInstance.sign(msgHash, true));
+ const signature = sigToRSV(await coreKitInstance.sign(msgHash, { hashed: true }));
const pubkey = secp256k1.recoverPubKey(msgHash, signature, signature.v) as EllipticPoint;
const publicKeyPoint = bufferToElliptic(coreKitInstance.getPubKey());
assert(pubkey.eq(publicKeyPoint));
@@ -186,7 +186,7 @@ variable.forEach((testVariable) => {
const msg = "hello world 1";
const msgBuffer = Buffer.from(msg);
const msgHash = keccak256(msgBuffer);
- const signature1 = sigToRSV(await coreKitInstance.sign(msgHash, true));
+ const signature1 = sigToRSV(await coreKitInstance.sign(msgHash, { hashed: true }));
const pubkeyIndex0 = secp256k1.recoverPubKey(msgHash, signature1, signature1.v);
const publicKeyPoint0 = bufferToElliptic(coreKitInstance.getPubKey());
@@ -198,7 +198,7 @@ variable.forEach((testVariable) => {
const msgBuffer1 = Buffer.from(msg1);
const msgHash1 = keccak256(msgBuffer1);
- const signature2 = sigToRSV(await coreKitInstance.sign(msgHash1, true));
+ const signature2 = sigToRSV(await coreKitInstance.sign(msgHash1, { hashed: true }));
const pubkeyIndex1 = secp256k1.recoverPubKey(msgHash1, signature2, signature2.v) as EllipticPoint;
const publicKeyPoint1 = bufferToElliptic(coreKitInstance.getPubKey());
@@ -211,7 +211,7 @@ variable.forEach((testVariable) => {
const msg2 = "hello world 3";
const msgBuffer2 = Buffer.from(msg2);
const msgHash2 = keccak256(msgBuffer2);
- const signature3 = sigToRSV(await coreKitInstance.sign(msgHash2, true));
+ const signature3 = sigToRSV(await coreKitInstance.sign(msgHash2, { hashed: true }));
const pubkeyIndex2 = secp256k1.recoverPubKey(msgHash2, signature3, signature3.v) as EllipticPoint;
const publicKeyPoint2 = bufferToElliptic(coreKitInstance.getPubKey());
diff --git a/tests/sessionTime.spec.ts b/tests/sessionTime.spec.ts
index 685fb2a7..f649fbdc 100644
--- a/tests/sessionTime.spec.ts
+++ b/tests/sessionTime.spec.ts
@@ -57,25 +57,25 @@ const variable: TestVariable[] = [
},
];
-const storageInstance = new MemoryStorage();
variable.forEach(async (testVariable) => {
const { web3AuthNetwork, uxMode, manualSync, email, web3ClientID: web3AuthClientId, sessionTime, disableSessionManager } = testVariable;
await test(`#Variable SessionTime test : ${JSON.stringify({ sessionTime: testVariable.sessionTime })} - disableSessionManager: ${disableSessionManager} client_id: ${web3AuthClientId}`, async (t) => {
- const coreKitInstance = new Web3AuthMPCCoreKit({
- web3AuthClientId,
- web3AuthNetwork,
- baseUrl: "http://localhost:3000",
- uxMode,
- tssLib,
- storage: storageInstance,
- manualSync,
- sessionTime,
- disableSessionManager,
- });
+ let coreKitInstance : Web3AuthMPCCoreKit;
async function beforeTest() {
+ coreKitInstance = new Web3AuthMPCCoreKit({
+ web3AuthClientId,
+ web3AuthNetwork,
+ baseUrl: "http://localhost:3000",
+ uxMode,
+ tssLib,
+ storage: new MemoryStorage(),
+ manualSync,
+ sessionTime,
+ disableSessionManager,
+ });
if (coreKitInstance.status === COREKIT_STATUS.INITIALIZED) await criticalResetAccount(coreKitInstance);
}
@@ -110,7 +110,7 @@ variable.forEach(async (testVariable) => {
return;
}
- coreKitInstance.signatures.forEach((sig) => {
+ (await coreKitInstance.getSessionSignatures()).forEach((sig) => {
const parsedSig = JSON.parse(sig);
const parsedSigData = JSON.parse(atob(parsedSig.data));
@@ -127,7 +127,5 @@ variable.forEach(async (testVariable) => {
assert.notEqual(coreKitInstance.sessionId , undefined);
}
});
-
-
});
});
diff --git a/tests/setup.ts b/tests/setup.ts
index ab677bff..8b6adc5f 100644
--- a/tests/setup.ts
+++ b/tests/setup.ts
@@ -3,6 +3,7 @@ import { tssLib } from "@toruslabs/tss-dkls-lib";
import BN from "bn.js";
import jwt, { Algorithm } from "jsonwebtoken";
import { tssLib as tssLibDKLS } from "@toruslabs/tss-dkls-lib";
+import { TorusKey } from "@toruslabs/torus.js";
import { IAsyncStorage, IStorage, parseToken, TssLibType, WEB3AUTH_NETWORK_TYPE, Web3AuthMPCCoreKit } from "../src";
@@ -139,7 +140,7 @@ export const loginWithSFA = async ({
storageInstance: IStorage | IAsyncStorage;
tssLib?: TssLibType;
login?: LoginFunc;
-}) => {
+}): Promise => {
const instance = new Web3AuthMPCCoreKit({
web3AuthClientId: "torus-key-test",
web3AuthNetwork: network,