Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.polygon.technology/llms.txt

Use this file to discover all available pages before exploring further.

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 = OMSClient(
    projectAccessKey: "YOUR_PROJECT_ACCESS_KEY",
    projectId: "YOUR_PROJECT_ID"
)

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

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 custom claims to include in the token.
Returns Returns String.

List Access

List credentials that currently have access to the active wallet.
let credentials = try await oms.wallet.listAccess()

for credential in credentials {
    print(credential.credentialId, credential.expiresAt, credential.isCaller)
}
Parameters Takes no parameters. 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 used for each Wallet API 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 keychain session, wallet identifiers, verifier state, OIDC redirect state, and session signer. Parameters Takes no parameters. Returns Returns Void.