/**
 * OAuth state signer
 *
 * Signs the `state` parameter on outbound OAuth flows so the server can prove,
 * on callback/claim, that the userId + connector + origin it sees were minted
 * by this instance — not forged by an attacker controlling a callback URL.
 *
 * Without integrity protection on `state`, an attacker who controls a
 * `/api/oauth/callback/:name` or `/api/oauth/claim/:connector` URL can
 * forge `{c, u, o}` to bind their own OAuth tokens against a victim's
 * userId. This module closes that gap.
 *
 * Signing key is derived from the workspace master key via HKDF
 * (info="studiograph-oauth-state-v1") so it's distinct from the AEAD key
 * used for at-rest encryption — a leak of one doesn't compromise the other.
 *
 * The serialized state is a base64url-encoded JSON object:
 *   { c, u, o, t, s }
 * where `s` is the base64url HMAC-SHA256 over the canonical message
 * (a JSON array of [c, u, o, t]). The OAuth broker continues to decode
 * `c`, `u`, `o` from this JSON unchanged — adding `t` and `s` is forward-
 * compatible.
 */
export interface OAuthStateClaims {
    connectorName: string;
    userId: number;
    origin: string;
}
export interface OAuthStateSigner {
    sign(claims: OAuthStateClaims): string;
    verify(state: string, opts?: {
        maxAgeMs?: number;
    }): OAuthStateClaims | null;
}
/**
 * Derive a 32-byte signing key from the workspace master key. The `info`
 * binding ensures this key is domain-separated from the AEAD key used to
 * encrypt secrets at rest.
 */
export declare function deriveStateSigningKey(masterKey: Uint8Array): Uint8Array;
export declare function createOAuthStateSigner(key: Uint8Array): OAuthStateSigner;
