Skip to content

SecretsStore

Source: src/Cloudflare/SecretsStore/SecretsStore.ts

A Cloudflare Secrets Store, a per-account container for secrets that can be bound into Workers with full redaction and audit support.

Cloudflare enforces a limit of one Secrets Store per account. Deleting a store changes its ID and permanently destroys all secrets inside it. Because of this, the provider always adopts an existing store rather than creating a new one, and never deletes the store on teardown. The read lifecycle reports the existing account store (if any) as plain attrs, so the engine silently adopts it on cold start and create is only ever invoked when no store exists yet. Once it exists it is treated as account-level infrastructure that outlives any single stack.

Basic Secrets Store (adopts existing or creates one)

const store = yield* Cloudflare.SecretsStore("MyStore");

Adopt a specific named store

const store = yield* Cloudflare.SecretsStore("MyStore", {
name: "production-secrets",
});