para 2.6.0 copy "para: ^2.6.0" to clipboard
para: ^2.6.0 copied to clipboard

Flutter package for Para SDK

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.production
  apiKey: 'YOUR_PARA_API_KEY',
  deepLinkScheme: 'yourapp://callback', // Required for OAuth/WebAuth
);

2. Email Authentication #

import 'package:para/src/auth_extensions.dart';

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
      final wallet = await para.loginWithPasskey(email: authState.email);
      break;
  }
}

Future<void> verifyAndSignup(String verificationCode) async {
  final verifiedState = await para.verifyNewAccount(
    verificationCode: verificationCode
  );
  
  if (verifiedState.stage == AuthStage.signup) {
    final wallet = await para.handleSignup(
      authState: verifiedState,
      method: SignupMethod.passkey,
    );
  }
}

3. Social Login #

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. 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 #