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

wallets
[Wallet]
An array of Wallet objects currently associated with the authenticated user. This list is updated after operations like fetchWallets() or createWallet().
sessionState
ParaSessionState
The current session state of the Para SDK (e.g., .unknown, .inactive, .active, .activeLoggedIn).
environment
ParaEnvironment
The environment configuration for the Para SDK (e.g., .beta, .prod).
apiKey
String
The API key used for authenticating with Para services.
isReady
Bool
Indicates if the ParaManager and its underlying WebView are initialized and ready to process requests.

Initialization

init(environment:apiKey:appScheme:)
Function
Initializes a new ParaManager instance.

Authentication Methods

initiateAuthFlow(auth:)
Function
Starts the authentication (signup or login) process for a user with the specified email or phone number.
handleVerificationCode(verificationCode:)
Function
Submits the verification code (OTP) received by the user via email or SMS.
resendVerificationCode()
Function
Requests a new verification code to be sent to the user’s email or phone.
isSignupMethodAvailable(method:authState:)
Function
Checks if a specific signup method (passkey or password) is available based on the current AuthState.
handleSignup(authState:method:authorizationController:webAuthenticationSession:)
Function
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.
isLoginMethodAvailable(method:authState:)
Function
Checks if a specific login method (passkey or password) is available for an existing user.
handleLogin(authState:authorizationController:webAuthenticationSession:)
Function
Logs in an existing user, automatically determining and using the preferred available method (passkey or password).
loginWithPasskey(authorizationController:email:phone:)
Function
Logs in a user directly using their passkey.
generatePasskey(identifier:biometricsId:authorizationController:)
Function
Generates and registers a new passkey for the user. Typically called during signup when authState.stage == .signup and SignupMethod.passkey is chosen.
presentPasswordUrl(_ url:webAuthenticationSession:)
Function
Presents a web URL (typically for password setup/login) using a web authentication session.
handleOAuth(provider:webAuthenticationSession:authorizationController:)
Function
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.
loginExternalWallet(wallet:)
Function
Logs into Para using an externally managed wallet (e.g., MetaMask).

Session Management Methods

isFullyLoggedIn()
Function
Checks if there is an active session and the user is fully authenticated (e.g., passkey/password set up).
isSessionActive()
Function
Checks if there is any active session with Para, even if the user is not fully logged in (e.g., pending verification).
exportSession()
Function
Exports the current session for backup or transfer purposes.
logout()
Function
Logs out the current user and clears all session data.
getCurrentUserAuthDetails()
Function
Gets the current user’s persisted authentication details.
checkSessionState()
Function
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

fetchWallets()
Function
Retrieves all wallets associated with the current user.
createWallet(type:skipDistributable:)
Function
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.
getEmail()
Function
Retrieves the email of the currently authenticated user, if available and the session was initiated with an email.
distributeNewWalletShare(walletId:userShare:)
Function
(Advanced) Distributes a new share for an existing wallet.
getBalance(walletId:token:rpcUrl:chainPrefix:denom:)
Function
Gets the balance for any wallet type. This unified method works with all wallet types (EVM, Solana, Cosmos).
synchronizeRequiredWallets()
Function
Synchronizes required wallets by creating any missing non-optional wallet types. This should be called after successful authentication for new users.

Transfer Methods

transfer(walletId:to:amount:chainId:rpcUrl:)
Function
Transfers tokens using an EVM wallet. This method builds, signs, and broadcasts the transaction in one call.

Signing Methods

signMessage(walletId:message:timeoutMs:)
Function
Signs an arbitrary message using the specified wallet.
signTransaction(walletId:transaction:timeoutMs:)
Function
Signs a transaction object using the specified wallet. The method accepts any Encodable transaction type (EVMTransaction, SolanaTransaction, CosmosTransaction) and handles chain-specific formatting internally.
signTransaction(walletId:rlpEncodedTx:chainId:timeoutMs:)
Function
Signs an RLP-encoded EVM transaction string using the private key of the specified wallet. This method is maintained for backward compatibility.

Two-Factor Authentication (2FA) Methods

setup2fa()
Function
Initiates the setup process for 2FA.
enable2fa(verificationCode:)
Function
Enables 2FA for the user after they have scanned the URI and entered the code from their authenticator app.

MetaMaskConnector Class

The MetaMaskConnector class enables integration with MetaMask wallet for external wallet operations and authentication.

Properties

isConnected
Bool
Indicates whether the connector is currently connected to MetaMask.
accounts
[String]
Array of connected MetaMask account addresses.
chainId
String?
The current chain ID from MetaMask (e.g., “0x1” for Ethereum mainnet, “0xaa36a7” for Sepolia).

Initialization

init(para:appUrl:config:)
Function
Initializes a new MetaMaskConnector instance.

Methods

handleURL(_:)
Function
Processes incoming deep link URLs from MetaMask responses.
connect()
Function
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.
signMessage(_:account:)
Function
Requests MetaMask to sign a message with the specified account.
sendTransaction(_:account:)
Function
Sends a transaction through MetaMask using the specified account.

Error Types

ParaError
Error
The main error type for Para SDK operations.
MetaMaskError
Error
Errors specific to MetaMask connector operations.
CosmosTransactionError
Error
Errors specific to CosmosTransaction operations.
AuthorizationHandlingError
Error
Errors related to authorization handling in external wallet operations.

CosmosChain

CosmosChain
Enum
Supported Cosmos chains with testnet configurations.

CosmosSigningMethod

CosmosSigningMethod
Enum
Signing method for Cosmos transactions.

CosmosTransaction

CosmosTransaction
Struct
A struct representing a Cosmos transaction with messages, fees, and metadata.

CosmosSignResponse

CosmosSignResponse
Struct
Response from a Cosmos transaction signing operation.

CosmosCoin

CosmosCoin
Struct
Represents a coin amount in Cosmos with denomination and amount.

CosmosFee

CosmosFee
Struct
Represents transaction fees in Cosmos.

Type Definitions

SignatureResult

SignatureResult
Struct
Result of a message or transaction signing operation.

AuthState

AuthState
Struct
Authentication state returned by authentication operations.

TransferResult

TransferResult
Struct
Result returned from a successful EVM transfer operation.

Auth

Auth
Enum
Authentication type for initiateAuthFlow method.

OAuthProvider

OAuthProvider
Enum
Supported OAuth provider types for authentication.

SignupMethod & LoginMethod

SignupMethod
Enum
The possible methods for signup when the stage is .signup.
LoginMethod
Enum
The possible methods for login when the stage is .login.

Wallet

Wallet
Struct
Represents a wallet associated with a Para user account.

WalletType

WalletType
Enum
Supported wallet types for Para wallets.

MetaMaskConfig

MetaMaskConfig
Struct
Configuration object for MetaMask connector initialization.