Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

The SDK playground — always runs the latest npm release
The Startrail SDK playground: version badge, environment switch, session pill and one card per SDK method
Every SDK method as a card: fill the form, press Run, read the exact outcome and the code you would write.
  • Loads the latest release on npm at run time (the version is in the top bar); ?sdk=2.2.0 pins an older release for comparison.

  • A brand studio to preview the login modal with your colours, logo and wording — then copy the customUi config.

  • 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.

The default login modal in light and dark mode
Brand-neutral default: near-black accent on white, inverted on the dark card.
  • 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.

More screenshots — mobile, Japanese, states
The modal as a bottom sheet on a phone, light and dark
Bottom sheet on phones.
The modal in Japanese
lang: 'ja'
Waiting, cancelled and error states
Waiting → cancelled → error, all inside the modal.

2. White-label it — customUi.theme

One customUi block brands the modal and the wallet UI it hands off to.

The modal themed for PORT: purple accent, pill-shaped filled buttons, light and dark
PORT: accent, pill-shaped controlRadius: '50%', buttonStyle: 'filled'.
The modal themed for Acme Gallery: orange accent, circular logo inline beside a left-aligned title
Acme Gallery: logoPlacement: 'inline', logoShape: 'circle', align: 'left', custom font and wording.

Text on the accent colour is chosen automatically by WCAG luminance, and a near-black accent inverts to a light neutral in dark mode, so one colour is enough to start. Per-site overrides are also possible through CSS custom properties (--startrail-modal-accent, --startrail-modal-radius, …) on the modal container.

Whitelabeling/Customizing

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

Option
Status

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

1

Install

No breaking API changes: login() still returns EOA[] | false, all method signatures are unchanged.

2

Clean the config

Drop withModal, auth0ClientId and auth0Domain if you pass them. Keep auth0TorusConfigKey only if Startbahn gave you one.

3

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.

4

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-embed 7 (ws-embed 6 / @web3auth/auth 11) — see the note below.

  • Toolchain: pnpm 12, refreshed dependencies; the README and this SDK's llms.txt were rewritten to cover every option above.

Interface💳Wallet Methods🔀URL per environment

Last updated

Was this helpful?