pocketenv/secrets
Manage encrypted secrets attached to a sandbox.
Secrets are similar to environment variables but their values are write-only: the API never returns the stored value. Use them for API keys, passwords, and other sensitive data.
Types
Values
pub fn delete(
sb: sandbox.ConnectedSandbox,
id: String,
) -> Result(Nil, pocketenv.PocketenvError)
Deletes the secret identified by id.
pub fn list(
sb: sandbox.ConnectedSandbox,
limit: option.Option(Int),
offset: option.Option(Int),
) -> Result(List(Secret), pocketenv.PocketenvError)
Lists secret names for the sandbox. Optionally paginate with limit and offset.
Example
let assert Ok(secrets) = sb |> secrets.list(None, None)
pub fn put(
sb: sandbox.ConnectedSandbox,
name: String,
value: String,
) -> Result(Nil, pocketenv.PocketenvError)
Creates or updates a secret named name with value.
The value is encrypted client-side with the server’s public key before
transmission and is never returned by the API.
Example
let assert Ok(Nil) = sb |> secrets.put("DB_PASSWORD", "s3cr3t")