Skip to main content

Module caller_keys

Module caller_keys 

Source
Expand description

Moving stored caller partitions to the identities of 0.15 (audit register R12).

Under caller isolation a tenant-aware store keys each caller’s records {tenant}\u{1f}{caller}. Before 0.15 the bundled authenticators named a caller by its bare label or JWT sub; from 0.15 they name it bearer:<label>, api-key:<label> or jwt:<issuer>:<sub> (caller_id). Records stored under an old name are not found under the new one, so a caller’s tasks and webhooks would seem to vanish on upgrade.

The old key does not say how its caller authenticated, or for a JWT which issuer vouched for it, so the store cannot work out the new key by itself: you say, with a map from an old caller name to its new identity. Each persistent tenant-aware store has migrate_caller_keys(map), which moves every partition the map names in one transaction and leaves the rest alone. bearer_labels, api_key_labels and jwt_subjects build the maps for a deployment that used one authenticator; write your own for one that used several. Run it once per store, before serving with the new version. A second run moves nothing: each helper passes over a name already in the new form, and a map that returns its input moves nothing either. The in-memory stores keep nothing across a restart and need no migration.

use a2a_protocol_server::store::caller_keys;
use a2a_protocol_server::store::tenant_sqlite_store::TenantAwareSqliteTaskStore;

let store = TenantAwareSqliteTaskStore::new("sqlite:tasks.db").await?;
let moved = store
    .migrate_caller_keys(caller_keys::jwt_subjects(Some("https://idp.example")))
    .await?;
println!("moved {} partitions", moved.partitions);

Structs§

CallerErasure
What an erase_caller run removed (spec §13.4: agents SHOULD provide mechanisms for users to request deletion of their data).
CallerKeyMigration
What a migrate_caller_keys run moved.

Functions§

api_key_labels
A map for a deployment whose callers were named by ApiKeyAuthInterceptor::with_labelled_keys.
bearer_labels
A map for a deployment whose callers were named by BearerTokenAuthInterceptor::with_labelled_tokens.
jwt_subjects
A map for a deployment whose callers were named by JwtAuthInterceptor with tokens from issuer (None for tokens with no iss).