Skip to content

feat: generate record-id and include in login b64 params#395

Merged
chaitanyapotti merged 5 commits intomasterfrom
feat/record-id
Mar 31, 2026
Merged

feat: generate record-id and include in login b64 params#395
chaitanyapotti merged 5 commits intomasterfrom
feat/record-id

Conversation

@lwin-kyaw
Copy link
Copy Markdown
Contributor

@lwin-kyaw lwin-kyaw commented Mar 29, 2026

Jira Link

https://consensyssoftware.atlassian.net/browse/EMBED-226

Description

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.

Note

Medium Risk
Changes the encoded login parameters sent to the auth service and introduces a hard dependency on crypto.randomUUID, which could break flows in environments without it.

Overview
Adds generateRecordId() (UUID via crypto.randomUUID) and threads a new optional recordId through BaseLoginParams.

Auth now generates a recordId for authHandler (login/start flows) and manageMFA, embedding it into the b64Params payload (and appState for MFA) passed to the auth service/dashboard.

Also updates dependencies (@toruslabs/customauth/@toruslabs/torus.js, Vue example) and ignores .npmrc in .gitignore.

Written by Cursor Bugbot for commit ded4246. This will update automatically on new commits. Configure here.

@lwin-kyaw lwin-kyaw requested a review from a team as a code owner March 29, 2026 13:55
@chaitanyapotti chaitanyapotti merged commit 1c29f0b into master Mar 31, 2026
3 checks passed
@chaitanyapotti chaitanyapotti deleted the feat/record-id branch March 31, 2026 07:38
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

const cr = typeof globalThis === "object" ? globalThis.crypto : null;
if (typeof cr?.randomUUID !== "function") throw new Error("crypto.randomUUID must be defined");
return cr.randomUUID();
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Analytics feature throws hard error breaking core login

Low Severity

generateRecordId throws a hard Error if crypto.randomUUID is unavailable, yet the recordId field in BaseLoginParams is typed as optional and documented as "for analytics purposes." This function is called without try-catch in both authHandler (used by login, enableMFA, manageSocialFactor, etc.) and manageMFA, meaning a missing crypto.randomUUID — possible in certain WebViews, React Native, or restricted browser environments — will crash the entire authentication flow for a non-critical analytics feature.

Additional Locations (2)
Fix in Cursor Fix in Web

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.

2 participants