CrossmintClient class final
Top-level facade for the Crossmint SDK.
CrossmintClient owns every sub-client (auth, wallets, credentials,
orders, tokens, users), the shared transport, the auth session store,
and the hidden WebView signer bridge. All sub-clients share a closure that
reads the live JWT from auth, so token refresh works without rebuilding
the dependency graph.
Lifecycle
- Construct the client with a CrossmintClientConfig.
await client.initialize()— validates config and auto-resolves the app ID from platform metadata if not supplied.await client.auth.restoreSession()— restores any persisted JWT.- Use sub-clients or factory helpers (
createWalletController,createEvmWallet, etc.) for the rest of your session. await client.dispose()when tearing down — shuts down the signer bridges and releases the auth client.
Typical bootstrap
final client = CrossmintClient(
config: const CrossmintClientConfig(
apiKey: 'YOUR_STAGING_API_KEY',
appScheme: 'com.your.app',
),
);
await client.initialize();
await client.auth.restoreSession();
final walletController = client.createWalletController(
const CrossmintWalletControllerConfig(showOtpSignerPrompt: true),
);
Named constructor parameters on the factory (auth, wallets, transport,
runtimeOverrides, etc.) are injection points primarily used by tests and
advanced integrations. Leave them null in production to get the default
HTTP transport, secure-storage-backed auth, and platform-resolved app ID.
Constructors
- CrossmintClient({required CrossmintClientConfig config, CrossmintAuthClient? auth, CrossmintWalletsClient? wallets, CrossmintCredentialsClient? credentials, CrossmintOrdersClient? orders, CrossmintTokensClient? tokens, CrossmintUsersClient? users, CrossmintTransport? transport, CrossmintAuthLauncher? authLauncher, CrossmintClientRuntimeOverrides? runtimeOverrides})
-
Creates a
CrossmintClient.factory
Properties
- appId → String?
-
The effective app ID — explicit CrossmintClientConfig.appId if set,
otherwise the value auto-resolved from platform metadata during
initialize. May be
nulluntil initialize has completed.no setter - auth → CrossmintAuthClient
-
Authentication sub-client — email OTP, OAuth, wallet sign-in, session
persistence, JWT refresh.
final
- authStorage → CrossmintAuthStorage
-
The auth storage adapter resolved during construction — either the one
passed via CrossmintClientConfig.authStorage or the default
flutter_secure_storage-backed implementation.no setter - config → CrossmintClientConfig
-
The configuration this client was built with.
final
- credentials → CrossmintCredentialsClient
-
Verifiable credentials sub-client — issue, query, and verify credentials.
final
- exportSignerBridgeController → CrossmintExportSignerBridgeRuntimeController
-
The shared export signer bridge controller, lazily constructed on first
access. Drives the private-key export flow in a separate WebView.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
The shared hidden signer bridge controller, lazily constructed on first
access. Powers non-custodial email/phone signing inside a hidden WebView.
no setter
- isDisposed → bool
-
Whether dispose has been called. Once disposed, the client cannot be
reused — construct a new one.
no setter
- isInitialized → bool
-
Whether initialize has completed successfully.
no setter
- orders → CrossmintOrdersClient
-
Orders sub-client — checkout orders and mint/purchase flows.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tokens → CrossmintTokensClient
-
Tokens sub-client — metadata and balances for tokens held by wallets.
final
- transport → CrossmintTransport
-
The HTTP transport resolved during construction. Shared by every
sub-client; injects the live JWT via a closure so token refresh works
without rebuilding dependencies.
no setter
- users → CrossmintUsersClient
-
Users sub-client — user profile lookups and updates.
final
- wallets → CrossmintWalletsClient
-
Wallet sub-client — create, list, and read Crossmint-hosted wallets
(EVM, Solana, Stellar) and their signers.
final
Methods
-
createDeviceWalletSigner(
{required String signerLocator, required String address, DeviceSignerKeyStorage? storage}) → CrossmintDeviceWalletSigner - Builds a hardware-backed device signer for an existing server signer.
-
createEvmExternalWalletSigner(
{required String address, String? signerLocator, required CrossmintExternalWalletSignCallback onSign}) → CrossmintEvmExternalWalletSigner - Builds an external-wallet EVM signer that delegates to a user-supplied CrossmintExternalWalletSignCallback. Use for wallets owned by the user (e.g. MetaMask, Rainbow) where the SDK only needs to request signatures.
-
createEvmNonCustodialSigner(
{required HiddenSignerBridge bridge, required String signerType, required String signerLocator, String? address, CrossmintSignerAuthRequiredCallback? onAuthRequired, CrossmintOtpDeliveryChannel? channel}) → CrossmintEvmNonCustodialSigner - Builds a non-custodial EVM signer bound to an existing HiddenSignerBridge. Produces secp256k1 signatures inside the WebView without exposing keys to Dart.
-
createEvmWallet(
{required CrossmintWallet wallet, CrossmintSignerConfig? recoverySigner, CrossmintWalletApprovalSigner? signer, List< CrossmintWalletApprovalSigner> additionalSigners = const <CrossmintWalletApprovalSigner>[], DeviceSignerKeyStorage? deviceSignerKeyStorage, CrossmintSignerAuthRequiredCallback? onAuthRequired}) → CrossmintEvmWallet - Wraps a server-issued CrossmintWallet in a runtime CrossmintEvmWallet.
-
createExportSignerBridge(
{HiddenSignerBridgeConfig? config}) → CrossmintExportSignerBridgeRuntimeController - Builds a new CrossmintExportSignerBridgeRuntimeController instance. Used internally by exportSignerBridgeController.
-
createHiddenSignerBridge(
{HiddenSignerBridgeConfig? config}) → HiddenSignerBridgeRuntimeController -
Builds a new HiddenSignerBridgeRuntimeController instance — used
internally by hiddenSignerBridgeController. Override the bridge
configto point at a custom signer URL (e.g. for testing). -
createPasskeyApprovalSigner(
{required String credentialId, required String signerLocator, required Future< CrossmintPasskeySignResult> onSign(String message)}) → CrossmintPasskeyApprovalSigner -
Builds a passkey approval signer. The caller provides
onSign— a callback that performs the WebAuthn / platform-native passkey assertion and returns a CrossmintPasskeySignResult. Native platform passkey support is pending (Stage 2); today every passkey signer requires an explicit callback orCrossmintSignerException(code: passkeyCallbackMissing)is thrown during signing. -
createSolanaExternalWalletSigner(
{required String address, String? signerLocator, required CrossmintExternalWalletSignCallback onSign}) → CrossmintSolanaExternalWalletSigner - Builds an external-wallet Solana signer that delegates to a user-supplied CrossmintExternalWalletSignCallback.
-
createSolanaNonCustodialSigner(
{required HiddenSignerBridge bridge, required String signerType, required String signerLocator, String? address, CrossmintSignerAuthRequiredCallback? onAuthRequired, CrossmintOtpDeliveryChannel? channel}) → CrossmintSolanaNonCustodialSigner - Builds a non-custodial Solana signer bound to an existing HiddenSignerBridge. Produces ed25519 signatures inside the WebView.
-
createSolanaWallet(
{required CrossmintWallet wallet, CrossmintSignerConfig? recoverySigner, CrossmintWalletApprovalSigner? signer, List< CrossmintWalletApprovalSigner> additionalSigners = const <CrossmintWalletApprovalSigner>[], DeviceSignerKeyStorage? deviceSignerKeyStorage, CrossmintSignerAuthRequiredCallback? onAuthRequired}) → CrossmintSolanaWallet - Wraps a server-issued CrossmintWallet in a runtime CrossmintSolanaWallet.
-
createStellarExternalWalletSigner(
{required String address, String? signerLocator, required CrossmintExternalWalletSignCallback onSign}) → CrossmintStellarExternalWalletSigner - Builds an external-wallet Stellar signer that delegates to a user-supplied CrossmintExternalWalletSignCallback.
-
createStellarNonCustodialSigner(
{required HiddenSignerBridge bridge, required String signerType, required String signerLocator, String? address, CrossmintSignerAuthRequiredCallback? onAuthRequired, CrossmintOtpDeliveryChannel? channel}) → CrossmintStellarNonCustodialSigner - Builds a non-custodial Stellar signer bound to an existing HiddenSignerBridge. Produces ed25519 signatures inside the WebView.
-
createStellarWallet(
{required CrossmintWallet wallet, CrossmintSignerConfig? recoverySigner, CrossmintWalletApprovalSigner? signer, List< CrossmintWalletApprovalSigner> additionalSigners = const <CrossmintWalletApprovalSigner>[], DeviceSignerKeyStorage? deviceSignerKeyStorage, CrossmintSignerAuthRequiredCallback? onAuthRequired}) → CrossmintStellarWallet - Wraps a server-issued CrossmintWallet in a runtime CrossmintStellarWallet.
-
createWalletController(
CrossmintWalletControllerConfig config) → CrossmintWalletController - Creates a CrossmintWalletController bound to this client.
-
dispose(
) → Future< void> - Releases the signer bridges and auth client, then marks the client as disposed. Safe to call multiple times. After disposal, construct a new CrossmintClient rather than reusing this one.
-
initialize(
) → Future< void> - Validates configuration and prepares the client for use.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited