Skip to content

Commit

Permalink
Merge branch 'feat/updateNodeDetails'
Browse files Browse the repository at this point in the history
  • Loading branch information
ieow committed Nov 1, 2024
2 parents 0dfbf03 + 3b1d0c0 commit 05c0f81
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions src/mpcCoreKit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -85,8 +84,6 @@ export class Web3AuthMPCCoreKit implements ICoreKit {

private currentStorage: AsyncStorage;

private nodeDetailManager!: NodeDetailManager;

private _storageBaseKey = "corekit_store";

private enableLogging = false;
Expand Down Expand Up @@ -132,11 +129,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 {
Expand Down Expand Up @@ -232,11 +224,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: "[email protected]" });

if (!nodeDetails) {
throw CoreKitError.nodeDetailsRetrievalFailed();
}
const nodeDetails = fetchLocalConfig(this.options.web3AuthNetwork, this.keyType);

if (this.keyType === KEY_TYPE.ED25519 && this.options.useDKG) {
throw CoreKitError.invalidConfig("DKG is not supported for ed25519 key type");
Expand Down Expand Up @@ -296,6 +284,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) {
Expand Down Expand Up @@ -1264,10 +1253,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.");
Expand Down

0 comments on commit 05c0f81

Please sign in to comment.