Skip to content

Commit

Permalink
fix session manager usage check
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshuchawla009 committed Nov 21, 2024
1 parent ed1394f commit 82de5d4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/mpcCoreKit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1138,14 +1138,14 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
}

private async createSession() {
if (!this.sessionManager) {
if (!this.options.disableSessionManager && !this.sessionManager) {
throw new Error("sessionManager is not available");
}

try {
const sessionId = SessionManager.generateRandomSessionKey();
this.sessionManager.sessionId = sessionId;
const { postBoxKey, factorKey, userInfo, tssShareIndex, tssPubKey } = this.state;
const { postBoxKey, factorKey, userInfo, tssShareIndex, tssPubKey, postboxKeyNodeIndexes } = this.state;
if (!this.state.factorKey) {
throw CoreKitError.factorKeyNotPresent("factorKey not present in state when creating session.");
}
Expand All @@ -1157,6 +1157,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
}
const payload: SessionData = {
postBoxKey,
postboxKeyNodeIndexes: postboxKeyNodeIndexes || [],
factorKey: factorKey?.toString("hex"),
tssShareIndex: tssShareIndex as number,
tssPubKey: Buffer.from(tssPubKey).toString("hex"),
Expand Down

0 comments on commit 82de5d4

Please sign in to comment.