Expand description
§grow-infisical
Rust SDK for Infisical by Grow Codes:
one async client (tokio) for Universal / token / Kubernetes / AWS IAM auth with automatic
token refresh, secrets (v4 with a v3 fallback detected at run time, batch operations,
versions, reference expansion), folders, projects and environments, tags, secret imports,
environment injection and the Grow SecretsProvider.
use grow_infisical::secrets::SecretsProvider;
use grow_infisical::{InfisicalClient, InfisicalConfig, UpdateSecretOptions};
// explicit > GROW_INFISICAL_* > INFISICAL_* > defaults
let client = InfisicalClient::new(InfisicalConfig::from_env()?)?;
println!("healthy: {}", client.health().await?.healthy);
// secrets in the configured project / environment / path
client.create_secret("DB_PASSWORD", "s3cr3t", None).await?;
let secret = client.get_secret("DB_PASSWORD", None).await?;
assert_eq!(secret.value.reveal(), "s3cr3t");
let update = UpdateSecretOptions { value: Some("rotated".into()), ..Default::default() };
client.update_secret("DB_PASSWORD", Some(&update)).await?;
// the Grow SecretsProvider (folders are created on demand)
let secrets = client.secrets();
secrets.set("app/API_KEY", "abc123".into(), None).await?;
assert_eq!(secrets.get_string("app/API_KEY", None).await?.as_deref(), Some("abc123"));
client.close().await;Features: blocking (a blocking client), testing (in-memory fakes and the conformance
runner).
Re-exports§
pub use crate::core::Error;pub use crate::core::ErrorCode;pub use crate::core::HealthStatus;pub use crate::core::Result;pub use crate::core::RetryPolicy;pub use crate::core::Secret;
Modules§
- blocking
blocking - Blocking wrapper (feature
blocking). Each client owns a tokio runtime with one worker thread, so background work (secret watchers, retries’ timers) keeps running between blocking calls. - core
- Shared core: errors, configuration, secrets in config, redaction, retries and transport.
- secrets
- Secrets category: values, provider traits, cache, watch and
load_env(SPEC §3). - testing
testing - Test support (feature
testing): in-memory fakes and the conformance runner (SPEC §6).
Structs§
- Access
Token - An Infisical access token with its lifetime.
tokennever prints. - Actor
- Who wrote a secret version.
- Auth
- The client’s token manager: it logs in on first use, renews the token at 80 % of its
lifetime (re-login when renewal fails or the max TTL is reached) and re-logs in once
when a call fails with
AUTHENTICATION. Static tokens are used as they are. - AwsIam
Auth - Logs a machine identity in with AWS IAM credentials (
POST /api/v1/auth/aws-auth/login). The client signs an STSGetCallerIdentityrequest with AWS Signature Version 4 and sends it to Infisical, which forwards it to AWS STS to verify the caller. Credentials left unset are read fromAWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_SESSION_TOKENandAWS_REGION/AWS_DEFAULT_REGION(region defaultus-east-1). - AwsLogin
Request - The login body
AwsIamAuthsends (exposed for tests and debugging). - Batch
Scope - Where a batch create runs; unset fields fall back to the client configuration.
- Create
Environment Options - Options of
InfisicalClient::create_environment. - Create
Folder Options - Options of
InfisicalClient::create_folder. - Create
Secret Import Options - Options of
InfisicalClient::create_secret_import. - Create
Secret Options - Options of
InfisicalClient::create_secret. - Delete
Folder Options - Options of
InfisicalClient::delete_folder. - Delete
Secret Options - Options of
InfisicalClient::delete_secret. - Delete
Secrets Options - Options of
InfisicalClient::delete_secrets. - EnvOptions
- Options of
InfisicalClient::load_envandInfisicalClient::export_dotenv. Unset project, environment and path fall back to the client configuration. - Environment
- A project environment.
- Folder
- A secret folder.
- GetSecret
Options - Options of
InfisicalClient::get_secret. - Imported
Secrets - The secrets one secret import contributes to a listing.
- Infisical
Client - Async client for Infisical. Cheap to clone (clones share one connection pool, the token and the background tasks).
- Infisical
Config - Immutable client configuration; build it with
InfisicalConfig::builderorInfisicalConfig::from_env.Debugoutput redacts every credential. - Infisical
Config Builder - Builder for
InfisicalConfig. Values set here win over the environment. - Kubernetes
Auth - Logs a machine identity in with a Kubernetes service account token
(
POST /api/v1/auth/kubernetes-auth/login). The server validates the token through the Kubernetes TokenReview API. - List
Folders Options - Options of
InfisicalClient::list_folders. Unset fields fall back to the client configuration (pathto the configured secret path). - List
Projects Options - Options of
InfisicalClient::list_projects. - List
Secret Versions Options - Paging of
InfisicalClient::list_secret_versions. - List
Secrets Options - Options of
InfisicalClient::list_secrets. Unset project, environment and path fall back to the client configuration. - Project
- An Infisical project.
- Project
Page - One page of
list_projects. - Project
Secrets Provider - The
SecretsProviderover one Infisical project and environment. - Secret
Entry - A secret as Infisical returns it.
valuenever prints. - Secret
Import - A secret import: makes the secrets of another environment/path visible in a path.
- Secret
Import Options - The importing path of a secret-import call (unset fields fall back to the config).
- Secret
Input - One secret of
InfisicalClient::create_secrets.valuenever prints inDebug. - Secret
List - Result of
list_secrets. - Secret
Update - One secret of
InfisicalClient::update_secrets; unset fields stay unchanged.valuenever prints inDebug. - Secret
Version - One stored version of a secret.
valuenever prints. - Secrets
Provider Options - Options of
InfisicalClient::secrets_with. Unset fields fall back to the client configuration. - SigV4
Request - A request to sign with AWS Signature Version 4.
- Tag
- A project tag.
- Token
Auth - A static access token: a token-auth machine identity token, a user JWT or a legacy
service token (
st.…). It is never refreshed. - Universal
Auth - Logs a machine identity in with a client id and secret
(
POST /api/v1/auth/universal-auth/login). Tokens are renewed automatically at 80 % of their lifetime and re-obtained when renewal is no longer possible. - Update
Folder Options - Options of
InfisicalClient::update_folder. - Update
Secret Options - Options of
InfisicalClient::update_secret; unset fields stay unchanged. - Update
Secrets Options - Options of
InfisicalClient::update_secrets.
Enums§
- ApiVersion
- Secrets API version used by the client.
- Batch
Update Mode - How
update_secretstreats keys that do not exist. - Secret
Type - Type of a secret: shared (the default) or a user’s personal override (user JWTs only).
Constants§
- DEFAULT_
KUBERNETES_ TOKEN_ PATH - Where
KubernetesAuthreads the service account token by default. - DEFAULT_
SECRET_ PATH - Secret path used when none is configured.
- DEFAULT_
TAG_ COLOR - Color
InfisicalClient::create_taguses when none is given. - DEFAULT_
URL - Endpoint used when neither the builder nor the environment sets one (self-hosted standalone image port).
Traits§
- Auth
Method - Obtains an access token.
UniversalAuth,TokenAuth,KubernetesAuthandAwsIamAuthimplement it; a custom implementation gets automatic re-login onAUTHENTICATIONerrors.
Functions§
- format_
dotenv - Renders
key → valuepairs as a dotenv document: oneKEY="value"line per secret, sorted by key, with\,", newline and carriage return escaped. - normalize_
path - An absolute secret path without a trailing slash (
""/"/"→"/","a//b/"→"/a/b"). - sign_v4
- Signs
reqand returns every header to send: the given headers plusHost,X-Amz-DateandAuthorization.
Type Aliases§
- Infisical
Error - Service-prefixed alias of
Error.