The Para Swift SDK provides a comprehensive toolkit for integrating non-custodial wallet functionality, passkey-based authentication, and blockchain interactions into your native iOS applications.
ParaManager Class
The ParaManager
class is the central component for managing user authentication, wallet operations, and session state.
Properties
An array of Wallet
objects currently associated with the authenticated user. This list is updated after operations like fetchWallets()
or createWallet()
.
The current session state of the Para SDK (e.g., .unknown
, .inactive
, .active
, .activeLoggedIn
).
The environment configuration for the Para SDK (e.g., .beta
, .prod
).
The API key used for authenticating with Para services.
Indicates if the ParaManager
and its underlying WebView are initialized and ready to process requests.
Initialization
init(environment:apiKey:appScheme:)
Initializes a new ParaManager
instance. The Para environment to use (e.g., .beta
, .prod
).
Optional. Your app’s custom URL scheme (e.g., “yourapp://”). Defaults to the app’s bundle identifier. Used for OAuth and other redirection flows.
Authentication Methods
Starts the authentication (signup or login) process for a user with the specified email or phone number. The authentication identifier: .email(String)
for email or .phone(String)
for a full phone number (e.g., “+15551234567”).
An AuthState
object indicating the next step in the flow (e.g., .verify
for new users, .login
for existing users).
handleVerificationCode(verificationCode:)
Submits the verification code (OTP) received by the user via email or SMS. The verification code entered by the user.
An AuthState
object, typically with stage == .signup
, indicating the user is verified and needs to choose a signup method (passkey or password).
Requests a new verification code to be sent to the user’s email or phone.
isSignupMethodAvailable(method:authState:)
Checks if a specific signup method (passkey or password) is available based on the current AuthState
. The signup method to check (e.g., .passkey
).
The current AuthState
(should have stage == .signup
).
true
if the method is available, false
otherwise.
handleSignup(authState:method:authorizationController:webAuthenticationSession:)
Completes the signup process for a new, verified user using the chosen method (passkey or password). This typically includes creating a passkey/password and the first wallet. The current AuthState
(must have stage == .signup
).
The chosen signup method (.passkey
or .password
).
An ASAuthorizationController
instance for handling Passkey UI operations.
A WebAuthenticationSession
conforming object for handling web-based authentication (e.g., password setup).
isLoginMethodAvailable(method:authState:)
Checks if a specific login method (passkey or password) is available for an existing user. The login method to check (e.g., .passkey
).
The current AuthState
(should have stage == .login
).
true
if the method is available, false
otherwise.
handleLogin(authState:authorizationController:webAuthenticationSession:)
Logs in an existing user, automatically determining and using the preferred available method (passkey or password). The current AuthState
(must have stage == .login
).
An ASAuthorizationController
instance for Passkey UI.
A WebAuthenticationSession
for web-based login (e.g., password).
loginWithPasskey(authorizationController:email:phone:)
Logs in a user directly using their passkey. An ASAuthorizationController
instance for Passkey UI.
Optional. The user’s email if known, to help filter passkeys.
Optional. The user’s full phone number if known, to help filter passkeys. If both email and phone are nil, the system prompts for any available passkey.
generatePasskey(identifier:biometricsId:authorizationController:)
Generates and registers a new passkey for the user. Typically called during signup when authState.stage == .signup
and SignupMethod.passkey
is chosen. The user’s identifier (email or full phone number).
The passkeyId
obtained from AuthState.passkeyId
when authState.stage == .signup
.
An ASAuthorizationController
instance for Passkey UI.
presentPasswordUrl(_ url:webAuthenticationSession:)
Presents a web URL (typically for password setup/login) using a web authentication session. The URL to present (e.g., authState.passwordUrl
).
A WebAuthenticationSession
conforming object.
The callback URL if authentication was successful via direct callback, or nil on failure/cancellation.
handleOAuth(provider:webAuthenticationSession:authorizationController:)
Initiates and handles the entire OAuth flow with the specified provider (e.g., Google, Apple, Discord).
This includes user authentication with the provider, Para account lookup/creation, and passkey setup if it’s a new Para user. The OAuth provider to use (e.g., .google
).
A WebAuthenticationSession
for handling the OAuth web flow.
An ASAuthorizationController
for potential passkey setup.
Returns nothing on success. Throws ParaError or other authentication-related errors on failure.
loginExternalWallet(wallet:)
Logs into Para using an externally managed wallet (e.g., MetaMask). Information about the external wallet, including its address and type.
Session Management Methods
Checks if there is an active session and the user is fully authenticated (e.g., passkey/password set up). true
if the user is fully logged in, false
otherwise.
Checks if there is any active session with Para, even if the user is not fully logged in (e.g., pending verification). true
if there is any active session, false
otherwise.
Exports the current session for backup or transfer purposes. The session data as a string that can be saved and restored later.
Logs out the current user and clears all session data.
getCurrentUserAuthDetails()
Gets the current user’s persisted authentication details. The current user’s authentication state, or nil if no user is authenticated. The ‘stage’ will be set to ‘login’ for active sessions.
Manually checks and updates the current session state. This method waits for the Para WebView to be ready and updates the session state accordingly.
Wallet Management Methods
Retrieves all wallets associated with the current user. An array of Wallet
objects associated with the user.
createWallet(type:skipDistributable:)
Creates a new wallet for the authenticated user. This method initiates wallet creation and refreshes the internal wallets
list. Observe the paraManager.wallets
property for the new wallet. The type of wallet to create (e.g., .evm
, .solana
, .cosmos
).
Whether to skip the distributable key generation step.
Retrieves the email of the currently authenticated user, if available and the session was initiated with an email. The user’s email address.
distributeNewWalletShare(walletId:userShare:)
(Advanced) Distributes a new share for an existing wallet. The user share to distribute.
getBalance(walletId:token:rpcUrl:chainPrefix:denom:)
Gets the balance for any wallet type. This unified method works with all wallet types (EVM, Solana, Cosmos). Optional token identifier (contract address for EVM, mint address for Solana, etc.).
Optional RPC URL (recommended for Solana and Cosmos to avoid 403/CORS issues).
Optional bech32 prefix for Cosmos (e.g., “juno”, “stars”).
Optional denom for Cosmos balances (e.g., “ujuno”, “ustars”).
The balance as a string (format depends on the chain).
synchronizeRequiredWallets()
Synchronizes required wallets by creating any missing non-optional wallet types. This should be called after successful authentication for new users. Array of newly created wallets, if any.
Transfer Methods
transfer(walletId:to:amount:chainId:rpcUrl:)
Transfers tokens using an EVM wallet. This method builds, signs, and broadcasts the transaction in one call. The ID of the EVM wallet to use for the transfer.
The amount to send in wei (smallest unit).
Optional. The chain ID for the EVM network. If not provided, uses the wallet’s default chain.
Optional. Custom RPC URL for the transaction. If not provided, uses the default RPC for the chain.
A TransferResult object containing transaction details.
This method is only available for EVM wallets. Solana and Cosmos wallets must use signing methods only.
Signing Methods
signMessage(walletId:message:timeoutMs:)
Signs an arbitrary message using the specified wallet. The ID of the wallet to use for signing.
The raw message string to sign. The SDK will Base64-encode this string before signing.
Optional. Timeout for the signing operation in milliseconds.
A SignatureResult object containing the signature and metadata.
signTransaction(walletId:transaction:timeoutMs:)
Signs a transaction object using the specified wallet. The method accepts any Encodable transaction type (EVMTransaction, SolanaTransaction, CosmosTransaction) and handles chain-specific formatting internally. The ID of the wallet to use for signing.
The transaction object to sign. Can be EVMTransaction, SolanaTransaction, or CosmosTransaction.
Optional. Timeout for the signing operation in milliseconds.
A SignatureResult containing the signed transaction. For EVM, this includes the complete RLP-encoded transaction in signedTransaction
. For Solana/Cosmos, if only a signature is available (e.g., pre-serialized transactions), it’s provided in signedTransaction
. Use result.transactionData
(computed property) to get the value for broadcasting.
For EVM transactions, the returned SignatureResult
contains the complete RLP-encoded transaction ready for broadcasting via eth_sendRawTransaction
.
signTransaction(walletId:rlpEncodedTx:chainId:timeoutMs:)
Signs an RLP-encoded EVM transaction string using the private key of the specified wallet. This method is maintained for backward compatibility. The ID of the EVM wallet to use for signing.
The RLP-encoded transaction as a hex string. The SDK will Base64-encode this string.
The chain ID of the EVM network.
Optional. Timeout for the signing operation in milliseconds.
The resulting transaction signature as a hex string.
Two-Factor Authentication (2FA) Methods
Initiates the setup process for 2FA. Returns .alreadySetup
if 2FA is already configured, or .needsSetup(uri: String)
containing the URI to be displayed in an authenticator app (e.g., as a QR code).
enable2fa(verificationCode:)
Enables 2FA for the user after they have scanned the URI and entered the code from their authenticator app. The 2FA code from the user’s authenticator app.
The MetaMaskConnector
class enables integration with MetaMask wallet for external wallet operations and authentication.
Properties
Indicates whether the connector is currently connected to MetaMask.
Array of connected MetaMask account addresses.
The current chain ID from MetaMask (e.g., “0x1” for Ethereum mainnet, “0xaa36a7” for Sepolia).
Initialization
init(para:appUrl:config:)
Initializes a new MetaMaskConnector
instance. The ParaManager instance.
Your app’s URL scheme for deep link callbacks.
Configuration object containing app metadata.
Methods
Processes incoming deep link URLs from MetaMask responses. The incoming URL to process.
Initiates connection to MetaMask and requests account access. This method is async throws
. Upon successful connection, the accounts
, chainId
, and isConnected
properties of the MetaMaskConnector
instance are updated. ParaManager.loginExternalWallet
is also called internally.
Requests MetaMask to sign a message with the specified account. The message string to be signed.
The account address to use for signing.
The resulting signature from MetaMask.
sendTransaction(_:account:)
Sends a transaction through MetaMask using the specified account. transaction
EVMTransaction or [String: String]
The transaction object or dictionary containing transaction parameters.
The account address to use for the transaction.
The transaction hash returned by MetaMask.
Error Types
The main error type for Para SDK operations. An error occurred while executing JavaScript bridge code.
The JavaScript bridge did not respond in time.
A general error occurred.
Feature not implemented yet.
Errors specific to MetaMask connector operations. Another MetaMask operation is already in progress.
Failed to construct a valid URL for MetaMask communication.
Received an invalid or unexpected response from MetaMask.
metaMaskError(code: Int, message: String)
An error reported by the MetaMask app itself (e.g., user rejection code 4001).
MetaMask app is not installed on the device.
Errors specific to CosmosTransaction operations. Transaction encoding failed.
AuthorizationHandlingError
Errors related to authorization handling in external wallet operations. Invalid response received from authorization process.
Authorization was cancelled by the user.
CosmosChain
Supported Cosmos chains with testnet configurations. Cosmos Hub network with chain ID “provider”, prefix “cosmos” and default denom “uatom” (testnet).
Osmosis network with chain ID “osmo-test-5”, prefix “osmo” and default denom “uosmo” (testnet).
Juno network with chain ID “uni-6”, prefix “juno” and default denom “ujuno” (testnet).
Stargaze network with chain ID “elgafar-1”, prefix “stars” and default denom “ustars” (testnet).
The chain ID for this network.
The bech32 prefix for this chain.
Default denomination for this chain.
Default RPC URL for this chain’s testnet.
CosmosSigningMethod
Signing method for Cosmos transactions. Legacy Amino JSON signing method for backward compatibility.
Modern Proto/Direct binary signing method (recommended - more efficient).
CosmosTransaction
A struct representing a Cosmos transaction with messages, fees, and metadata. The transaction messages.
Preferred signing method (defaults to proto).
transfer(fromAddress:toAddress:amount:denom:feeDenom:feeAmount:gas:memo:signingMethod:)
Convenience initializer for creating token transfer transactions.
CosmosSignResponse
Response from a Cosmos transaction signing operation. The signature information.
CosmosCoin
Represents a coin amount in Cosmos with denomination and amount. The token denomination (e.g., “uatom”).
The amount as a string in the smallest unit.
Creates a new coin with string amount.
Creates a new coin with UInt64 amount.
CosmosFee
Represents transaction fees in Cosmos. Creates a fee with array of coins.
Convenience initializer for simple fee.
Type Definitions
SignatureResult
Result of a message or transaction signing operation. For transaction signing: Contains the complete signed transaction ready for broadcasting (RLP-encoded for EVM, serialized for other chains).
For message signing: Contains just the signature.
Note: The bridge returns signature
for messages and signedTransaction
for transactions, but Swift SDK normalizes both to signedTransaction
for consistency.
Computed property that returns the signed transaction data for broadcasting.
The ID of the wallet that performed the signing.
The wallet type that signed (e.g., “evm”, “solana”, “cosmos”).
AuthState
Authentication state returned by authentication operations. The stage of authentication (.verify
, .signup
, .login
).
The Para userId for the currently authenticating user.
Email address if using email auth.
Phone number if using phone auth.
Display name for the authenticating user.
Profile picture URL for the authenticating user.
Username for the authenticating user.
URL for passkey authentication.
URL for passkey authentication on a known device.
URL for password authentication.
Biometric hints for the user’s devices.
TransferResult
Result returned from a successful EVM transfer operation. The transaction hash on the blockchain.
The amount transferred in wei (smallest unit).
The chain ID where the transaction was broadcast.
Auth
Authentication type for initiateAuthFlow method. Email-based authentication.
Phone-based authentication with full phone number including country code.
OAuthProvider
Supported OAuth provider types for authentication. Google authentication provider.
Discord authentication provider.
Apple authentication provider.
SignupMethod & LoginMethod
The possible methods for signup when the stage is .signup.
The possible methods for login when the stage is .login. Passkey login on a known device.
Wallet
Represents a wallet associated with a Para user account. Unique identifier for the wallet.
The type of wallet (e.g., .evm
, .solana
, .cosmos
).
Primary public address of the wallet.
Secondary address (e.g., Cosmos bech32 address for Cosmos wallets).
Public key of the wallet.
Scheme used by the wallet.
Timestamp when the wallet was created.
WalletType
Supported wallet types for Para wallets. Ethereum Virtual Machine compatible wallet (Ethereum, Polygon, etc.).
Solana blockchain wallet.
Cosmos ecosystem wallet supporting bech32 addresses.
Configuration object for MetaMask connector initialization. The name of your application as displayed in MetaMask.
Your application’s identifier (typically the bundle identifier).
The API version to use (e.g., “1.0”).