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

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.

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.

Signing Methods

signMessage(walletId:message:timeoutMs:)
Function

Signs an arbitrary message using the specified wallet.

signTransaction(walletId:rlpEncodedTx:chainId:timeoutMs:)
Function

Signs an RLP-encoded EVM transaction string using the private key of the specified wallet.

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.

ParaEvmSigner Class

The ParaEvmSigner class provides a convenient way to sign and send EVM transactions using a Para-managed wallet. It interacts with an EVM-compatible JSON-RPC endpoint.

Initialization

init(paraManager:rpcUrl:walletId:)
Function

Initializes a new ParaEvmSigner instance.

Methods

selectWallet(walletId:)
Function

Selects or switches the active EVM wallet for this signer instance.

signMessage(message:)
Function

Signs an arbitrary message string using the selected EVM wallet.

signTransaction(transactionB64:)
Function

Signs a pre-formatted, Base64-encoded EVM transaction.

sendTransaction(transactionB64:)
Function

Signs and broadcasts an EVM transaction to the network via the configured RPC URL.

ParaSolanaSigner Class

The ParaSolanaSigner class facilitates signing and sending Solana transactions using a Para-managed wallet, interacting with a Solana JSON-RPC endpoint.

Initialization

init(paraManager:rpcUrl:walletId:)
Function

Initializes a new ParaSolanaSigner instance.

Methods

selectWallet(walletId:)
Function

Selects or switches the active Solana wallet for this signer instance.

getPublicKey()
Function

Gets the current wallet’s public key.

getBalance()
Function

Gets the SOL balance for this wallet.

signBytes(_:)
Function

Signs arbitrary bytes (for demo/testing purposes).

signTransaction(_:)
Function

Signs a Solana transaction using the bridge.

sendTransaction(_:)
Function

Sends a transaction to the network using the bridge.

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.

ParaSolanaSignerError
Error

Errors specific to ParaSolanaSigner operations.

MetaMaskError
Error

Errors specific to MetaMask connector operations.

AuthorizationHandlingError
Error

Errors related to authorization handling in external wallet operations.

Type Definitions

AuthState

AuthState
Struct

Authentication state returned by authentication operations.

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.

MetaMaskConfig

MetaMaskConfig
Struct

Configuration object for MetaMask connector initialization.