Appearance
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.
swift
/// The Privy user object
public protocol PrivyUser {
/// The user's Privy ID
var id: String { get }
/// The user's ID token
var identityToken: String? { get }
/// The point in time at which the logged in user was created.
/// Value will only be nil if there is no user currently logged in.
var createdAt: Date? { get }
// A list of all linked accounts - can be authentication methods or embedded wallets
var linkedAccounts: [LinkedAccount] { get }
// A list of user's ethereum wallets
var embeddedEthereumWallets: [EmbeddedEthereumWallet] { get }
// A list of the user's solana wallets
var embeddedSolanaWallets: [EmbeddedSolanaWallet] { get }
// Refresh the user
func refresh() async throws
// Returns the user's access token, but will first refresh the user session if needed.
func getAccessToken() async throws -> String
// Other user methods
}
public enum LinkedAccount {
case phone(PhoneNumberAccount)
case email(EmailAccount)
case customAuth(CustomAuth)
case embeddedEthereumWallet(EmbeddedEthereumWalletAccount)
case embeddedSolanaWallet(EmbeddedSolanaWalletAccount)
// Other linked account types
}