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.

kotlin
public data class PrivyUser(
    // The user's Privy ID
    val id: String,

    // A list of all linked accounts - can be authentication methods or embedded wallets
    val linkedAccounts: List<LinkedAccount>,

    // A list of user's ethereum wallets
    val ethereumWallets: List<EmbeddedEthereumWallet>,

    // A list of the user's solana wallets
    val solanaWallets: List<EmbeddedSolanaWallet>

    // Refresh the user
    public suspend fun refresh(): Result<Unit>

    // Other user methods
)

public sealed interface LinkedAccount {
    public data class PhoneAccount(/* Account specific data */) : LinkedAccount

    public data class EmailAccount(/* Account specific data */) : LinkedAccount

    public data class CustomAuth(/* Account specific data */) : LinkedAccount

    public data class EmbeddedEthereumWalletAccount(/* Account specific data */) : LinkedAccount

    public data class EmbeddedSolanaWalletAccount(/* Account specific data */) : LinkedAccount

    // Other linked account types
}