crates/lit-sdk that mirrors the JS SDK behavior for the Lit Protocol Naga network.
Install / use in your project
Until this is published to crates.io, use a path dependency:Create a client
create_lit_client needs a NetworkConfig. If bootstrap_urls is empty and rpc_url is set, the SDK auto-discovers bootstrap URLs from the chain.
Authentication (AuthContext)
Most SDK calls require anAuthContext (session keypair + capabilities + auth sig).
EOA session (native auth)
Build a session for an EOA by generating a session keypair, creating a SIWE message with recap resources, and signing it with the EOA key. Seecrates/lit-sdk/examples/execute_js.rs.
PKP session (native PKP auth)
If you have a PKP public key and an EOA auth method, create anAuthData and let the nodes issue the PKP session signature:
See crates/lit-sdk/examples/pkp_sign_ethereum.rs.
Custom auth (Lit Action)
The SDK supports “custom auth” via a Lit Action (IPFS id or code) using:LitClient::create_custom_auth_context(...)
Core capabilities
- Encrypt:
LitClient::encrypt(...)(seecrates/lit-sdk/examples/naga_encrypt.rs) - Decrypt:
LitClient::decrypt(...) - PKP signing:
LitClient::pkp_sign_ethereum(...) - Lit Actions:
LitClient::execute_js(...)(code or IPFS id)
Payments / pricing (paid networks)
On paid networks, some requests require a payment method (Ledger balance, delegation, or capacity). The Rust SDK exposes a Ledger wrapper viaPaymentManager:
Run Rust E2E tests
Rust parity lives incrates/lit-e2e: