Skip to main content
Safari’s Intelligent Tracking Prevention (ITP) can clear localStorage after periods of inactivity. Because Portal stores the user’s signing share in localStorage, the share may be missing the next time a user opens your app. The SDK invokes any onWalletNotOnDevice listeners during initialization when it detects this has happened.

Detecting storage loss

Register your listener as early as possible. If the event already fired before you subscribed, the callback is replayed automatically.
portal.onWalletNotOnDevice(async (payload) => {
  if (payload.isBackedUp) {
    // Guide the user through wallet recovery
  } else {
    // No backup exists — clear state and restart onboarding
    await portal.clearLocalWallet()
  }
})
The callback receives a WalletNotOnDevicePayload:
FieldTypeDescription
clientIdstringThe client ID of the affected wallet
isBackedUpbooleanWhether a backup exists that can be used to recover
reason'storage_cleared'Why the wallet is not on device
  • isBackedUp: true — direct the user to recover their wallet.
  • isBackedUp: false — call clearLocalWallet() and restart the wallet creation flow.

Next steps

  • Recover a wallet — step-by-step recovery flow to direct users to when isBackedUp is true.
  • Create a wallet — restart onboarding when no backup exists.