decane 1.0.0

Server-side SDK for Decane Connect Kit: verify access tokens, sign users in, per-user records and server-side wallet creation.
Documentation
//! Server-side SDK for Decane Connect Kit.
//!
//! Verify a caller's Decane access token, resolve their wallet addresses, sign
//! users in from a backend, read and write per-user records, and create users
//! and wallets before they sign in. Async-only, on tokio.
//!
//! ```no_run
//! use decane::DecaneClient;
//!
//! # async fn run() -> Result<(), decane::DecaneError> {
//! let decane = DecaneClient::builder()
//!     .app_id("your-project-id")
//!     // api_key, project_secret and verification_key can also come from
//!     // DECANE_API_KEY, DECANE_PROJECT_SECRET and DECANE_VERIFICATION_KEY.
//!     .build()?;
//!
//! // Any authenticated route: pull the bearer token and verify it.
//! let claims = decane.verify_access_token("…").await?;
//! claims.user_id; // the stable Decane user id
//!
//! // Server-side sign-in:
//! decane.connect_with_email("user@example.com").await?;
//! let session = decane.verify_email_code("user@example.com", "123456").await?;
//! session.access_token; // a Decane JWT: verify it, or hand it to the client
//! # Ok(()) }
//! ```
//!
//! Two verification modes: a **static verification key** (your project's
//! ES256 SPKI PEM public key, verified offline with no network call) or the
//! **JWKS** Decane publishes (fetched lazily, cached for ten minutes, and
//! refetched once when a signature fails, so key rotation needs no redeploy).
//!
//! Verification is stateless (signature, expiry and `project_id`). It does not
//! consult Decane's server-side revocation list; gate sensitive routes on a
//! fresh backend call as well if you need immediate sign-out enforcement.

#![forbid(unsafe_code)]
#![deny(missing_docs)]
#![cfg_attr(docsrs, feature(doc_cfg))]

mod client;
mod error;
mod jwks;
mod types;

pub use client::{DecaneClient, DecaneClientBuilder};
pub use error::{ApiErrorCode, AuthErrorReason, DecaneError, Result, Source};
pub use types::{
    Addresses, AuthProfile, AuthResult, ChainType, Claims, CreateUserOptions, CreatedUser,
    CreatedUserInfo, DEFAULT_API_BASE, KingsChatConfig, LinkedAccount, LinkedAccountType, Record,
    RecordPatch, RecordValue, User, UserIdentifier, WalletOutcome,
};