Expand description
Remote hooks: the mkit.server.hooks.v1 adapter (SPEC-SERVER §§6-8),
behind the remote-hooks feature.
A deployment can run authorization, admission and outcome delivery in a separate service, such as a payment layer. This module holds the whole protocol except the transport:
HookChannelmoves one Connect unary call (POST <base>/<procedure>,application/json,Connect-Protocol-Version: 1). The native HTTPS channel (WP-3.8) and the Workers binding (WP-3.9) will implement it.HookSignersigns every request over its exact body bytes with themkit-hook:v1domain, a fresh 32-byte nonce and a validity of at most 300 s. Only a channel that reportsHookChannel::isolated(a service binding, §7.3) may go unsigned, andHookClient::newrefuses anything else.HookVerifieris the receiving side of that signature (a hook service’s §7.1 checks), free of server-runtime dependencies.RemoteAuthorizer,RemoteAdmissionandRemoteOutcomesshare oneHookClientand implement the stage traits, so any subset plugs intoHooks.RemoteInspectorimplements synchronous inspection at stage 5. The pipeline owns complete inspected-set enumeration, batching and stable inspection ids.
§Failure semantics
Authorize, Admit and Inspect fail closed (§8): a transport error, timeout, non-2xx
status, Connect error body, non-JSON content type, body over 64 KiB,
malformed JSON, absent decision/verdict or a failed §6.6 check all answer
retryable unavailable and write nothing. There is no retry inside a call.
A deliberate deny in a 2xx answer is a decision, sanitised per §6.2. An
Outcome is acknowledged by any 2xx; every other result is a
DeliveryError that kind 8 retries with
backoff, signing each attempt afresh.
§Credential safety
Admit bodies carry admission credentials. Requests and responses are never
logged or Debug-printed (the generated messages would print values), the
request body is serialised once into an exactly sized Zeroizing buffer,
the credential values of the message are wiped after the call, and every
failure reason is a fixed string.
§Not here
The launch profile accepts synchronous fail-closed inspection only (§18).
Async inspection belongs to WP-5.5c. Event belongs to WP-5.2.
AuthorizeAllow.writer_view becomes AuthzFacts::caller_view, which the
pipeline honours only under the authority role (§10.1). Reservation-id
uniqueness is enforced per partition by the pipeline, while §6.6 asks for
it per audience: uniqueness across partitions is the hook’s obligation.
Structs§
- Hook
Client - The shared client the per-role types (
RemoteAuthorizer,RemoteAdmission,RemoteOutcomes) hold behind anArc. - Hook
Request - One Connect unary call, ready to send.
- Hook
Response - A hook’s HTTP response, whatever its status.
- Hook
Signer - The dedicated hook signing key. It must not be a key used for
mkit-write:v2, grants, receipts or administration. - Hook
Verifier - Verifies signed hook requests for one hook service.
- KeyList
Error - A refused key list.
- OsNonces
- The operating system’s CSPRNG.
- Remote
Admission - Stage 3 over
HooksService.Admit. It returns no quota charges and every allow carries the hook’s reservation id. - Remote
Authorizer - Stage 2 over
HooksService.Authorize. Any failure, and any decision that is not a deliberate allow or deny, answers retryableunavailable. - Remote
Inspector - One named synchronous inspector over a shared hook client.
- Remote
Outcomes - Stage 8 over
HooksService.Outcome: any 2xx acknowledges, everything else leaves the outcome queued for kind 8’s backoff. - Remote
Purge - Signed durable global cache-purge delivery, distinct from admission.
- Verified
- A request that passed every check.
- Verifier
Key - One key of a §7.2 key list.
Enums§
- Channel
Error - Why a channel produced no response. Every variant means “the hook did not answer”: the adapter fails closed (SPEC-SERVER §8).
- Hook
Config Error - A refused adapter configuration.
- Inspect
Verdict - A validated launch-profile verdict. Quarantine rejects the push at stage 5. Quarantine is a rejection under the launch amendment.
- Signer
Error - A signer setting the spec refuses.
- Verify
Error - Why a request failed verification. The text is fixed and never quotes the request.
Constants§
- DEFAULT_
TIMEOUT - The default per-call timeout (SPEC-SERVER §8, informative).
- DEFAULT_
VALIDITY - The validity interval used unless configured otherwise.
- DOMAIN
- The literal domain separator of the hook key use.
- MAX_
CLOCK_ LEAD_ MS - How far the sender’s clock may lead the receiver’s (SPEC-SERVER §7.1).
- MAX_
RESPONSE_ BYTES - The largest response body core accepts (SPEC-SERVER §6.6).
- MAX_
VALIDITY - The longest permitted validity interval.
Traits§
- Hook
Channel - A route to one hook service.
- Nonce
Source - The source of the fresh 32-byte nonce every attempt carries.