Para Flutter SDK

Cross-platform mobile SDK for Para's embedded wallet solution using Multi-Party Computation (MPC) for secure key management. Built with hardware-backed passkeys and supporting all major blockchains, Para makes it easy to add Web3 capabilities to your Flutter apps.

Note: The 2.0.0-alpha branch has been merged into main. If you were referencing 2.0.0-alpha in your pubspec.yaml git dependency, please update to main. The 2.0.0-alpha branch is now deprecated and will be removed in the future.

Overview

Para provides secure MPC wallet functionality and streamlined authentication flows for cross-platform mobile applications. The v2 SDK offers a unified authentication flow that automatically handles both new and existing users.

Key Features

  • 🔐 Hardware-Backed Security - Passkey authentication using device secure enclaves
  • 🌐 Multi-Chain Support - Single wallet works across EVM, Solana, and Cosmos networks
  • 📱 Cross-Platform - Native iOS and Android support with Flutter's ecosystem
  • ⚡ Unified Auth Flow - Streamlined v2 API handles both new and existing users
  • 🔧 Flexible Integration - Works with popular blockchain libraries like web3dart and solana

Requirements

  • Flutter 3.0+
  • Dart 3.0+
  • iOS 13.0+ / Android API 23+

Installation

Add Para to your pubspec.yaml:

dependencies:
  para: ^latest_version

Then run:

flutter pub add para

Platform Setup

iOS Setup

  1. Open your Flutter project's iOS folder in Xcode
  2. Select your target and go to "Signing & Capabilities"
  3. Click "+ Capability" and add "Associated Domains"
  4. Add these domains:
    • webcredentials:app.beta.usecapsule.com
    • webcredentials:app.usecapsule.com

Important: Register your TeamId and BundleId with Para via the Developer Portal for passkey functionality.

Android Setup

For testing, you can use com.getpara.example.flutter as your package name with the default debug keystore.

Add this to your android/build.gradle to fix namespace issues:

subprojects {
    afterEvaluate { project ->
        if (project.hasProperty('android')) {
            project.android {
                if (namespace == null) {
                    namespace project.group
                }
            }
        }
    }
}

Quick Start

1. Initialize Para

import 'package:para/para.dart';

final para = Para(
  environment: Environment.beta, // or Environment.prod
  apiKey: 'YOUR_PARA_API_KEY',
  appScheme: 'yourapp', // Required for OAuth/WebAuth
);

2. Email or Phone Authentication

authenticateWithEmailOrPhone (2.11.0 and later) signs a user up or in with one call and returns an AuthenticationResult (userId, isNewUser) once the session is active. This is the recommended way to sign in.

Para decides which sign-in flow runs for your app. There is nothing to configure or detect:

  • Where Para's updated authentication flow is enabled, the user enters their one-time code (or password) on a Para-hosted page inside the web authentication session. A new user then creates a passkey with the native prompt, or a password or PIN on a hosted page. A returning passkey user signs in with the native passkey prompt. verificationCodeProvider is not called.
  • Otherwise the SDK runs the earlier flow and asks your verificationCodeProvider for the code Para sent. If the code is rejected, the provider is called again with the error so you can show it and ask for another. Throw from the provider to cancel.
final webAuthSession = FlutterWebAuthSession(callbackUrlScheme: 'yourapp');

Future<void> signIn(String email) async {
  try {
    final result = await para.authenticateWithEmailOrPhone(
      auth: Auth.email(email), // or Auth.phone('+15551234567'), full number with country code
      webAuthenticationSession: webAuthSession,
      verificationCodeProvider: (previousError) async {
        // Show your code entry UI and return what the user typed.
        // previousError is set when the last code was rejected.
        return promptForCode(previousError); // Your own function
      },
    );
    print('Signed in ${result.userId}, new user: ${result.isNewUser}');
  } on ParaBridgeException catch (e) {
    if (e.code == 'two_factor_required') {
      // See "Two-factor authentication" below
    }
    rethrow;
  }
}

If a user is already signed in, the call throws instead of starting a new sign-in. Call logout() first.

Two-factor authentication. When an account has to complete two-factor authentication, the updated flow shows that step on the Para-hosted page and the call returns as usual. The earlier flow cannot show it. There the SDK cancels the pending sign-in and throws a ParaBridgeException with code two_factor_required. Its details hold mode (verify, or enroll when the account must set up a second factor first) and the accepted methods. The stage-based methods below, verifyOAuth and loginExternalWallet always run the earlier flow, so they throw this error for such accounts.

Stage-based alternative. The stage-based methods keep working if you want to drive each step yourself:

Future<void> authenticateWithEmail(String email) async {
  // Step 1: Initiate auth flow
  final authState = await para.initiateAuthFlow(
    auth: Auth.email(email)
  );
  
  // Step 2: Handle based on auth stage
  switch (authState.stage) {
    case AuthStage.verify:
      // New user - needs verification
      print('Verification code sent to $email');
      break;
      
    case AuthStage.login:
      // Existing user - proceed to login
      await para.handleLogin(
        authState: authState,
        webAuthenticationSession: webAuthSession,
      );
      break;

    case AuthStage.signup:
      break;
  }
}

Future<void> verifyAndSignup(String verificationCode) async {
  final verifiedState = await para.verifyOtp(otp: verificationCode);
  
  if (verifiedState.stage == AuthStage.signup) {
    await para.handleSignup(
      authState: verifiedState,
      signupMethod: SignupMethod.passkey,
      webAuthenticationSession: webAuthSession,
    );
  }
}

3. Social Login

authenticateWithOAuth (2.11.0 and later) runs the whole provider sign-in and returns an AuthenticationResult:

final result = await para.authenticateWithOAuth(
  provider: OAuthMethod.google,
  webAuthenticationSession: webAuthSession,
);

verifyOAuth remains available as an alternative:

Future<void> loginWithGoogle() async {
  final authState = await para.verifyOAuth(
    provider: OAuthMethod.google,
    appScheme: 'yourapp',
  );
  
  final isActive = await para.isSessionActive();
  if (isActive) {
    final wallets = await para.fetchWallets();
  }
}

4. External Wallet Sign-In

authenticateWithExternalWallet (2.11.0 and later) signs a user in with a wallet they already control. Where the updated flow is enabled, the SDK asks signMessage to sign a sign-in message and verifies the signature. That session proves control of the address only and does not give access to the account's embedded Para wallets. Otherwise the call signs in with the address alone, as loginExternalWallet does, and signMessage is not called. A Cosmos wallet also needs the signCosmosMessage parameter.

await metaMaskConnector.connect();
final account = metaMaskConnector.accounts.first;

final result = await para.authenticateWithExternalWallet(
  address: account,
  type: WalletType.evm,
  provider: 'metamask',
  signMessage: (message) => metaMaskConnector.signMessage(message, account),
);

The session that connect() starts is replaced by this call.

5. Working with Wallets

// Get all wallets
final wallets = await para.fetchWallets();

for (final wallet in wallets) {
  print('Type: ${wallet.type}'); // WalletType.evm, .solana, or .cosmos
  print('Address: ${wallet.address}');
}

// Sign a message
final signatureFuture = para.signMessage(
  walletId: wallet.id,
  messageBase64: base64Encode(utf8.encode('Hello Para!')),
);

final signature = await signatureFuture.future;

Blockchain Integration

EVM (Ethereum)

import 'package:para/para.dart';

final evmSigner = para.getEvmSigner();
// Use with web3dart for transaction signing

Solana

final solanaSigner = para.getSolanaSigner();
// Use with native Dart SDK for transaction signing

Cosmos

// Sign Cosmos transactions with Para's signing infrastructure
final signature = await para.signMessage(
  walletId: cosmosWallet.id,
  messageBase64: base64SignDoc,
);

Authentication Methods

  • Passkeys: Hardware-backed authentication using device biometrics
  • Social Login: Google, Apple, Discord, Twitter, Facebook, Farcaster, Telegram
  • Email/Phone: Traditional verification with passkey creation
  • External Wallets: Connect MetaMask, Phantom, and other wallets

Session Management

// Check if session is active
final isActive = await para.isSessionActive();

// Export session for backup
final sessionData = await para.exportSession();

// Logout
await para.logout();

Advanced Features

  • Pregenerated Wallets: Work with pre-created wallet infrastructure
  • External Wallet Connectivity: Connect to MetaMask, Phantom, and others
  • Cancellable Operations: All async operations return ParaFuture with cancellation support
  • Session Persistence: Automatic session management across app restarts

Development Commands

# Build
flutter build

# Run tests
flutter test

# Analyze code
flutter analyze

# Format code
dart format .

Examples

Explore our comprehensive Flutter example app demonstrating all Para features:

  • Flutter Example App
  • Complete authentication flows
  • Multi-chain transaction signing
  • Session management
  • Error handling patterns

Documentation

Support

Libraries

para