DecaneDocs
Get startedQuick start
Get started

Quick start

Build one client per project and reuse it. It is cheap to clone, and clones share the JWKS cache, so put it in your app state.

1. Build the client

rustmain.rs
use decane::DecaneClient;

// Copy the ES256 verification key from your Decane dashboard.
// app_id is checked against the token's project_id.
let decane = DecaneClient::builder()
    .app_id(std::env::var("DECANE_APP_ID")?)
    .verification_key(std::env::var("DECANE_VERIFICATION_KEY")?) // ES256 SPKI PEM
    .build()?;

With a static key, verification is offline: no network call on the hot path.

2. Verify the token

rust
let token = authorization.strip_prefix("Bearer ").unwrap_or("");
let claims = decane.verify_access_token(token).await?; // Err(DecaneError::Auth { .. }) if invalid
claims.user_id; // stable Decane user id: key your records off this

3. Get the wallet addresses

rust
let user = decane.get_user(token).await?;
user.addresses.evm;    // Option<String>, "0x…"
user.addresses.solana;
user.addresses.tron;

That is the whole integration for a backend that only needs to know who is calling. Read on for sign-in, records and server-side wallets.