omsWallet.wallet has one active wallet at a time.
Read and restore session state
The native SDK persists the session. CreateOMSWallet with the same publishable key when the app starts; the constructor creates the native client and restores the saved session before it returns. On iOS, when the app launches in the background while the device is locked, the keychain cannot be read yet; the session is restored once the device is unlocked, and onSessionChange then reports a signedIn change.
wallet.activeWallet and wallet.session are read synchronously from the native SDK, so they are current as soon as a sign-in or wallet change returns. They return the same frozen objects until the active wallet or session changes.
activeWalletis the activeWalletAccount, withid,type,address, optionalreference, andkeyOrigin, orundefinedwhen signed out. Checktypebefore passing the address to family-specific code.sessionis anOMSWalletSessionwith the currentexpiresAtand theauthmetadata. It is defined exactly whenactiveWalletis.- Email auth metadata is
{ type: 'email', email }. OIDC metadata is{ type: 'oidc', flow, issuer, provider, providerLabel, email }, with optional provider fields.
Keep your UI in sync
A session stays active while it is used. It ends after about 10 days without use, or at the lifetime requested at sign-in: 180 days by default (DEFAULT_SESSION_LIFETIME_SECONDS, also the maximum). Pass a shorter sessionLifetimeSeconds at sign-in for a hard limit. session.expiresAt is the current expiry, and the SDK keeps it up to date.
When expiresAt passes, a session past its requested lifetime ends at once. Otherwise the SDK asks the wallet API, once the app is in the foreground, and reports expired only if the session ended. Protected operations on an ended session throw OMSWalletError with code OMS_SESSION_EXPIRED.
onSessionChange calls your listener after every change of activeWallet or session, and returns a function that removes it:
A listener added while signed out first receives the last
expired change, until a sign-in starts or the user signs out.
In React, useSyncExternalStore keeps a component in sync:
Request timeouts and the signing key
Requests signed with the session go one at a time and fail withOMS_REQUEST_FAILED after 30 seconds, counting the time spent waiting behind other requests. A transaction that times out after it was sent fails with OMS_TRANSACTION_EXECUTION_UNCONFIRMED: check its status before sending it again.
On an iOS device, the session signing key is generated in the Secure Enclave and cannot be exported. If the Secure Enclave cannot create it, sign-in fails with OMS_STORAGE_ERROR. Android keeps the key in the Android Keystore.
List and activate wallets
An access credential can have multiple wallets.useWallet changes the selected wallet for the active session:
walletType:
Claim a preallocated wallet
A completed sign-in result lists, inclaimableWallets, the wallets your project preallocated for the user’s email that the sign-in did not claim. See authentication for how wallets become claimable. Claim one with claimWallet:
claimWallet requires an active session and makes the claimed wallet active, like useWallet. A pending manual selection must use selection.claimAndSelectWallet instead.
Import and activate a wallet
type: 'tron') accept 32 raw bytes or 64 hexadecimal digits with an optional 0x prefix. Solana imports accept a 32-byte seed or 64-byte keypair as raw bytes, or the base58 encoding of either. The native SDK encrypts the key locally for the attested import transport and does not persist the plaintext key. Returned wallets identify keyOrigin as 'enclave' or 'imported'.
Attestation failures reject with SDK error code OMS_ATTESTATION_VERIFICATION_FAILED. Importing a key whose address is already imported rejects with OMS_WALLET_ADDRESS_ALREADY_IMPORTED.
Issue a wallet ID token
A wallet ID token is short-lived proof for the currently active wallet. It is not the provider ID token used to authenticate and it is not the access credential that authorizes wallet API calls.Inspect access grants
Access grants authorize wallet operations and have their own credential IDs and expiry timestamps. A grant hastype: 'direct' or type: 'remote'; remote grants also include a session ID, display metadata, and bounded smart-session grants. isCaller identifies the credential currently authorizing the list request.
For a short list:
listAccessPage when your UI owns cursor pagination. Omit cursor for the first page, then pass the returned cursor when it is defined:
Revoke access safely
CheckisCaller before revocation. Revoking the caller removes the credential being used for the request and can end the current app’s ability to perform protected operations.
sessionId is required and revokes exactly that session.
Authorize remote access
Remote access grants are bounded EVM smart sessions. Inspect the remote credential and show its returned metadata to the wallet owner before requesting approval: This example uses Polygon Amoy. Grant limits are raw EVM base-unit amounts. A native-transfer limit is cumulative, so1000000000000000 wei authorizes up to 0.001 POL across the session.
Sign out
revokeAccess to remove access from another credential.