auth.provider API
    Preparing search index...
    interface CodeRepository {
        consumeByCode(code: string): Promise<Code | null>;
        createCode(
            params: {
                client_id: string;
                code_challenge?: string;
                code_challenge_method?: string;
                expiresIn?: number;
                grantedAudience?: readonly string[];
                grantedScope?: readonly string[];
                nonce?: string;
                redirect_uri: string;
                sid?: string;
            },
        ): Promise<Code>;
        findByCode(code: string): Promise<Code | null>;
        removeByCode(code: string): Promise<void>;
    }

    Implemented by

    Index

    Methods

    • Atomically retrieve and delete the code record. This is the sole authenticity gate for authorization code exchange. Returns null when the code is unknown or has already been consumed (replay prevention).

      Parameters

      • code: string

      Returns Promise<Code | null>

    • Issue an authorization code and persist all associated data atomically. After consumeByCode, the code is single-use; client_id and redirect_uri embedded in the record replace the session-based identity binding removed in v0.5.1 (D-1 spec).

      Parameters

      • params: {
            client_id: string;
            code_challenge?: string;
            code_challenge_method?: string;
            expiresIn?: number;
            grantedAudience?: readonly string[];
            grantedScope?: readonly string[];
            nonce?: string;
            redirect_uri: string;
            sid?: string;
        }

      Returns Promise<Code>

    • Retrieve a code record by the authorization code string. Returns null when no record matches — the method is fail-soft on absence, matching the findBy<Field> convention used by ClientRepository.findById.

      Naming note (AS-10): renamed from getByCode to findByCode at 1.0 GA to align with the repository-method convention introduced in v0.5.2: findBy<Field> for optional lookups (null on absence), get(<id>) for single-object stores, and operation-specific names like consumeByCode (atomic single-use) for non-lookup operations. The v0.5.x getByCode name was deprecated via the JSDoc-only documentation in v0.5.2 (AS-10).

      Parameters

      • code: string

      Returns Promise<Code | null>