From 7845aa9874ea66042f80311c47a69ab49b7ee718 Mon Sep 17 00:00:00 2001 From: ieow Date: Mon, 23 Sep 2024 12:21:52 +0800 Subject: [PATCH 1/3] feat: update nodeDetails --- src/mpcCoreKit.ts | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/mpcCoreKit.ts b/src/mpcCoreKit.ts index 67b4eb0f..ea8c603c 100644 --- a/src/mpcCoreKit.ts +++ b/src/mpcCoreKit.ts @@ -85,8 +85,6 @@ export class Web3AuthMPCCoreKit implements ICoreKit { private currentStorage: AsyncStorage; - private nodeDetailManager!: NodeDetailManager; - private _storageBaseKey = "corekit_store"; private enableLogging = false; @@ -130,11 +128,6 @@ export class Web3AuthMPCCoreKit implements ICoreKit { this.options = options as Web3AuthOptionsWithDefaults; this.currentStorage = new AsyncStorage(this._storageBaseKey, options.storage); - - this.nodeDetailManager = new NodeDetailManager({ - network: this.options.web3AuthNetwork, - enableLogging: options.enableLogging, - }); } get tKey(): TKeyTSS { @@ -230,11 +223,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit { this.resetState(); if (params.rehydrate === undefined) params.rehydrate = true; - const nodeDetails = await this.nodeDetailManager.getNodeDetails({ verifier: "test-verifier", verifierId: "test@example.com" }); - - if (!nodeDetails) { - throw CoreKitError.nodeDetailsRetrievalFailed(); - } + const nodeDetails = fetchLocalConfig(this.options.web3AuthNetwork, this.keyType); if (this.keyType === KEY_TYPE.ED25519 && this.options.useDKG !== undefined) { throw CoreKitError.invalidConfig("DKG is not supported for ed25519 key type"); @@ -1234,10 +1223,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit { const { tssShareIndex } = this.state; const tssPubKey = await this.getPubKeyPoint(); - const { torusNodeTSSEndpoints } = await this.nodeDetailManager.getNodeDetails({ - verifier: this.tkey.serviceProvider.verifierName, - verifierId: this.tkey.serviceProvider.verifierId, - }); + const { torusNodeTSSEndpoints } = fetchLocalConfig(this.options.web3AuthNetwork, this.keyType); if (!this.state.factorKey) { throw CoreKitError.factorKeyNotPresent("factorKey not present in state when signing."); From 23ed922ef7d9388ce134dd2ef70f0568a1ba405e Mon Sep 17 00:00:00 2001 From: ieow Date: Mon, 23 Sep 2024 12:42:30 +0800 Subject: [PATCH 2/3] fix: update to use fetchLocalConfig instead of getNodeDetails --- src/mpcCoreKit.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mpcCoreKit.ts b/src/mpcCoreKit.ts index ea8c603c..109b7a98 100644 --- a/src/mpcCoreKit.ts +++ b/src/mpcCoreKit.ts @@ -7,7 +7,6 @@ import { KEY_TYPE, SIGNER_MAP } from "@toruslabs/constants"; import { AGGREGATE_VERIFIER, TORUS_METHOD, TorusAggregateLoginResponse, TorusLoginResponse, UX_MODE } from "@toruslabs/customauth"; import type { UX_MODE_TYPE } from "@toruslabs/customauth/dist/types/utils/enums"; import { Ed25519Curve } from "@toruslabs/elliptic-wrapper"; -import { NodeDetailManager } from "@toruslabs/fetch-node-details"; import { fetchLocalConfig } from "@toruslabs/fnd-base"; import { keccak256 } from "@toruslabs/metadata-helpers"; import { SessionManager } from "@toruslabs/session-manager"; From 3b1d0c0c30409163932a54a2f01bc413f9b19569 Mon Sep 17 00:00:00 2001 From: ieow Date: Mon, 23 Sep 2024 12:49:26 +0800 Subject: [PATCH 3/3] feat: add comment on feature gating skipping --- src/mpcCoreKit.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mpcCoreKit.ts b/src/mpcCoreKit.ts index 109b7a98..8079e36a 100644 --- a/src/mpcCoreKit.ts +++ b/src/mpcCoreKit.ts @@ -282,6 +282,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit { (window?.location.hash.includes("#state") || window?.location.hash.includes("#access_token")) ) { // on failed redirect, instance is reseted. + // skip check feature gating on redirection as it was check before login await this.handleRedirectResult(); // if not redirect flow try to rehydrate session if available } else if (params.rehydrate && this.sessionManager.sessionId) {