Rust SDK
Async Rust client on tokio and reqwest, with rustls (no OpenSSL). It covers the same domains as the Python, JavaScript and .NET SDKs, plus a strongly typed client for the signing engine.
Install#
The crate is published at https://www.scailabs.ai/downloads under "ScaiVault SDKs", not on crates.io. Unpack it into your project and depend on it by path:
1 2 | |
1 2 3 | |
Rust 1.75+. Latest release: 1.10.0. Apache-2.0.
Authenticate#
1 2 3 4 5 6 | |
The client sends a service-account API key as X-API-Key on every request. ScaiKey JWTs are not supported. Client is cheap to clone; share one per process.
The default client never follows redirects (a 3xx comes back as Error::Api, so the key is never re-sent elsewhere), only talks https://, and times out after 10 s to connect and 30 s per request. To change that, pass your own reqwest::Client to Client::with_http — and keep redirects off on it.
Signing#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
Suites: Suite::Ed25519 (s3-ed25519), Suite::EcdsaP384 (s2-ecdsa-p384), Suite::MlDsa65 (s4-mldsa65). Messages, signatures and public keys are plain bytes; base64 on the wire is handled for you.
Other domains#
Every other domain returns serde_json::Value and takes JSON bodies, so it works with any endpoint shape without waiting for a typed model:
1 2 3 4 5 6 7 8 9 10 11 | |
List methods take query parameters as &[(&str, &str)]; pass &[] for none. Values should already be URL-safe.
Error handling#
1 2 3 4 5 6 7 8 | |
| Variant | Meaning |
|---|---|
Error::Api { status, message } |
Non-2xx response, including a 3xx (redirects are never followed); message is the response body |
Error::Transport |
Network or TLS failure |
Error::Json / Error::Base64 |
A response that couldn't be decoded |
The client does not retry. Wrap calls in your own retry for 429 and 5xx, honouring Retry-After.
What's covered#
signing() (typed), plus secrets(), batch(), policies(), secret_policies(), service_accounts(), audit(), rotation(), pki(), acme(), dynamic(), federation(), identity(), subscriptions(), webhooks(), and health() / whoami() on the client.
What's next#
- Signing guide
- Signing reference
- Python, JavaScript and .NET SDKs