BoundedAuthorityReportAdapter.TestKeys (Bounded Authority Report Adapter v0.5.0)

Copy Markdown View Source

TEST-ONLY keypair fixtures + an issuer-side grant-signing helper for RA1's round-trip test.

The adapter is the HOLDER — it never signs a grant. But RA1's round-trip test needs an issuer-signed grant compact to feed sign_report/3, so the TEST plays the issuer here (mirrors BAP's own corpus_test.exs:signed_grant_compact/1). This is test-only code: the adapter's lib/ never calls grant_signing_input (the proof-only-sign tripwire in sign_report_test.exs enforces that).

Compiled only in :test (via mix.exs elixirc_paths).

Summary

Functions

A deterministic holder keypair (seeded) for tests. The HOLDER signs the proof (this is the adapter's role).

The raw RFC 7638 holder thumbprint for a public key (32 bytes), via BAP's JWK thumbprint derivation.

A deterministic issuer keypair (seeded) for tests. The ISSUER signs the grant.

Builds an issuer-signed grant compact (the fixture RA1's round-trip feeds to sign_report/3 as report.grant_compact). The grant binds to the supplied holder thumbprint (raw 32 bytes) via cnf.jkt.

Functions

holder_keypair()

A deterministic holder keypair (seeded) for tests. The HOLDER signs the proof (this is the adapter's role).

holder_thumbprint_raw(holder_public_key)

The raw RFC 7638 holder thumbprint for a public key (32 bytes), via BAP's JWK thumbprint derivation.

issuer_keypair()

A deterministic issuer keypair (seeded) for tests. The ISSUER signs the grant.

issuer_signed_grant_compact(holder_thumbprint_raw, opts \\ [])

Builds an issuer-signed grant compact (the fixture RA1's round-trip feeds to sign_report/3 as report.grant_compact). The grant binds to the supplied holder thumbprint (raw 32 bytes) via cnf.jkt.

Mirrors BAP corpus_test.exs:signed_grant_compact/1. The timestamps (issued_at/not_before/expires_at) are pinned so the test can pin the proof's issued_at + the verifier's evaluation_time into the grant's window (plan-review Finding 1: the grant + proof time windows must overlap).