···11import { db } from "../../../db/client";
22-import { StateData } from "../types";
22+import type { SimpleStore, GetOptions } from "@atproto-labs/simple-store";
33+import type { NodeSavedState } from "@atproto/oauth-client-node";
3445/**
56 * PostgreSQL-backed state store for OAuth flow
67 * Stores ephemeral state data with automatic expiry (1 hour via cleanup job)
88+ * Implements SimpleStore<string, NodeSavedState> for compatibility with @atproto/oauth-client-node
79 */
88-export class PostgresStateStore {
99- async get(key: string): Promise<StateData | undefined> {
1010+export class PostgresStateStore implements SimpleStore<string, NodeSavedState> {
1111+ async get(key: string, _options?: GetOptions): Promise<NodeSavedState | undefined> {
1012 const oneHourAgo = new Date(Date.now() - 60 * 60 * 1000);
11131214 const result = await db
···18201921 if (!result) return undefined;
20222121- // State data contains dpopKey which must remain as JWK object
2222- return result.data as unknown as StateData;
2323+ // State data contains dpopJwk which must remain as JWK object
2424+ return result.data as unknown as NodeSavedState;
2325 }
24262525- async set(key: string, value: StateData): Promise<void> {
2727+ async set(key: string, value: NodeSavedState): Promise<void> {
2628 try {
2729 console.log("[StateStore] Storing state:", key);
2830 await db