drift Docs
Start
What is Drift?
The tour, if you are new here.
Use cases
Whether Drift does your thing.
Getting started
Nothing to deployed, in one command.
Architecture
How a slice is put together.
What it costs
The free grant, four unit prices, two rules.
Build
Canvas
Static sites, same origin as your API.
Tools
Operate
Auth
Route gates, API keys and your account.
Teams
More than one person on one account.
Security
Boundaries, sandboxing and hardening.
Troubleshooting
Error codes
What went wrong, and what to do about it.
Legal
Acceptable use
What a slice may not be used for.
Data processing
The DPA, and every sub-processor.

Deed JWT

General-purpose HS256 sign/verify, signed with a 32-byte key unique to your slice. You never see, set, or rotate it. The platform holds it and uses it on both sides. KeyAuth mints its tokens through this primitive, and Pocket verifies them.

Go
token, _ := drift.Deed.JWT.Issue(drift.JWTClaims{Sub: user.ID, Exp: exp})
claims, err := drift.Deed.JWT.Verify(token, drift.JWTVerifyOptions{})

Issue requires an exp in the future and refuses without one; iat, iss and jti are filled in for you. Verify checks the signature, the algorithm, exp, nbf, and that iss is this slice, plus aud when you pass an audience. A failure carries one of ten stable reasons: malformed, bad_signature, expired, not_yet_valid, wrong_algorithm, wrong_issuer, wrong_audience, invalid_claims, missing_exp, internal_error.

Verify session tokens inside the function.

The route gate understands one thing: a function's auth { api_key = env("NAME") }. The auth block takes no other attribute, so drift file lint refuses a token mode offline. A route that needs a session declares no auth block, reads the Authorization header itself and calls JWT.Verify.