v2.3.0
Redesigned white-label login modal with light/dark mode, session restore on fresh instances, login({ forceLogin }) and a hosted playground
npmjs
🎮 Try it before you install anything

Loads the latest release on npm at run time (the version is in the top bar);
?sdk=2.2.0pins an older release for comparison.A brand studio to preview the login modal with your colours, logo and wording — then copy the
customUiconfig.A sign-in panel for every provider combination, a switch-user scenario, and an activity log you can export for a bug report.
✨ What's new
1. A redesigned login modal
The provider picker that opens when loginProvider offers a choice (or email_passwordless is used without a loginHint) has been rebuilt from scratch and is rendered by the SDK itself, in a Shadow DOM, so your page's CSS never affects it and its CSS never leaks out.

Light, dark and auto (follows
prefers-color-scheme).States that explain themselves: inline email validation, "Waiting for {provider}…", a friendly notice when the user closes the provider window, and an inline error with retry.
Accessible: focus trap, Escape to close, screen-reader labels, reduced-motion support.
Mobile: a bottom sheet under 480 px with safe-area padding.
Localised: English and Japanese from
lang.
2. White-label it — customUi.theme
One customUi block brands the modal and the wallet UI it hands off to.

accent, pill-shaped controlRadius: '50%', buttonStyle: 'filled'.
logoPlacement: 'inline', logoShape: 'circle', align: 'left', custom font and wording.3. Sessions are restored, not re-prompted
A Startrail-wallet session lives in the wallet iframe, which needs a moment to rehydrate after a page load. Previously a fresh SDK instance could open the picker for a user who was in fact signed in, and then ignore their choice once the session landed.
From 2.3.0 the SDK records a timestamp hint (no addresses) on your origin after each successful login — localStorage['startrail-sdk:torus-session'], removed on logout() — and a new instance waits for the restore before ever showing the picker. If the modal has to open in the meantime it starts in a "Checking for an existing session…" state and closes itself when the session is back.
4. Switch user with login({ forceLogin: true })
Because a session is resumed silently, login({ loginProvider: ['google'] }) while another user is signed in returned their accounts and never showed Google. Pass forceLogin: true to end the current session first — the same as logout() then login(), in one call, with the requested provider and loginHint honoured.
Per-call overrides that omit loginProvider now keep the providers you configured (they used to fall back to the full default list).
5. Sign confirmations stay inside the wallet iframe
confirmationStrategy defaults to 'modal': confirmations render inside the wallet iframe, immune to browser popup blockers — signs triggered right after login() are not in a user gesture and a separate popup window was blocked intermittently. 'default' now means exactly that SDK default; only an explicit 'popup' opts into a separate window.
6. Deprecated and removed
withModal
Deprecated, no effect. The SDK's modal opens whenever loginProvider offers a choice. Still accepted so existing configs compile.
auth0ClientId, auth0Domain
Never read by the SDK and not part of its config type — remove them from your configs. auth0TorusConfigKey is still honoured.
mfaLevel
Deprecated since 2.2.0 (no MFA level in the underlying wallet).
⬆️ Upgrade from 2.2.0
Brand the modal (optional)
Open the playground's brand studio, pick a preset or your colours, press Preview, then copy the generated customUi block into your constructor config.
Honour account switches (optional)
On your login page, if the user explicitly picks a provider or wallet that differs from their previous sign-in, call login({ ...choice, forceLogin: true }). Keep the plain login() for the same provider, page reloads and the passwordless "complete" step, so the restored session is reused.
🛠️ Internal
Wallet stack moved to
@toruslabs/torus-embed7 (ws-embed 6 /@web3auth/auth11) — see the note below.Toolchain: pnpm 12, refreshed dependencies; the README and this SDK's
llms.txtwere rewritten to cover every option above.
Last updated
Was this helpful?


