feat(attestation): verify() — offline consumer for v0.1.1 envelopes#74
Open
ColonistOne wants to merge 1 commit into
Open
feat(attestation): verify() — offline consumer for v0.1.1 envelopes#74ColonistOne wants to merge 1 commit into
ColonistOne wants to merge 1 commit into
Conversation
v1.20.0 shipped the producer; this adds the consumer half so the SDK both mints and verifies attestation envelopes in one place. - verify(envelope, *, now=None) -> VerificationResult: deterministic, network- free verification — structural checks, ed25519 peel-and-verify of the sigchain over JCS(envelope with sigchain[0..i-1]), validity window, did:key issuer binding. Mirrors the spec's reference verifier offline subset. - VerificationResult: ok (truthy via __bool__), issuer_bound (separate — only did:key closes the binding in v0.1; other schemes are valid-but-UNBINDABLE), reasons, notes. - did_key_to_public_key(): inverse of public_key_to_did_key(). Evidence resolution + revocation are out of scope by design (no network calls). Same optional extra as signing. Bump to 1.21.0. 100% coverage; 844 passed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the consumer half of the attestation envelope. v1.20.0 (#73) shipped the producer; this adds
attestation.verify()socolony_sdkboth mints and verifies v0.1.1 envelopes in one place — closing the produce↔verify loop integrators were otherwise pointed at another repo for.API
verify(envelope, *, now=None) -> VerificationResult— deterministic, network-free verification:envelope_version == "0.1", non-empty evidence + sigchain)JCS(envelope with sigchain = sigchain[0..i-1])(the spec's peel-not-replace rule)time_bounded/perpetual/revocation_checked)did:keybinding (sigchain[0].key_id == issuer.id)VerificationResult—ok(truthy via__bool__),issuer_bound(kept separate fromok: onlydid:keyissuers close the binding in v0.1; other schemes verify but are UNBINDABLE → "key K signed this"),reasons,notes.did_key_to_public_key()— inverse ofpublic_key_to_did_key().Scope
Evidence resolution and revocation are out of scope by design —
verify()never makes a network call (no phone-home to the issuer). Callers resolveevidence[].uri/ checkcontent_hash/ queryrevocation_urithemselves if their trust model needs it. This mirrors the spec reference verifier's--offlinesubset.Checks (local, mirrors CI)
ruff check/ruff format --check/mypy src/✅pytest→ 844 passed, 147 skipped, 100% coverage (attestation.py 310/310).export_attestation/attest_post) verifiesok=True, issuer_bound=True; tampered payloads, expired/not-yet-valid windows, bad alg/role/key_id, and UNBINDABLE issuers all behave as specified.Bumps to 1.21.0. Non-breaking, additive. Routing through @jackparnell to merge (TheColonyCC repo).
🤖 Generated with Claude Code