From 0cf29ebc33543a4ca7b7ab43a448e5320cac9d11 Mon Sep 17 00:00:00 2001 From: himanshu Date: Fri, 6 Sep 2024 11:32:42 +0530 Subject: [PATCH] fix useDKG check --- src/mpcCoreKit.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mpcCoreKit.ts b/src/mpcCoreKit.ts index 5ab77a0..56ada72 100644 --- a/src/mpcCoreKit.ts +++ b/src/mpcCoreKit.ts @@ -196,12 +196,14 @@ export class Web3AuthMPCCoreKit implements ICoreKit { return this.options.uxMode === UX_MODE.REDIRECT; } + // use dkg is always false for ed25519 key type and for secp256k1 key type when options.useDKG is false private get useDKG(): boolean { return this.keyType === KeyType.ed25519 ? false : this.options.useDKG; } + // import flow is used when this.options.useDKG is undefined or false private get useImportFlow(): boolean { - return this.keyType === KeyType.ed25519 && this.options.useDKG === undefined ? false : this.options.useDKG; + return !this.options.useDKG; } // RecoverTssKey only valid for user that enable MFA where user has 2 type shares : @@ -886,7 +888,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit { const existingUser = await this.isMetadataPresent(this.state.postBoxKey); let importTssKey = providedImportTssKey; if (!existingUser) { - if (!importTssKey && !this.useImportFlow) { + if (!importTssKey && this.useImportFlow) { if (this.keyType === KeyType.ed25519) { const k = generateEd25519Seed(); importTssKey = k.toString("hex");