Skip to content

Commit 9a25f60

Browse files
committed
fix: add randomId verifier testcases
1 parent e61342e commit 9a25f60

File tree

4 files changed

+19
-130
lines changed

4 files changed

+19
-130
lines changed

package-lock.json

Lines changed: 5 additions & 125 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"@toruslabs/metadata-helpers": "^6.0.0",
6161
"@toruslabs/openlogin-utils": "^8.2.1",
6262
"@toruslabs/session-manager": "^3.1.0",
63-
"@toruslabs/torus.js": "15.2.0-alpha.0",
63+
"@toruslabs/torus.js": "file:../torus.js/toruslabs-torus.js-15.1.1.tgz",
6464
"@toruslabs/tss-client": "^3.3.0-alpha.0",
6565
"@toruslabs/tss-frost-client": "^1.0.1-alpha.0",
6666
"@toruslabs/tss-frost-common": "^1.0.2-alpha.0",

src/mpcCoreKit.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -828,8 +828,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit, IMPCContext {
828828
// Suppress client logs if logging is disabled.
829829
client.log = (msg: string) => {
830830
if (!this.enableLogging) return;
831-
// eslint-disable-next-line no-console
832-
console.log(msg);
831+
log.debug(msg);
833832
};
834833

835834
const serverCoeffs: Record<number, string> = {};
@@ -1193,9 +1192,10 @@ export class Web3AuthMPCCoreKit implements ICoreKit, IMPCContext {
11931192

11941193
// if both keyType library is avaiable, initialize secp256k1 first as secp256k1 is initialize offline
11951194

1195+
const importTssBuf = importTssKey ? Buffer.from(importTssKey, "hex") : undefined;
11961196
// check if key is in the tsslib and keytype exists
11971197
await this.tKey.initializeTss({
1198-
importKey: importTssKey ? Buffer.from(importTssKey, "hex") : undefined,
1198+
importKey: importTssBuf,
11991199
factorPub,
12001200
deviceTSSShare,
12011201
deviceTSSIndex,

tests/factors.spec.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ import { tssLib as tssLibFROST } from "@toruslabs/tss-frost-lib";
88
import BN from "bn.js";
99

1010
import { COREKIT_STATUS, IAsyncStorage, IStorage, MemoryStorage, TssLibType, TssShareType, WEB3AUTH_NETWORK, Web3AuthMPCCoreKit } from "../src";
11-
import { AsyncMemoryStorage, bufferToElliptic, criticalResetAccount, mockLogin } from "./setup";
11+
import { AsyncMemoryStorage, criticalResetAccount, mockLogin } from "./setup";
1212
import { getKeyCurve } from "@toruslabs/torus.js";
13+
import { randomId } from "@toruslabs/customauth";
14+
import log from "loglevel";
1315

1416
type FactorTestVariable = {
1517
manualSync?: boolean;
1618
storage?: IAsyncStorage | IStorage;
1719
email: string;
1820
tssLib?: TssLibType;
21+
resetAccount? : false
1922
};
2023

2124
function getPubKeys(kit: Web3AuthMPCCoreKit, indices: number[]): EllipticPoint[] {
@@ -53,7 +56,12 @@ export const FactorManipulationTest = async (testVariable: FactorTestVariable) =
5356
};
5457

5558
async function beforeTest() {
59+
if (testVariable.resetAccount === false) {
60+
log.debug("skipping reset account");
61+
return ;
62+
}
5663
const resetInstance = await newInstance();
64+
5765
await criticalResetAccount(resetInstance);
5866
await resetInstance.logout();
5967
}
@@ -182,6 +190,7 @@ const variable: FactorTestVariable[] = [
182190
{ manualSync: false, storage: new AsyncMemoryStorage(), email: "testmail1015" },
183191

184192
{ manualSync: true, storage: new MemoryStorage(), email: "testmail1012ed25519", tssLib: tssLibFROST },
193+
{ manualSync: true, storage: new MemoryStorage(), email: randomId() , tssLib: tssLibFROST , resetAccount: false},
185194
];
186195

187196
variable.forEach(async (testVariable) => {

0 commit comments

Comments
 (0)