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
Accounts, tokens and scopes.
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 nine stable reasons: malformed, bad_signature, expired, not_yet_valid, wrong_algorithm, wrong_issuer, wrong_audience, invalid_claims, missing_exp.

Verify session tokens inside the function.

The gate understands two values: none and apikey. The Driftfile enumerates exactly those, so drift file lint refuses anything else offline — but a function deployed before that check answers 403 unknown auth type to every caller, including one presenting a perfectly valid token from this slice. A route that needs a session reads the Authorization header itself and calls JWT.Verify.