drift Docs
Start
What is Drift?
The tour, if you are new here.
Why Drift?
The case for a smaller cloud.
Getting started
Nothing to deployed, in one command.
Architecture
How a slice is put together.
What it costs
The free grant, five unit prices, two rules.
Build
Canvas
Static sites, same origin as your API.
Tools
Operate
Auth
Accounts, tokens and scopes.
Security
Boundaries, sandboxing and hardening.

Backbone Secrets

Encrypted at rest with AES-256-GCM. Declare which secrets a function may read with the secrets= keyword on its @atomic directive, then read them with the SDK:

Go
// @atomic http=post:charge auth=apikey secrets=STRIPE_KEY
key, _ := drift.Backbone.Secret.Get("STRIPE_KEY")

Before the subprocess starts, the runner fetches each declared secret and injects it twice: as the environment variable DRIFT_SECRET_<NAME> with the name uppercased, which is what Secret.Get reads, and inline in the request envelope's secrets field, readable as req.secrets in all six languages.

Shell
drift backbone secret set    STRIPE_KEY=sk-123abc
drift backbone secret get    STRIPE_KEY
drift backbone secret list
drift backbone secret delete STRIPE_KEY

You can also set secrets declaratively in the Driftfile (literal values or $ENV references resolved at deploy).

At runtime a function reads secrets and does not create them. The subprocess starts with a cleared environment and never holds the slice's internal token, so a secret the function did not declare cannot be fetched over HTTP, and Secret.Set answers 401. Secrets are provisioned out of band, with drift backbone secret set or in the Driftfile.

That makes Secrets the right home for a value your app must keep stable across cold starts, like a signing key: generate it out of band, set it once, declare it, then read it, validating the length so a missing or unreadable secret fails loudly instead of signing with garbage.

Shell
# provision once, out of band, never from inside a function
drift backbone secret set SIGNING_KEY=$(openssl rand -hex 32)
Go
// @atomic http=post:sign secrets=SIGNING_KEY
func signingKey() ([]byte, error) {
    hex, err := drift.Backbone.Secret.Get("SIGNING_KEY")   // from DRIFT_SECRET_SIGNING_KEY
    if err != nil || len(hex) != 64 {
        return nil, fmt.Errorf("SIGNING_KEY missing or malformed")
    }
    return decodeHex(hex)
}

If all you need is a token for user sessions, you don't need a key of your own at all: the platform's JWT signing key is managed for you.