OMSWallet again.
Read restored session state
activeWallet is the selected Wallet, with its id, type, address, reference, and keyOrigin. Check type before passing the address to code for one network family. session is an OMSWalletSession with the current expiry in expiresAt and authentication metadata in auth. Both are nil when no wallet session is active, and session is non-nil exactly when activeWallet is. For OIDC, the metadata identifies .idToken or .redirect, the issuer, optional provider details, and an email when OMS returns one.
The session’s signing key is generated in the Secure Enclave on an iOS device (in the Keychain in the Simulator and on macOS), cannot be exported, and is never part of OMSWalletSession.
A manual
PendingWalletSelection is not completed session metadata. It remains in memory only until your app activates a wallet.One wallet per project
CreatingOMSWallet again for the same project and environment returns the same wallet, so every part of your app sees the same session. A rotated publishable key for the same project keeps the session.
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).session.expiresAt is the current expiry as an ISO-8601 timestamp, and the SDK keeps it up to date.
When the session ends, protected operations throw OMSWalletError with code .sessionExpired. If the wallet API cannot be reached, the session is kept and operations throw the network error.
addSessionChangeObserver calls your observer on MainActor after every change of activeWallet or session. Add the observer first, then read the current state, so no change is missed. Keep the returned observation: delivery stops when it is cancelled or released.
After a relaunch, a new observer first receives the last
.expired change until the user signs in again or signs out.
List, switch, and create wallets
These operations require the authenticated credential.listWallets() follows all server cursors and returns the complete list.
useWallet and createWallet replace the active wallet while preserving the current session expiry and authentication metadata.
Pass walletType: .solana or walletType: .tron to create a Solana or Tron wallet:
Claim a preallocated wallet
A completed sign-in result lists, inclaimableWallets, the wallets your project preallocated for the user’s email that sign-in did not claim. See authentication for how wallets become claimable. Claim one with claimWallet(walletId:):
claimWallet makes the claimed wallet active, like useWallet. During a pending manual selection, use pending.claimAndSelectWallet(walletId:) instead.
Import and activate a wallet
.ethereum or .ethereumBytes and .tron or .tronBytes. Solana imports take a 32-byte seed or 64-byte keypair, as bytes or base58. The SDK never stores the plaintext key. keyOrigin tells you whether a wallet was created by OMS (.enclave) or imported (.imported).
Attestation failures throw OMSWalletError with code .attestationVerificationFailed. Importing a key whose address is already managed throws .walletAddressAlreadyImported and leaves the active wallet unchanged; select the existing wallet or use a different key.
Understand access objects
Keep these three objects distinct:
The OIDC provider ID token used during authentication is a fourth object: it is app-owned identity proof consumed as auth input, not an OMS wallet token.
Request a wallet ID token
CallgetIdToken() only after a wallet is active. Send the returned string to a backend that verifies it using the OMS issuer and JWKS flow described in backend wallet verification.
List and revoke access grants
UselistAccess() to load all access-grant pages for account-management UI.
listAccessPage(pageSize:cursor:type:). Revoke only a grant whose credential has isCaller == false:
sessionId is required and revokes exactly that session. Revocation cannot be undone. Revoking the caller invalidates the credential making the current request and prevents subsequent protected operations from that session. Keep caller revocation out of the normal access-management UI.
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.
authorizeRemoteAccess fails with .requestFailed (upstreamError?.code "7208"); revoke a session the wallet no longer needs, then try again.
Backend credential registration and remote execution are outside the Swift SDK; implement them with the TypeScript SDK’s backend smart sessions guide.