Skip to main content
Use the Swift SDK session APIs after authentication to restore wallet state, issue ID tokens, and manage credential access.

Session Restore

The SDK stores wallet metadata and the request-signing credential in the device keychain. A saved completed session is restored automatically when OMSClient is created.
let oms = try OMSClient(publishableKey: "YOUR_PUBLISHABLE_KEY")

if let walletAddress = oms.wallet.session.walletAddress {
    print("Restored wallet:", walletAddress)
}
Returns oms.wallet.session returns SessionState with walletAddress, expiresAt, loginType, and sessionEmail.

Session Expiry Events

Assign onSessionExpired when the app should react as soon as the active wallet session expires.
oms.wallet.onSessionExpired = { event in
    print("Session expired at:", event.expiredAt)
    print("Expired wallet:", event.session.walletAddress ?? "")
}
Keep the handler assigned while the owner needs updates. Assign nil during cleanup. Parameters
ParameterTypeDescription
onSessionExpired((SessionExpiredEvent) -> Void)?Optional handler that receives session and expiredAt when the wallet session expires.
Returns The handler returns Void.

List Wallets

List wallets available to the authenticated credential.
let wallets = try await oms.wallet.listWallets()

for wallet in wallets {
    print(wallet.id, wallet.type, wallet.address)
}
Parameters Takes no parameters. Returns Returns [Wallet].

Get ID Token

Request an ID token for the active wallet session. Send this token to your backend when using backend wallet verification.
let idToken = try await oms.wallet.getIdToken(ttlSeconds: 300)
Parameters
ParameterTypeDescription
ttlSecondsUInt32?Optional token lifetime in seconds.
customClaims[String: WebRPCJSONValue]?Optional app-provided claims. Backends should treat them as client-provided context unless they control the values.
Returns Returns String.

List Access

List wallet access grants for account-management UI.
let credentials = try await oms.wallet.listAccess()

for credential in credentials {
    print(credential.credentialId, credential.expiresAt, credential.isCaller)
}
Parameters
ParameterTypeDescription
pageSizeUInt32?Optional page size for each access-list request while loading all pages.
Returns Returns [CredentialInfo].

List Access Pages

Use listAccessPages when your UI should render credential access one page at a time.
for try await page in oms.wallet.listAccessPages(pageSize: 25) {
    for credential in page.credentials {
        print(credential.credentialId, credential.isCaller)
    }
}
Parameters
ParameterTypeDescription
pageSizeUInt32?Optional page size for each access-list request.
Returns Returns ListAccessPages, an async sequence of ListAccessResponse values.

List Access Page

Fetch one credential-access page with an optional cursor.
let page = try await oms.wallet.listAccessPage(pageSize: 25)
let nextCursor = page.page?.cursor
Parameters
ParameterTypeDescription
pageSizeUInt32?Optional page size for this request.
cursorString?Optional cursor returned by a previous page.
Returns Returns ListAccessResponse.

Revoke Access

Revoke another credential’s access to the active wallet.
try await oms.wallet.revokeAccess(targetCredentialId: "credential-id")
Parameters
ParameterTypeDescription
targetCredentialIdStringCredential ID returned by listAccess().
Returns Returns Void.

Sign Out

try oms.wallet.signOut()
Signing out clears the saved wallet session and authentication state from the keychain. The user must authenticate again before wallet operations. Parameters Takes no parameters. Returns Returns Void.