Expand description
HITL approval payload encoders/decoders and signer.
The approval flow persists two event payloads in the conversation eventlog:
approval_request— minted whenpolyc_agent::run_turnsurfaces a pending tool call that needs human consent.approval_response— minted byApprovalService::Respond(or thePOLYCHROME_APPROVE_ALLauto-approve fast path) carrying a signed decision.
The encoders / decoders live in polyc-crypto (this crate) rather
than the control-plane binary so the harness pod can verify inbound
approval_response payloads on its own — the harness sits in a sandbox
and shouldn’t trust the wire blindly.
Structs§
- Approval
Signer - Ed25519 signer that mints provenance signatures for
approval_responsepayloads. WrapsSignerin anArcso the gRPC service and theconnectpath share one instance. - Decoded
Response - Every decoded field of an
approval_responsepayload (unverified).tool_name/args_jsonare present only for v2 payloads. - Receipt
Payload - The receipt body fields
receipt_payloadsigns, named at the call site. - Verified
Receipt - A decoded
payment_receiptpayload after signature verification. - Verified
Response - A decoded
approval_responsepayload after signature verification.
Constants§
- RECEIPT_
VERSION - Current signed
payment_receiptschema version. - RESPONSE_
VERSION - Current signed
approval_responseschema version.
Functions§
- decode_
request_ fields - Extract
(request_id, tool_name, args_json)from anapproval_requestpayload — the fields a v2approval_responsemust sign to bind the approval to the request identity. - decode_
request_ id - Extract
request_idfrom anapproval_requestpayload. - decode_
response_ full - Decode every field of an
approval_responsepayload without verifying. - decode_
response_ minimal - Extract
(request_id, approved)from anapproval_responsepayload. - receipt_
payload - JSON payload for a
payment_receiptevent. - request_
payload - JSON payload for an
approval_requestevent. - response_
payload - JSON payload for an
approval_responseevent (schema v2). - verify_
signed_ receipt - Verify a persisted
payment_receiptpayload. - verify_
signed_ response - Verify a persisted
approval_responsepayload. - verify_
wire_ response - Verify a wire-form v2
approval_response, binding the approval to its(request_id, tool_name, args_json)identity.