Skip to content

The user object

Once a user has authenticated with Privy, you will have access to the PrivyUser object. This will be the main entry point for all user actions.

dart
abstract class PrivyUser {
  /// Unique identifier for the user.
  String get id;

  /// List of linked accounts associated with the user.
  List<LinkedAccounts> get linkedAccounts;

  /// List of embedded Ethereum wallets associated with the user.
  List<EmbeddedEthereumWallet> get embeddedEthereumWallets;

  /// List of embedded Solana wallets associated with the user.
  List<EmbeddedSolanaWallet> get embeddedSolanaWallets;

  /// Creates an Ethereum embedded wallet for the user.
  Future<Result<EmbeddedEthereumWallet>> createEthereumWallet(
      {bool allowAdditional = false});

  /// Creates a Solana embedded wallet for the user.
  Future<Result<EmbeddedSolanaWallet>> createSolanaWallet();
}

Linked accounts

A user contains a list of LinkedAccounts, which are all account types associated with the user.

dart
/// A sealed class representing different types of linked accounts.
sealed class LinkedAccount {}

/// Represents a phone number-based linked account.
class PhoneAccount extends LinkedAccount {}

/// Represents an email-based linked account.
class EmailAccount extends LinkedAccount {}

/// Represents a custom authentication-linked account.
class CustomAuth extends LinkedAccount {}

/// Represents an Ethereum embedded wallet linked account.
class EmbeddedEthereumWalletAccount extends LinkedAccount {}

/// Represents a Solana embedded wallet linked account.
class EmbeddedSolanaWalletAccount extends LinkedAccount {}