@atiproto/kv-oauth-state-store
v0.0.1
Published
Cloudflare KV-backed state and session stores for @atproto/oauth-client
Readme
@atiproto/kv-oauth-state-store
Cloudflare KV-backed state and session stores for @atproto/oauth-client.
Installation
npm install @atiproto/kv-oauth-state-store @atproto/oauth-clientUsage
import { KvStateStore, KvSessionStore } from "@atiproto/kv-oauth-state-store";
const stateStore = new KvStateStore(env.OAUTH_STATE_KV, {
prefix: "oauth_state:", // default
ttlSeconds: 600, // default: 10 minutes
});
const sessionStore = new KvSessionStore(env.OAUTH_SESSION_KV, {
prefix: "oauth_session:", // default
ttlSeconds: 604800, // default: 7 days
});Add KV bindings in your wrangler.jsonc:
{
"kv_namespaces": [
{ "binding": "OAUTH_STATE_KV", "id": "<your-kv-id>" },
{ "binding": "OAUTH_SESSION_KV", "id": "<your-kv-id>" }
]
}License
MIT
