From cea9d89c0e1a5f5a3d9705bada5d27bfd3d93bb5 Mon Sep 17 00:00:00 2001 From: guru-web3 <105355858+guru-web3@users.noreply.github.com> Date: Mon, 5 Feb 2024 09:12:09 +0530 Subject: [PATCH] feat: soft nonce implementation --- package-lock.json | 7 + .../src/baseTypes/aggregateTypes.ts | 3 + packages/core/package.json | 1 + packages/core/src/core.ts | 49 ++++++- packages/core/src/metadata.ts | 14 +- packages/default/test/shared.js | 134 ++++++++++++++---- 6 files changed, 171 insertions(+), 37 deletions(-) diff --git a/package-lock.json b/package-lock.json index 15360ce9..bd013d9a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8092,6 +8092,12 @@ "node": ">= 8" } }, + "node_modules/crypto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz", + "integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==", + "deprecated": "This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in." + }, "node_modules/crypto-browserify": { "version": "3.12.0", "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", @@ -24286,6 +24292,7 @@ "@toruslabs/rss-client": "^1.5.0", "@toruslabs/torus.js": "^11.0.6", "bn.js": "^5.2.1", + "crypto": "^1.0.1", "elliptic": "^6.5.4", "json-stable-stringify": "^1.0.2" }, diff --git a/packages/common-types/src/baseTypes/aggregateTypes.ts b/packages/common-types/src/baseTypes/aggregateTypes.ts index 71293e4d..5b5937e0 100644 --- a/packages/common-types/src/baseTypes/aggregateTypes.ts +++ b/packages/common-types/src/baseTypes/aggregateTypes.ts @@ -79,6 +79,8 @@ export interface IMetadata extends ISerializable { nonce: number; + chainCode?: string; + getShareIndexesForPolynomial(polyID: PolynomialID): string[]; getLatestPublicPolynomial(): PublicPolynomial; addTSSData(tssData: { @@ -89,6 +91,7 @@ export interface IMetadata extends ISerializable { factorEncs?: { [factorPubID: string]: FactorEnc; }; + chainCode?: string; }): void; addPublicShare(polynomialID: PolynomialID, publicShare: PublicShare): void; setGeneralStoreDomain(key: string, obj: unknown): void; diff --git a/packages/core/package.json b/packages/core/package.json index 05f692cd..e9d79bf1 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -40,6 +40,7 @@ "@toruslabs/rss-client": "^1.5.0", "@toruslabs/torus.js": "^11.0.6", "bn.js": "^5.2.1", + "crypto": "^1.0.1", "elliptic": "^6.5.4", "json-stable-stringify": "^1.0.2" }, diff --git a/packages/core/src/core.ts b/packages/core/src/core.ts index de076927..ca125b81 100644 --- a/packages/core/src/core.ts +++ b/packages/core/src/core.ts @@ -52,7 +52,9 @@ import { toPrivKeyECC, } from "@tkey-mpc/common-types"; import { generatePrivate } from "@toruslabs/eccrypto"; +import { keccak256 } from "@toruslabs/torus.js"; import BN from "bn.js"; +import crypto from "crypto"; import stringify from "json-stable-stringify"; import AuthMetadata from "./authMetadata"; @@ -66,7 +68,6 @@ import { lagrangeInterpolation, } from "./lagrangeInterpolatePolynomial"; import Metadata from "./metadata"; - // TODO: handle errors for get and set with retries class ThresholdKey implements ITKey { @@ -226,6 +227,19 @@ class ThresholdKey implements ITKey { throw CoreError.metadataUndefined(); } + computeNonce(index: number) { + // generation should occur during tkey.init, fails if chaincode is absent + const { chainCode } = this.metadata; + if (!chainCode) { + throw CoreError.default("chainCode is absent, required for nonce generation"); + } + return new BN(keccak256(Buffer.from(`${index}${chainCode}`)).slice(2), "hex").umod(ecCurve.curve.n); + } + + generateSalt(length = 32) { + return crypto.randomBytes(length).toString("hex"); + } + async initialize(params?: { withShare?: ShareStore; importKey?: BN; @@ -300,7 +314,8 @@ class ThresholdKey implements ITKey { }); if (useTSS) { const { factorEncs, factorPubs, tssPolyCommits } = await this._initializeNewTSSKey(this.tssTag, deviceTSSShare, factorPub, deviceTSSIndex); - this.metadata.addTSSData({ tssTag: this.tssTag, tssNonce: 0, tssPolyCommits, factorPubs, factorEncs }); + const chainCode = this.generateSalt(); + this.metadata.addTSSData({ tssTag: this.tssTag, tssNonce: 0, tssPolyCommits, factorPubs, factorEncs, chainCode }); } return this.getKeyDetails(); } @@ -385,7 +400,7 @@ class ThresholdKey implements ITKey { * getTSSShare accepts a factorKey and returns the TSS share based on the factor encrypted TSS shares in the metadata * @param factorKey - factor key */ - async getTSSShare(factorKey: BN, opts?: { threshold: number }): Promise<{ tssIndex: number; tssShare: BN }> { + async getTSSShare(factorKey: BN, opts?: { threshold: number; accountIndex?: number }): Promise<{ tssIndex: number; tssShare: BN }> { if (!this.privKey) throw CoreError.default("tss share cannot be returned until you've reconstructed tkey"); const factorPub = getPubKeyPoint(factorKey); const factorEncs = this.getFactorEncs(factorPub); @@ -407,6 +422,7 @@ class ThresholdKey implements ITKey { const userDec = tssShareBNs[0]; + const { threshold, accountIndex } = opts || {}; if (type === "direct") { const tssSharePub = ecCurve.g.mul(userDec); const tssCommitA0 = ecCurve.keyFromPublic({ x: tssCommits[0].x.toString(16, 64), y: tssCommits[0].y.toString(16, 64) }).getPublic(); @@ -416,6 +432,11 @@ class ThresholdKey implements ITKey { _tssSharePub = _tssSharePub.add(tssCommitA1); } if (tssSharePub.getX().cmp(_tssSharePub.getX()) === 0 && tssSharePub.getY().cmp(_tssSharePub.getY()) === 0) { + if (accountIndex && accountIndex > 0) { + const nonce = this.computeNonce(accountIndex); + const derivedShare = userDec.add(nonce).umod(ecCurve.n); + return { tssIndex, tssShare: derivedShare }; + } return { tssIndex, tssShare: userDec }; } throw new Error("user decryption does not match tss commitments..."); @@ -425,8 +446,6 @@ class ThresholdKey implements ITKey { const serverDecs = tssShareBNs.slice(1); // 5 elems const serverIndexes = new Array(serverDecs.length).fill(null).map((_, i) => i + 1); - const { threshold } = opts || {}; - const combis = kCombinations(serverDecs.length, threshold || Math.ceil(serverDecs.length / 2)); for (let i = 0; i < combis.length; i++) { const combi = combis[i]; @@ -445,6 +464,14 @@ class ThresholdKey implements ITKey { for (let j = 0; j < tssIndex; j++) { _tssSharePub = _tssSharePub.add(tssCommitA1); } + if (accountIndex && accountIndex > 0) { + const nonce = this.computeNonce(accountIndex); + const derivedShare = tssShare.add(nonce).umod(ecCurve.n); + if (tssSharePub.getX().cmp(_tssSharePub.getX()) === 0 && tssSharePub.getY().cmp(_tssSharePub.getY()) === 0) { + return { tssIndex, tssShare: derivedShare }; + } + } + if (tssSharePub.getX().cmp(_tssSharePub.getX()) === 0 && tssSharePub.getY().cmp(_tssSharePub.getY()) === 0) { return { tssIndex, tssShare }; } @@ -461,7 +488,17 @@ class ThresholdKey implements ITKey { return tssPolyCommits; } - getTSSPub(): Point { + getTSSPub(accountIndex?: number): Point { + if (accountIndex && accountIndex > 0) { + const nonce = this.computeNonce(accountIndex); + // we need to add the pub key nonce to the tssPub + const noncePub = ecCurve.keyFromPrivate(nonce.toString("hex")).getPublic(); + const pubKeyPoint = ecCurve + .keyFromPublic({ x: this.getTSSCommits()[0].x.toString("hex"), y: this.getTSSCommits()[0].y.toString("hex") }) + .getPublic(); + const dervicepubKeyPoint = pubKeyPoint.add(noncePub); + return new Point(dervicepubKeyPoint.getX().toString("hex"), dervicepubKeyPoint.getY().toString("hex")); + } return this.getTSSCommits()[0]; } diff --git a/packages/core/src/metadata.ts b/packages/core/src/metadata.ts index 2c1cde09..5adc2796 100644 --- a/packages/core/src/metadata.ts +++ b/packages/core/src/metadata.ts @@ -68,6 +68,9 @@ class Metadata implements IMetadata { }; }; + // salt + chainCode?: string; + constructor(input: Point) { this.tssPolyCommits = {}; this.tssNonces = {}; @@ -84,7 +87,7 @@ class Metadata implements IMetadata { } static fromJSON(value: StringifiedType): Metadata { - const { pubKey, polyIDList, generalStore, tkeyStore, scopedStore, nonce, tssNonces, tssPolyCommits, factorPubs, factorEncs } = value; + const { pubKey, polyIDList, generalStore, tkeyStore, scopedStore, nonce, tssNonces, tssPolyCommits, factorPubs, factorEncs, chainCode } = value; const point = Point.fromCompressedPub(pubKey); const metadata = new Metadata(point); const unserializedPolyIDList: PolyIDAndShares[] = []; @@ -93,6 +96,7 @@ class Metadata implements IMetadata { if (tkeyStore) metadata.tkeyStore = tkeyStore; if (scopedStore) metadata.scopedStore = scopedStore; if (nonce) metadata.nonce = nonce; + if (chainCode) metadata.chainCode = chainCode; if (tssPolyCommits) { metadata.tssPolyCommits = {}; for (const key in tssPolyCommits) { @@ -186,15 +190,20 @@ class Metadata implements IMetadata { tssNonce?: number; tssPolyCommits?: Point[]; factorPubs?: Point[]; + accountIndex?: number; factorEncs?: { [factorPubID: string]: FactorEnc; }; + chainCode?: string; }): void { - const { tssTag, tssNonce, tssPolyCommits, factorPubs, factorEncs } = tssData; + const { tssTag, tssNonce, tssPolyCommits, factorPubs, factorEncs, chainCode } = tssData; if (tssNonce !== undefined) this.tssNonces[tssTag] = tssNonce; if (tssPolyCommits) this.tssPolyCommits[tssTag] = tssPolyCommits; if (factorPubs) this.factorPubs[tssTag] = factorPubs; if (factorEncs) this.factorEncs[tssTag] = factorEncs; + if (chainCode && !this.chainCode) { + this.chainCode = chainCode; + } } // appends shares and public polynomial to metadata. @@ -338,6 +347,7 @@ class Metadata implements IMetadata { ...(this.tssPolyCommits && { tssPolyCommits: this.tssPolyCommits }), ...(this.factorPubs && { factorPubs: this.factorPubs }), ...(this.factorEncs && { factorEncs: this.factorEncs }), + ...(this.chainCode && { chainCode: this.chainCode }), }; } } diff --git a/packages/default/test/shared.js b/packages/default/test/shared.js index 2f74f32c..156d40e0 100644 --- a/packages/default/test/shared.js +++ b/packages/default/test/shared.js @@ -3,7 +3,7 @@ /* eslint-disable mocha/no-exports */ /* eslint-disable import/no-extraneous-dependencies */ -import { ecCurve, getPubKeyPoint, KEY_NOT_FOUND, SHARE_DELETED, ShareStore } from "@tkey-mpc/common-types"; +import { ecCurve, getPubKeyPoint, KEY_NOT_FOUND, SHARE_DELETED, ShareStore, toPrivKeyEC } from "@tkey-mpc/common-types"; import { Metadata } from "@tkey-mpc/core"; import PrivateKeyModule, { ED25519Format, SECP256K1Format } from "@tkey-mpc/private-keys"; import SecurityQuestionsModule from "@tkey-mpc/security-questions"; @@ -93,6 +93,11 @@ export const sharedTestCases = (mode, torusSP, storageLayer) => { const storageLayer = initStorageLayer({ hostUrl: metadataURL }); const tb1 = new ThresholdKey({ serviceProvider: sp, storageLayer, manualSync: mode }); + // chainCode is absent, required for nonce generation + // can be only initialize with tkey.initialize(); + rejects(async () => { + await tb1.computeNonce(1); + }); // factor key needs to passed from outside of tKey const factorKey = new BN(generatePrivate()); const factorPub = getPubKeyPoint(factorKey); @@ -104,30 +109,55 @@ export const sharedTestCases = (mode, torusSP, storageLayer) => { if (tb1.privKey.cmp(reconstructedKey.privKey) !== 0) { fail("key should be able to be reconstructed"); } + const { tssShare: retrievedTSS1, tssIndex: retrievedTSSIndex1 } = await tb1.getTSSShare(factorKey, { accountIndex: 1 }); + const tssPrivKey1 = getLagrangeCoeffs([1, retrievedTSSIndex1], 1) + .mul(serverDKGPrivKeys[0].add(tb1.computeNonce(1))) + .add(getLagrangeCoeffs([1, retrievedTSSIndex1], retrievedTSSIndex1).mul(retrievedTSS1)) + .umod(ecCurve.n); + const tssPubKey1 = ecCurve.keyFromPrivate(tssPrivKey1).getPublic(); + + const pubKey1 = tb1.getTSSPub(1); + strictEqual(tssPubKey1.x.toString(16, 64), pubKey1.x.toString(16, 64)); + strictEqual(tssPubKey1.y.toString(16, 64), pubKey1.y.toString(16, 64)); + + const factorKey1 = new BN(generatePrivate()); + const factorPub1 = getPubKeyPoint(factorKey1); + + const factorPubs1 = [factorPub, factorPub1]; + const { serverEndpoints, serverPubKeys } = await sp.getRSSNodeDetails(); + const { tssShare: retrievedTSSShare1, tssIndex: retrievedTSSIdx1 } = await tb1.getTSSShare(factorKey); + await tb1._refreshTSSShares(true, retrievedTSSShare1, retrievedTSSIdx1, factorPubs1, [2, 3], testId, { + serverThreshold: 3, + selectedServers: [1, 2, 3], + serverEndpoints, + serverPubKeys, + authSignatures: signatures, + }); const tb2 = new ThresholdKey({ serviceProvider: sp, storageLayer, manualSync: mode }); await tb2.initialize({ useTSS: true, factorPub }); await tb2.inputShareStoreSafe(newShare.newShareStores[newShare.newShareIndex.toString("hex")]); await tb2.reconstructKey(); - const { tssShare: retrievedTSS, tssIndex: retrievedTSSIndex } = await tb2.getTSSShare(factorKey); - const tssCommits = tb2.getTSSCommits(); - const tssPrivKey = getLagrangeCoeffs([1, retrievedTSSIndex], 1) - .mul(serverDKGPrivKeys[0]) - .add(getLagrangeCoeffs([1, retrievedTSSIndex], retrievedTSSIndex).mul(retrievedTSS)) + + const { tssShare: retrievedTSS2, tssIndex: retrievedTSSIndex2 } = await tb2.getTSSShare(factorKey, { accountIndex: 2 }); + const tssPrivKey2 = getLagrangeCoeffs([1, retrievedTSSIndex2], 1) + .mul(serverDKGPrivKeys[0].add(tb1.computeNonce(2))) + .add(getLagrangeCoeffs([1, retrievedTSSIndex2], retrievedTSSIndex2).mul(retrievedTSS2)) .umod(ecCurve.n); - const tssPubKey = getPubKeyPoint(tssPrivKey); - strictEqual(tssPubKey.x.toString(16, 64), tssCommits[0].x.toString(16, 64)); - strictEqual(tssPubKey.y.toString(16, 64), tssCommits[0].y.toString(16, 64)); + const tssPubKey2 = getPubKeyPoint(tssPrivKey2); + const pubKey2 = tb1.getTSSPub(2); - // // test tss refresh + strictEqual(tssPubKey2.x.toString(16, 64), pubKey2.x.toString(16, 64)); + strictEqual(tssPubKey2.y.toString(16, 64), pubKey2.y.toString(16, 64)); + // // test tss refresh const factorKey2 = new BN(generatePrivate()); const factorPub2 = getPubKeyPoint(factorKey2); - const factorPubs = [factorPub, factorPub2]; - const { serverEndpoints, serverPubKeys } = await sp.getRSSNodeDetails(); - await tb2._refreshTSSShares(true, retrievedTSS, retrievedTSSIndex, factorPubs, [2, 3], testId, { + const factorPubs2 = [factorPub, factorPub2]; + const { tssShare: retrievedTSS3, tssIndex: retrievedTSSIndex3 } = await tb2.getTSSShare(factorKey); + await tb2._refreshTSSShares(true, retrievedTSS3, retrievedTSSIndex3, factorPubs2, [2, 3], testId, { serverThreshold: 3, selectedServers: [1, 2, 3], serverEndpoints, @@ -135,24 +165,70 @@ export const sharedTestCases = (mode, torusSP, storageLayer) => { authSignatures: signatures, }); + // test case to ensure nonce mechanism + { + notEqual(tssPubKey1.x.toString(16, 64), tssPubKey2.x.toString(16, 64)); + notEqual(tssPubKey1.y.toString(16, 64), tssPubKey2.y.toString(16, 64)); + + const { tssShare: retrievedTSS } = await tb2.getTSSShare(factorKey); + const tssSharePub = ecCurve.keyFromPrivate(retrievedTSS.toString("hex")).getPublic(); + const { tssShare: retrievedTSS2 } = await tb2.getTSSShare(factorKey, { accountIndex: 1 }); + const tssSharePub2 = ecCurve.keyFromPrivate(retrievedTSS2.toString("hex")).getPublic(); + const nonce = tb1.computeNonce(1); + const noncePub = ecCurve.keyFromPrivate(nonce.toString("hex")).getPublic(); + const tssShareDerived = tssSharePub.add(noncePub); + strictEqual(tssShareDerived.getX().toString("hex"), tssSharePub2.getX().toString("hex")); + strictEqual(tssShareDerived.getY().toString("hex"), tssSharePub2.getY().toString("hex")); + + const { tssShare: retrievedTSS3 } = await tb2.getTSSShare(factorKey, { accountIndex: 2 }); + const tssSharePub3 = ecCurve.keyFromPrivate(retrievedTSS3.toString("hex")).getPublic(); + const nonce2 = tb1.computeNonce(2); + const noncePub2 = ecCurve.keyFromPrivate(nonce2.toString("hex")).getPublic(); + const tssShareDerived2 = tssSharePub.add(noncePub2); + strictEqual(tssShareDerived2.getX().toString("hex"), tssSharePub3.getX().toString("hex")); + strictEqual(tssShareDerived2.getY().toString("hex"), tssSharePub3.getY().toString("hex")); + } + { - const { tssShare: newTSS2, tssIndex } = await tb2.getTSSShare(factorKey); + const { tssShare: newTSS, tssIndex } = await tb1.getTSSShare(factorKey, { accountIndex: 1 }); const newTSSPrivKey = getLagrangeCoeffs([1, 2], 1) - .mul(new BN(serverDKGPrivKeys[1], "hex")) - .add(getLagrangeCoeffs([1, 2], 2).mul(newTSS2)) + .mul(new BN(serverDKGPrivKeys[1], "hex").add(tb1.computeNonce(1))) + .add(getLagrangeCoeffs([1, 2], 2).mul(newTSS)) .umod(ecCurve.n); - strictEqual(tssPrivKey.toString(16, 64), newTSSPrivKey.toString(16, 64)); + strictEqual(tssPrivKey1.toString(16, 64), newTSSPrivKey.toString(16, 64)); + // eslint-disable-next-line no-console + console.log("newTSS", newTSS.toString("hex"), tssIndex); + } + + { + const { tssShare: newTSS2, tssIndex } = await tb2.getTSSShare(factorKey2, { accountIndex: 1 }); + const newTSSPrivKey = getLagrangeCoeffs([1, 3], 1) + .mul(new BN(serverDKGPrivKeys[1], "hex").add(tb1.computeNonce(1))) + .add(getLagrangeCoeffs([1, 3], 3).mul(newTSS2)) + .umod(ecCurve.n); + strictEqual(tssPrivKey1.toString(16, 64), newTSSPrivKey.toString(16, 64)); // eslint-disable-next-line no-console console.log("newTSS2", newTSS2.toString("hex"), tssIndex); } { - const { tssShare: newTSS2, tssIndex } = await tb2.getTSSShare(factorKey2); + const { tssShare: newTSS, tssIndex } = await tb2.getTSSShare(factorKey, { accountIndex: 2 }); + const newTSSPrivKey = getLagrangeCoeffs([1, 2], 1) + .mul(new BN(serverDKGPrivKeys[1], "hex").add(tb2.computeNonce(2))) + .add(getLagrangeCoeffs([1, 2], 2).mul(newTSS)) + .umod(ecCurve.n); + strictEqual(tssPrivKey2.toString(16, 64), newTSSPrivKey.toString(16, 64)); + // eslint-disable-next-line no-console + console.log("newTSS", newTSS.toString("hex"), tssIndex); + } + + { + const { tssShare: newTSS2, tssIndex } = await tb2.getTSSShare(factorKey2, { accountIndex: 2 }); const newTSSPrivKey = getLagrangeCoeffs([1, 3], 1) - .mul(new BN(serverDKGPrivKeys[1], "hex")) + .mul(new BN(serverDKGPrivKeys[1], "hex").add(tb1.computeNonce(2))) .add(getLagrangeCoeffs([1, 3], 3).mul(newTSS2)) .umod(ecCurve.n); - strictEqual(tssPrivKey.toString(16, 64), newTSSPrivKey.toString(16, 64)); + strictEqual(tssPrivKey2.toString(16, 64), newTSSPrivKey.toString(16, 64)); // eslint-disable-next-line no-console console.log("newTSS2", newTSS2.toString("hex"), tssIndex); } @@ -252,7 +328,7 @@ export const sharedTestCases = (mode, torusSP, storageLayer) => { if (!sp.useTSS) this.skip(); // skip if not mock for now as we need to set key on server to test - if (!isMocked) this.skip(); + if (!isMocked) this(); const deviceTSSShare = new BN(generatePrivate()); const deviceTSSIndex = 3; @@ -365,7 +441,7 @@ export const sharedTestCases = (mode, torusSP, storageLayer) => { if (!sp.useTSS) this.skip(); // skip if not mock for now as we need to set key on server to test - if (!isMocked) this.skip(); + if (!isMocked) this(); const deviceTSSShare = new BN(generatePrivate()); const deviceTSSIndex = 3; @@ -691,7 +767,7 @@ export const sharedTestCases = (mode, torusSP, storageLayer) => { }); it(`#should be not be able to lookup delete share, manualSync=${mode}`, async function () { - if (!customSP.useTSS) this.skip(); + if (!customSP.useTSS) this(); const newKeys = Object.keys(shareStoreAfterDelete); if (newKeys.find((el) => el === deletedShareIndex.toString("hex"))) { fail("Unable to delete share index"); @@ -702,7 +778,7 @@ export const sharedTestCases = (mode, torusSP, storageLayer) => { await tb.getTSSShare(newFactorKey); }); // it(`#should be able to delete a user and reset tss nonce, manualSync=${mode}`, async function () { - // if (!customSP.useTSS) this.skip(); + // if (!customSP.useTSS) this(); // // create 2/4 // await tb._initializeNewKey({ initializeModules: true }); // await tb.generateNewShare(); @@ -731,7 +807,7 @@ export const sharedTestCases = (mode, torusSP, storageLayer) => { // // TODO: check that TSS nonce is reset // }); it(`#should be able to reinitialize after wipe, manualSync=${mode}`, async function () { - if (!customSP.useTSS) this.skip(); + if (!customSP.useTSS) this(); // create 2/4 const resp1 = await tb._initializeNewKey({ initializeModules: true }); await tb.generateNewShare(); @@ -765,7 +841,7 @@ export const sharedTestCases = (mode, torusSP, storageLayer) => { tb = new ThresholdKey({ serviceProvider: customSP, storageLayer: customSL, manualSync: mode }); }); it(`#should serialize and deserialize correctly without tkeyArgs, manualSync=${mode}`, async function () { - if (!customSP.useTSS) this.skip(); + if (!customSP.useTSS) this(); const sp = customSP; let userInput = new BN(keccak256(Buffer.from("user answer blublu", "utf-8")).slice(2), "hex"); userInput = userInput.umod(ecCurve.curve.n); @@ -822,7 +898,7 @@ export const sharedTestCases = (mode, torusSP, storageLayer) => { strictEqual(tssPrivKey.toString("hex"), tssPrivKey2.toString("hex"), "Incorrect tss key"); }); it(`#should serialize and deserialize correctly with tkeyArgs, manualSync=${mode}`, async function () { - if (!customSP.useTSS) this.skip(); + if (!customSP.useTSS) this(); let userInput = new BN(keccak256(Buffer.from("user answer blublu", "utf-8")).slice(2), "hex"); userInput = userInput.umod(ecCurve.curve.n); const resp1 = await tb._initializeNewKey({ userInput, initializeModules: true }); @@ -880,7 +956,7 @@ export const sharedTestCases = (mode, torusSP, storageLayer) => { }); // TODO: add test for initialize such that initialize throws if the remote metadata is already there it(`#should serialize and deserialize correctly, keeping localTransitions consistent before syncing NewKeyAssign, manualSync=${mode}`, async function () { - if (!customSP.useTSS) this.skip(); + if (!customSP.useTSS) this(); const sp = customSP; sp.verifierName = "torus-test-health"; @@ -926,7 +1002,7 @@ export const sharedTestCases = (mode, torusSP, storageLayer) => { } }); it(`#should serialize and deserialize correctly keeping localTransitions afterNewKeyAssign, manualSync=${mode}`, async function () { - if (!customSP.useTSS) this.skip(); + if (!customSP.useTSS) this(); let userInput = new BN(keccak256(Buffer.from("user answer blublu", "utf-8")).slice(2), "hex"); userInput = userInput.umod(ecCurve.curve.n); const resp1 = await tb._initializeNewKey({ userInput, initializeModules: true });