Skip to content

Commit

Permalink
fix useDKG check
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshuchawla009 committed Sep 6, 2024
1 parent 70ab326 commit 0cf29eb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/mpcCoreKit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 0cf29eb

Please sign in to comment.