DecaneDocs
DataServer-side wallets
Data

Server-side wallet creation

Create a user, and their wallet, before they have signed in. Decane keys the user exactly as the matching sign-in will, so their first sign-in opens the wallet made here. The key is generated inside the enclave; your server sees only the addresses.

python
from decane import DecaneClient, UserIdentifier

decane = DecaneClient(app_id=APP_ID, project_secret=os.environ["DECANE_PROJECT_SECRET"])

result = decane.create_user(UserIdentifier("email", "ada@example.com"))
result.user.addresses.evm  # fund it now; Ada finds it when she signs in
result.created             # True when this call made the user
result.wallet              # "created" | "exists" | "none"

Identifiers

TypeValue
emailAny case. A later email-code or Google sign-in with this verified address opens the same wallet.
phoneE.164, +<country><number>.
customThe subject your own JWTs assert, with provider_id from the dashboard.
kingschat, xThe provider’s stable user id, never an @handle.
python
decane.create_user(UserIdentifier("phone", "+2348012345678"), metadata={"plan": "pro"})
decane.create_user(UserIdentifier("custom", "auth0|123", provider_id=PROVIDER_ID), create_wallet=False)
decane.create_user_wallet(result.user.id)   # for an existing user with no wallet

Rules

  • Idempotent on the identifier: calling twice returns the same user.
  • Off until the Decane team switches it on for your project; until then calls fail with SERVER_WALLETS_DISABLED.
  • Sixty calls a minute per project.
  • Other failures: INVALID_IDENTIFIER, WALLET_EXISTS (from create_user_wallet), WALLET_FROZEN, RETRY_LATER, ENCLAVE_UNAVAILABLE.