Skip to main content

Module cipher

Module cipher 

Source
Available on crate features postgres or sqlite only.
Expand description

Sealing push notification configs at rest (spec §13.2: agents SHOULD securely store push notification configurations and credentials).

The SQL push-config stores keep each config as JSON, and a config carries secrets: the client’s token, and the authentication.credentials the agent presents to the webhook. Given a PushConfigCipher (each SQL store’s with_cipher), a store writes every config sealed: its whole JSON document, encrypted by the cipher, stored as the text a2a-sealed:v1:<base64> (in Postgres’s JSONB column, as a JSON string). The task and config ids stay in their own columns, so lookups work as before. The SDK implements no encryption: the cipher is yours, for example an AEAD whose key your KMS holds.

§The context

Each config is sealed under a context naming the row it is stored in: the JSON array ["a2a-push-config/v1", partition, task_id, id] as UTF-8 bytes, where partition is the tenant store’s partition key and "" in a store without tenants. A cipher must authenticate the context, as an AEAD’s associated data, and refuse to open under any other. Otherwise anyone who can write the table can move a sealed config to another task’s row, and that task’s updates then go to the moved config’s webhook.

§Reading

With a cipher, a row that is not sealed is refused, as is one the cipher cannot open: a config is never served unauthenticated. For a table written before the cipher was set, accept_unsealed_rows also reads unsealed rows as they are; each is sealed when it is next written. Without a cipher, a sealed row is refused.

Traits§

PushConfigCipher
Encrypts push notification configs for an SQL store; see the module docs.