Capsule Class

The Capsule class provides a Flutter interface for the Capsule SDK, managing wallet operations, authentication, and transactions.

Properties

environment
Environment

The environment configuration for the Capsule SDK.

apiKey
String

The API key used for authentication with Capsule services.

jsBridgeUri
Uri?

Optional URI to override the default JavaScript bridge.

relyingPartyId
String?

The relying party ID for WebAuthn operations.

Methods

Capsule()
Constructor

Constructs a new Capsule instance.

environment
Environment

The environment to use for the Capsule SDK.

apiKey
String

The API key for authentication.

jsBridgeUri
Uri?

Optional URI to override the default JavaScript bridge.

relyingPartyId
String?

The relying party ID for WebAuthn operations.

init()
Function

Initializes the Capsule SDK. Call this method immediately after constructing an instance.

clearStorage()
Future<void>

Clears storage associated with the Capsule SDK.

keepSecretKey
bool

Whether to retain the Paillier secret key.

setEmail()
Future<void>

Sets the email of the currently logged in user.

email
String

The email to set.

getEmail()
Future<String?>

Gets the email of the currently logged in user, if one exists.

login()
Future<dynamic>

Logs in a user using passkeys.

generatePasskey()
Future<void>

Generates a passkey for the user.

email
String

The user’s email.

biometricsId
String

The biometrics ID obtained from verification.

checkIfUserExists()
Future<bool>

Determines if a user exists with the given email address.

email
String

The email to check.

createUser()
Future<void>

Creates a new user with the given email address.

email
String

The email for the new user.

verifyEmail()
Future<String>

Supplies email verification code obtained from prompting the user.

verificationCode
String

The verification code to verify.

setup2FA()
Future<String>

Sets up two-factor authentication for the user.

uri
String

The URI for setting up 2FA in an authenticator app.

enable2FA()
Future<void>

Turns on two-factor authentication for the user.

verificationCode
String

The verification code for enabling 2FA.

check2FAStatus()
Future<bool>

Checks if 2FA is enabled for the user.

createWallet()
Future<CreateWalletResult>

Creates a wallet for the user.

skipDistribute
bool

Whether to skip distributable wallet creation.

signMessage()
Future<FullSignatureResult>

Signs a message using the specified wallet.

walletId
String

The ID of the wallet to use for signing.

messageBase64
String

The base64-encoded message to sign.

signTransaction()
Future<FullSignatureResult>

Signs a transaction using the specified wallet.

walletId
String

The ID of the wallet to use for signing.

rlpEncodedTxBase64
String

The RLP encoded transaction in base64.

chainId
String

The chain ID of the network.

sendTransaction()
Future<FullSignatureResult>

Sends a transaction using the specified wallet.

walletId
String

The ID of the wallet to use for sending.

rlpEncodedTxBase64
String

The RLP encoded transaction in base64.

chainId
String

The chain ID of the network.

logout()
Future<void>

Logs the user out.

dispose()
void

Instructs the SDK to dispose of any resources that require explicit disposal.