DigitalOcean.Security reference
ReadSecret
Section titled “ReadSecret”Source:
packages/digitalocean/src/Security/ReadSecret.ts
Read a secret’s values from a runtime. The values reach the host as secrets in its environment when it deploys, so a runtime holds no DigitalOcean token: DigitalOcean signs no workload identity a runtime could exchange for one. Changing the secret’s values redeploys the runtimes bound to it.
ReadSecret: Examples
Section titled “ReadSecret: Examples”const Stripe = DigitalOcean.Security.Secret("stripe", { values: { STRIPE_KEY: "sk_test_..." },});
export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url }, Effect.gen(function* () { const secret = yield* Stripe; const stripe = yield* DigitalOcean.Security.ReadSecret(secret); return { fetch: Effect.gen(function* () { const key = yield* stripe.get("STRIPE_KEY"); return HttpServerResponse.text(Redacted.value(key).slice(0, 7)); }).pipe(Effect.orDie), }; }).pipe(Effect.provide(DigitalOcean.Security.ReadSecretHttp)),) {}ReadSecretHttp
Section titled “ReadSecretHttp”Source:
packages/digitalocean/src/Security/ReadSecretHttp.tsKind: Layer · Provides:DigitalOcean.Security.ReadSecret
ReadSecret for any host: the values travel as one secret through the
host’s runtime context.
Secret
Section titled “Secret”Source:
packages/digitalocean/src/Security/Secret.ts
A DigitalOcean secret: versioned key-value pairs stored encrypted in one
region. Bind it to a runtime with ReadSecret. Changing values writes a
new version in place; name and region replace the secret.
Deleting a secret leaves it pending deletion for a while, and its name stays taken. A deploy that declares a secret pending deletion restores it instead of failing.
Secret: Storing a Secret
Section titled “Secret: Storing a Secret”const key = yield* Config.Redacted("STRIPE_KEY");const stripe = yield* DigitalOcean.Security.Secret("stripe", { region: "nyc3", values: { STRIPE_KEY: key },});