Skip to main content

Crate grow_infisical

Crate grow_infisical 

Source
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§

blockingblocking
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).
testingtesting
Test support (feature testing): in-memory fakes and the conformance runner (SPEC §6).

Structs§

AccessToken
An Infisical access token with its lifetime. token never 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.
AwsIamAuth
Logs a machine identity in with AWS IAM credentials (POST /api/v1/auth/aws-auth/login). The client signs an STS GetCallerIdentity request 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 from AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN and AWS_REGION / AWS_DEFAULT_REGION (region default us-east-1).
AwsLoginRequest
The login body AwsIamAuth sends (exposed for tests and debugging).
BatchScope
Where a batch create runs; unset fields fall back to the client configuration.
CreateEnvironmentOptions
Options of InfisicalClient::create_environment.
CreateFolderOptions
Options of InfisicalClient::create_folder.
CreateSecretImportOptions
Options of InfisicalClient::create_secret_import.
CreateSecretOptions
Options of InfisicalClient::create_secret.
DeleteFolderOptions
Options of InfisicalClient::delete_folder.
DeleteSecretOptions
Options of InfisicalClient::delete_secret.
DeleteSecretsOptions
Options of InfisicalClient::delete_secrets.
EnvOptions
Options of InfisicalClient::load_env and InfisicalClient::export_dotenv. Unset project, environment and path fall back to the client configuration.
Environment
A project environment.
Folder
A secret folder.
GetSecretOptions
Options of InfisicalClient::get_secret.
ImportedSecrets
The secrets one secret import contributes to a listing.
InfisicalClient
Async client for Infisical. Cheap to clone (clones share one connection pool, the token and the background tasks).
InfisicalConfig
Immutable client configuration; build it with InfisicalConfig::builder or InfisicalConfig::from_env. Debug output redacts every credential.
InfisicalConfigBuilder
Builder for InfisicalConfig. Values set here win over the environment.
KubernetesAuth
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.
ListFoldersOptions
Options of InfisicalClient::list_folders. Unset fields fall back to the client configuration (path to the configured secret path).
ListProjectsOptions
Options of InfisicalClient::list_projects.
ListSecretVersionsOptions
Paging of InfisicalClient::list_secret_versions.
ListSecretsOptions
Options of InfisicalClient::list_secrets. Unset project, environment and path fall back to the client configuration.
Project
An Infisical project.
ProjectPage
One page of list_projects.
ProjectSecretsProvider
The SecretsProvider over one Infisical project and environment.
SecretEntry
A secret as Infisical returns it. value never prints.
SecretImport
A secret import: makes the secrets of another environment/path visible in a path.
SecretImportOptions
The importing path of a secret-import call (unset fields fall back to the config).
SecretInput
One secret of InfisicalClient::create_secrets. value never prints in Debug.
SecretList
Result of list_secrets.
SecretUpdate
One secret of InfisicalClient::update_secrets; unset fields stay unchanged. value never prints in Debug.
SecretVersion
One stored version of a secret. value never prints.
SecretsProviderOptions
Options of InfisicalClient::secrets_with. Unset fields fall back to the client configuration.
SigV4Request
A request to sign with AWS Signature Version 4.
Tag
A project tag.
TokenAuth
A static access token: a token-auth machine identity token, a user JWT or a legacy service token (st.…). It is never refreshed.
UniversalAuth
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.
UpdateFolderOptions
Options of InfisicalClient::update_folder.
UpdateSecretOptions
Options of InfisicalClient::update_secret; unset fields stay unchanged.
UpdateSecretsOptions
Options of InfisicalClient::update_secrets.

Enums§

ApiVersion
Secrets API version used by the client.
BatchUpdateMode
How update_secrets treats keys that do not exist.
SecretType
Type of a secret: shared (the default) or a user’s personal override (user JWTs only).

Constants§

DEFAULT_KUBERNETES_TOKEN_PATH
Where KubernetesAuth reads the service account token by default.
DEFAULT_SECRET_PATH
Secret path used when none is configured.
DEFAULT_TAG_COLOR
Color InfisicalClient::create_tag uses when none is given.
DEFAULT_URL
Endpoint used when neither the builder nor the environment sets one (self-hosted standalone image port).

Traits§

AuthMethod
Obtains an access token. UniversalAuth, TokenAuth, KubernetesAuth and AwsIamAuth implement it; a custom implementation gets automatic re-login on AUTHENTICATION errors.

Functions§

format_dotenv
Renders key → value pairs as a dotenv document: one KEY="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 req and returns every header to send: the given headers plus Host, X-Amz-Date and Authorization.

Type Aliases§

InfisicalError
Service-prefixed alias of Error.