From 7e20f59af2bf1b9825bc4b108b6df22426b1f5da Mon Sep 17 00:00:00 2001 From: ieow Date: Mon, 4 Dec 2023 16:45:56 +0800 Subject: [PATCH] feat: add isMFAEnabled --- src/mpcCoreKit.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mpcCoreKit.ts b/src/mpcCoreKit.ts index 90956ee0..51f67160 100644 --- a/src/mpcCoreKit.ts +++ b/src/mpcCoreKit.ts @@ -445,6 +445,18 @@ export class Web3AuthMPCCoreKit implements ICoreKit { return this.tKey.getTSSPub(); } + public async isMFAEnabled(): Promise { + if (!this.state.oAuthKey || !this.options.hashedFactorNonce) { + throw new Error("oAuthKey or hashedFactorNonce not present"); + } + + const hashedFactorKey = getHashedPrivateKey(this.state.oAuthKey, this.options.hashedFactorNonce); + if (await this.checkIfFactorKeyValid(hashedFactorKey)) { + return true; + } + return false; + } + public async enableMFA(enableMFAParams: EnableMFAParams, recoveryFactor = true): Promise { this.checkReady();