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.

  • fix atomic sync for

    • backupMetadataShare
    • deleteMetadataShareBackup

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

revert the changes as finalizeTkey will create new session

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tests added

];

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

critical_delete require tkey reconstructed.
some testcases and user flow, we do not have the 2nd factor key, hence we are reseting the acocunt via setMetadata with KEY_NOT_FOUND


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
Contributor Author

Choose a reason for hiding this comment

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

The previous testcases do not take rehydration via session manager in to consideration.
This new options added to make core kit instance to be initialized without rehydration for the test flow

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

@ieow
Copy link
Contributor Author

ieow commented Nov 7, 2025

close in favor of #224

@ieow ieow closed this Nov 7, 2025
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.

4 participants