testing/cross_backend/testing_credential_read.ts

_testing_credential_read — the testing seam behind the cross-impl credential conformance table (credential_conformance.json): its input and output schemas, the pure read it answers with, its spec, and the action builder.

A leaf like testing_origin_check.ts, and hono-free for the same reason: a consumer whose backend is a spawned Rust binary runs the table without installing hono.

view source

Declarations
#

11 declarations

create_testing_credential_read_action
#

ERROR_TESTING_CREDENTIAL_READ_LINE
#

testing/cross_backend/testing_credential_read.ts view source

"invalid_header_line" import {ERROR_TESTING_CREDENTIAL_READ_LINE} from '@fuzdev/fuz_app/testing/cross_backend/testing_credential_read.js';

The data.reason of every refusal _testing_credential_read gives its lines: a value that is no list of strings, a list or a line over its cap (TESTING_CREDENTIAL_READ_LINES_MAX, TESTING_CREDENTIAL_READ_LINE_LENGTH_MAX), and a line it cannot read as a header line — no :, a name that is no HTTP token, or a character that is no byte a field value holds: above U+00FF (a line is bytes, one per character), or a control character other than HTAB, which an HTTP parser refuses before any spine code runs.

parse_testing_header_lines
#

testing/cross_backend/testing_credential_read.ts view source

(lines: readonly string[]): (lower_name: string) => readonly string[] import {parse_testing_header_lines} from '@fuzdev/fuz_app/testing/cross_backend/testing_credential_read.js';

Split Name: value lines into the per-name lines the credential readers take — what an HTTP parser does to a request head: the name ends at the first : and compares in ASCII lowercase, the value loses its outer SP and HTAB, and lines of one name keep their order.

lines

the header lines

type readonly string[]

returns

(lower_name: string) => readonly string[]

the lines of a header by its lowercase name ([] for a header not sent)

throws

  • ThrownJsonrpcError - `invalid_params` with reason `ERROR_TESTING_CREDENTIAL_READ_LINE` for a line with no `:`, a name that is no token, or a character no header line holds

run_testing_credential_read
#

testing/cross_backend/testing_credential_read.ts view source

(input: { lines: string[]; }, deps: TestingCredentialReadDeps): Promise<{ session_cookie: "invalid" | "absent" | "valid"; bearer_token: string | null; daemon_token: string | null; }> import {run_testing_credential_read} from '@fuzdev/fuz_app/testing/cross_backend/testing_credential_read.js';

Answer one _testing_credential_read input: read each credential out of the lines with the readers the auth middleware legs call (read_session_cookie_value then process_session_cookie, read_bearer_token, read_daemon_token). The action handler and the conformance table's unit test both call this, so the table checks the same functions the wire serves.

input

the header lines

deps

the keyring and session options the cookie is verified with

returns

Promise<TestingCredentialReadOutput>

the reading the Rust twin returns for the same lines

throws

  • ThrownJsonrpcError - `invalid_params` for a line `parse_testing_header_lines` refuses

SessionCookieRead
#

testing/cross_backend/testing_credential_read.ts view source

value + type

"invalid" | "absent" | "valid"

type "invalid" | "absent" | "valid"

import {SessionCookieRead} from '@fuzdev/fuz_app/testing/cross_backend/testing_credential_read.js';

What a request's Cookie lines hold of the session cookie — the wire form of the Rust spine's fuz_auth::SessionCookieRead, its variants in lowercase.

testing_credential_read_action_spec
#

testing/cross_backend/testing_credential_read.ts view source

{ readonly method: "_testing_credential_read"; readonly kind: "request_response"; readonly initiator: "frontend"; readonly auth: { readonly account: "required"; readonly actor: "none"; readonly credential_types: readonly [...]; }; ... 5 more ...; readonly description: string; } import {testing_credential_read_action_spec} from '@fuzdev/fuz_app/testing/cross_backend/testing_credential_read.js';

_testing_credential_read — read the three credentials out of a list of header lines, so the shared conformance table (credential_conformance.json) checks each backend's header grammar over the wire, row by row. Pure: no database, no state beyond the server's keyring and cookie name. The Rust mirror is fuz_testing::create_testing_credential_read_action_spec.

Like _testing_origin_check, it is not bundled by create_testing_actions: a consumer whose Rust binary doesn't mount the mirror would fail its action-manifest parity gate. The spine test binary appends it at the full-mount layer (build_full_spine_rpc_actions).

auth gates on the daemon-token credential, matching _testing_reset.

TESTING_CREDENTIAL_READ_LINE_LENGTH_MAX
#

testing/cross_backend/testing_credential_read.ts view source

1024 import {TESTING_CREDENTIAL_READ_LINE_LENGTH_MAX} from '@fuzdev/fuz_app/testing/cross_backend/testing_credential_read.js';

The longest header line _testing_credential_read reads, in UTF-16 code units — one a byte for every character a line may hold. A cap both spines state, so neither reads a line the other's header types refuse for its length; far above any credential line.

TESTING_CREDENTIAL_READ_LINES_MAX
#

TestingCredentialReadDeps
#

TestingCredentialReadInput
#

testing/cross_backend/testing_credential_read.ts view source

value + type

{ lines: string[]; } import {TestingCredentialReadInput} from '@fuzdev/fuz_app/testing/cross_backend/testing_credential_read.js';

Input of _testing_credential_read, a @fuzdev/fuz_schema object.

lines

The request's header lines, each Name: value, in the order sent — a name may repeat. Every character is one byte a field value may hold (HTAB, U+0020–U+007E, U+0080–U+00FF), as a runtime hands a handler a header's bytes. At most TESTING_CREDENTIAL_READ_LINES_MAX lines of at most TESTING_CREDENTIAL_READ_LINE_LENGTH_MAX characters each.

type string[]

TestingCredentialReadOutput
#

testing/cross_backend/testing_credential_read.ts view source

value + type

{ session_cookie: "invalid" | "absent" | "valid"; bearer_token: string | null; daemon_token: string | null; } import {TestingCredentialReadOutput} from '@fuzdev/fuz_app/testing/cross_backend/testing_credential_read.js';

Output of _testing_credential_read, a @fuzdev/fuz_schema object: how each credential leg reads the lines, before any database work.

session_cookie

absent — no pair names the cookie; invalid — one does and its value fails verification (what the spine clears); valid — it verifies under the server's keyring and its signed expiry is ahead. Says nothing about the auth_session row.

type "invalid" | "absent" | "valid"

bearer_token

The API token the bearer leg would look up, or null when it reads none.

type string | null

daemon_token

The daemon token the daemon leg would compare, or null when it reads none.

type string | null

Depends on
#

Imported by
#