Skip to content

Conversation

@ieow
Copy link
Contributor

@ieow ieow commented Oct 23, 2025

Motivation and Context

Jira Link:

Description

  • Fix feature disableHashedFactorkey
    device factorkey is not set when disableHashedFactoryKey flag is set.
    this is causing user lose the device factorkey during signup.

  • update session on commit
    Session data is not updated when commits happens,
    If user close and reopen the app this will cause user rehydrate( if rehydration is enabled) with old factorkey / metadata. This is causing the instance not consistent

update tests
update tests cases

How has this been tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project. (run lint)
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My code requires a db migration.

Comment on lines 901 to 912
if (this.sessionId) {
const payload: SessionData = {
postBoxKey: this.state.postBoxKey,
postboxKeyNodeIndexes: this.state.postboxKeyNodeIndexes || [],
factorKey: this.state.factorKey?.toString("hex"),
tssShareIndex: this.state.tssShareIndex as number,
tssPubKey: this.state.tssPubKey?.toString("hex"),
signatures: this.signatures,
userInfo: this.state.userInfo,
};
this.sessionManager.updateSession(payload);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arch1995 should double check this. I'm not familiar with sessionManager.

shareDescription: FactorKeyTypeShareDescription.Other,
updateMetadata: false,
});
await this.setDeviceFactor(factorKey);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this means the factor key was previously not persisted here, which is kind of catastrophic. We should have a test that asserts this.

];

const email = "testmail99";
const email = "testmail99-1";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why that change? (We briefly talked about it in our call, but I think it would be good to document it here.)

Comment on lines +33 to +36
await coreKitInstance.tKey.storageLayer.setMetadata({
privKey: new BN(coreKitInstance.state.postBoxKey!, "hex"),
input: { message: "KEY_NOT_FOUND" },
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we no longer delete key on setup?


const { idToken, parsedToken } = login ? await login(email) : await mockLogin(email);
await instance.init();
await instance.init({ handleRedirectResult: false, rehydrate: false });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the default values for these parameters? Did we change these? If so, why? Or are we just being more explicit here?

Copy link
Collaborator

@arch1995 arch1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved changes related to session manager

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants