intyga-verify 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- intyga_verify-1.0.0/CHANGELOG.md +73 -0
- intyga_verify-1.0.0/LICENSE +201 -0
- intyga_verify-1.0.0/MANIFEST.in +3 -0
- intyga_verify-1.0.0/PKG-INFO +165 -0
- intyga_verify-1.0.0/README.md +149 -0
- intyga_verify-1.0.0/intyga_verify/__init__.py +63 -0
- intyga_verify-1.0.0/intyga_verify/crypto.py +1832 -0
- intyga_verify-1.0.0/intyga_verify/ledger.py +662 -0
- intyga_verify-1.0.0/intyga_verify/ledger_advanced.py +664 -0
- intyga_verify-1.0.0/intyga_verify/rfc3161.py +230 -0
- intyga_verify-1.0.0/intyga_verify.egg-info/PKG-INFO +165 -0
- intyga_verify-1.0.0/intyga_verify.egg-info/SOURCES.txt +25 -0
- intyga_verify-1.0.0/intyga_verify.egg-info/dependency_links.txt +1 -0
- intyga_verify-1.0.0/intyga_verify.egg-info/requires.txt +1 -0
- intyga_verify-1.0.0/intyga_verify.egg-info/top_level.txt +1 -0
- intyga_verify-1.0.0/pyproject.toml +23 -0
- intyga_verify-1.0.0/setup.cfg +4 -0
- intyga_verify-1.0.0/tests/test_audit_signatures.py +21 -0
- intyga_verify-1.0.0/tests/test_rfc3161.py +67 -0
- intyga_verify-1.0.0/tests/test_verifier_parity_vectors.py +216 -0
- intyga_verify-1.0.0/tests/test_verify.py +93 -0
- intyga_verify-1.0.0/vectors/audit-signature-vectors.json +2399 -0
- intyga_verify-1.0.0/vectors/canonical-vectors.json +1831 -0
- intyga_verify-1.0.0/vectors/ledger-vectors.json +463 -0
- intyga_verify-1.0.0/vectors/rfc3161-vectors.json +568 -0
- intyga_verify-1.0.0/vectors/verifier-parity-vectors.json +22481 -0
- intyga_verify-1.0.0/vectors/webauthn-vector.json +48 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `intyga-verify` (Python) are documented here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow [SemVer](https://semver.org/).
|
|
5
|
+
|
|
6
|
+
This distribution is **assembled at build time** rather than kept as a standalone source tree:
|
|
7
|
+
`scripts/build-public-tree.sh verify-python` extracts the verifier out of `sdk-python`'s
|
|
8
|
+
`crypto.py` (everything above `class PolicyCrypto:`) and pairs it with the template here. So an
|
|
9
|
+
entry below describes a change to that extracted surface, which usually arrives as a change to
|
|
10
|
+
`packages/sdk-python` — check its changelog too when tracing a behaviour.
|
|
11
|
+
|
|
12
|
+
## [Unreleased]
|
|
13
|
+
|
|
14
|
+
## [1.0.0]
|
|
15
|
+
|
|
16
|
+
- Packaging: require setuptools 77+ for SPDX license metadata; include the changelog, tests and
|
|
17
|
+
shared vectors in the source distribution.
|
|
18
|
+
|
|
19
|
+
- Verify profile-carried WebAuthn audit signatures with caller-trusted signer keys, origin and RP ID.
|
|
20
|
+
Report explicit per-event signature status and key trust; add strict signature acceptance for
|
|
21
|
+
single and bulk evidence. Audit signature checks do not replace full approval-receipt verification.
|
|
22
|
+
|
|
23
|
+
- **DIV 1.0 pre-release correction (H1):** `verify_approval_receipt`, `verify_delegation` and
|
|
24
|
+
`verify_agent_authority` accept `expected["requirement"]`; export `WEAKER_REQUIREMENT_REASON`. The
|
|
25
|
+
signed `requirement` is authored by the signers, so one approver (possibly the requester) could
|
|
26
|
+
self-compose a 1-of-1 receipt for a 3-of-3 four-eyes action and it verified. A weaker signed
|
|
27
|
+
requirement is now refused before any signature is counted when the caller supplies its own rule
|
|
28
|
+
(DIV §5 step 3d), on approval, offline, delegation and agent-authority verification; the reason
|
|
29
|
+
starts "signed requirement is weaker than the relying party's policy". Omitting the floor keeps the
|
|
30
|
+
previous behaviour, which proves only the quorum the signers stated. No signed byte changes; shared
|
|
31
|
+
parity vectors pin it in all five languages.
|
|
32
|
+
- Add opt-in RFC 3161 TimeStampToken verification through OpenSSL 3, with caller-pinned TSA
|
|
33
|
+
certificate/CA trust, explicit offline CRL or unchecked revocation, and quorum/bundle integration.
|
|
34
|
+
- Scope Rekor log-key trust to one issuer for multi-issuer policies.
|
|
35
|
+
|
|
36
|
+
- **Wire format: the DIV Intent Payload gained a REQUIRED `evidence` field, and it must be `null`.**
|
|
37
|
+
`div-intent-verification` and `div-offline-intent` now carry `"evidence":null` in the signed bytes
|
|
38
|
+
(DIV §4.3.4); `div-delegation`, `div-agent-authority` and `div-platform-intent` deliberately do
|
|
39
|
+
not. `null` is signed and load-bearing: it is the payload's explicit statement that the
|
|
40
|
+
authorization was not conditioned on any external fact. Verification refuses a payload whose
|
|
41
|
+
`evidence` key is absent, and refuses any non-`null` value rather than treating it as
|
|
42
|
+
unconditioned, checked before payload reconstruction so an unsupported shape does not surface as a
|
|
43
|
+
parameter mismatch. **A receipt issued before this change no longer verifies here** — DIV v1 has no
|
|
44
|
+
published consumers, so every producer, verifier and pinned vector moved together rather than a
|
|
45
|
+
version being negotiated.
|
|
46
|
+
|
|
47
|
+
- Align cross-language receipt and audit verification: platform receipts, agent-authority seals,
|
|
48
|
+
self-certifying DID trust, single/multi-event bundles, embedded ES256 signatures, tenant sequence
|
|
49
|
+
checks, checkpoint continuity, anchor quorum and Rekor. Shared executable fixtures cover valid
|
|
50
|
+
artifacts and refusals; no wire format changes.
|
|
51
|
+
- Refuse unknown witness signature algorithms. Require identity-bound trust when the signed
|
|
52
|
+
`requesterCannotApprove` rule is set; key-only trust cannot enforce requester identity.
|
|
53
|
+
|
|
54
|
+
- **Refuse a forward-dated offline proof or delegation (DIV §5a.3 rule 3, §5a.6 step 1).** The
|
|
55
|
+
window caps bounded a proof's WIDTH but never its POSITION, so a quorum-signed proof dated years
|
|
56
|
+
ahead with a compliant 60-minute (or 72-hour) window verified today and kept verifying until that
|
|
57
|
+
date arrived. The check is unconditional — the audit/`allow_expired` override exists to re-examine
|
|
58
|
+
a proof that WAS valid and has since lapsed, which says nothing about one dated in the future.
|
|
59
|
+
- **Refuse a signed `requirement.requiredApprovals` below 1 (DIV §4.3.2).** §5 step 7's "at least
|
|
60
|
+
`requiredApprovals`" is satisfied vacuously by `0`, so a receipt carrying no valid witness
|
|
61
|
+
signature could verify. The minimum is now enforced explicitly rather than by an undocumented
|
|
62
|
+
floor, and `True` is rejected along with `0` — in Python a bool is an int.
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
Initial public release.
|
|
66
|
+
|
|
67
|
+
- Offline approval-receipt verification (ES256 and WebAuthn) against a caller-supplied trust
|
|
68
|
+
anchor — no INTYGA secret, no network. Depends only on `cryptography`.
|
|
69
|
+
- Canonical payload reconstruction held byte-identical to the TypeScript, Go, Rust and Java
|
|
70
|
+
verifiers by the shared cross-language golden vectors.
|
|
71
|
+
- DEWP Core Profile primitives and §5.2 single-anchor signature verification. §5.3 anchor-quorum
|
|
72
|
+
evaluation and DIV §5b agent-authority verification are deliberately out of scope — see the
|
|
73
|
+
README's limits section, which states them precisely rather than implying full parity.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Janbjer Technologies AB
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: intyga-verify
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Offline verifier for INTYGA approval receipts — no INTYGA secret, no network
|
|
5
|
+
Author: INTYGA
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://www.intyga.com
|
|
8
|
+
Project-URL: Repository, https://github.com/intyga-dev/verify-python
|
|
9
|
+
Project-URL: Issues, https://github.com/intyga-dev/verify-python/issues
|
|
10
|
+
Keywords: verification,receipts,webauthn,es256,audit,offline
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: cryptography>=40.0.0
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
# intyga-verify — Offline INTYGA receipt verification for Python
|
|
18
|
+
|
|
19
|
+
Independently confirm that a human cryptographically approved **exactly** the action you are about to run — in your own process, with no INTYGA secret and no network call. You recompute the canonical payload from your own parameters, check it byte-matches what was signed, and verify the human's **ES256** or **WebAuthn** signature.
|
|
20
|
+
|
|
21
|
+
Depends only on [`cryptography`](https://pypi.org/project/cryptography/). This is the verify-only surface of the INTYGA Python SDK, published on its own so a relying party that only needs verification does not install the full client. Its canonicalization is held byte-identical to the TypeScript, Go, Rust, and Java verifiers by shared cross-language test vectors.
|
|
22
|
+
|
|
23
|
+
> The full client (which bundles this verifier) is [`sdk-python`](https://github.com/intyga-dev/sdk-python).
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
pip install intyga-verify
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Verify an approval receipt
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
import intyga_verify
|
|
35
|
+
|
|
36
|
+
# The approver keys YOU trust, resolved from your own key management — never from the receipt.
|
|
37
|
+
# A receipt's own `signerPublicKey` proves only that the receipt is self-consistent.
|
|
38
|
+
APPROVERS = {"publicKeys": [MY_ENROLLED_APPROVER_KEY_B64]}
|
|
39
|
+
|
|
40
|
+
# `expected` is what you are ABOUT to execute. `target`, `nonce` and `approvers` are REQUIRED and
|
|
41
|
+
# are asserted from your side; the verifier refuses outright without them.
|
|
42
|
+
EXPECTED = {
|
|
43
|
+
"target": "prod-db-cluster-01", # THIS service (DIV Target Isolation)
|
|
44
|
+
"actionType": "wipe_production",
|
|
45
|
+
"params": {"database": "prod-db-1"},
|
|
46
|
+
"nonce": nonce, # the challenge YOU issued
|
|
47
|
+
"approvers": APPROVERS,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
result = intyga_verify.verify_approval_receipt(receipt, EXPECTED)
|
|
51
|
+
if not result["ok"]:
|
|
52
|
+
raise SystemExit(f"refusing to proceed: {result['reason']}")
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
One byte of drift — a swapped target, an appended region — and verification fails, because the signature was over the exact bytes you just recomputed.
|
|
56
|
+
|
|
57
|
+
## Whose quorum? (the requirement floor)
|
|
58
|
+
|
|
59
|
+
The signed `requirement` is the signers' own statement: its signature stops a third party from
|
|
60
|
+
altering it, not the approvers it constrains from writing a weaker one. One approver who is also the
|
|
61
|
+
requester can sign a 1-of-1 payload alone. **Without a floor this verifier proves only the quorum the
|
|
62
|
+
signers stated.** When you know the rule, add it to the expectation (DIV §5 step 3d):
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
EXPECTED["requirement"] = {"requiredApprovals": 3, "requesterCannotApprove": True}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
A signed requirement weaker on any field — fewer approvals, no four-eyes or no hardware key where the
|
|
69
|
+
floor demands one — is refused before any signature is counted, with a reason starting "signed
|
|
70
|
+
requirement is weaker than the relying party's policy"; an equal or stricter one passes. A malformed
|
|
71
|
+
floor (quorum below 1) is refused rather than ignored. The same field exists on the delegation
|
|
72
|
+
expectation (pass the ordinary rule) and the agent-authority expectation (your sealing policy).
|
|
73
|
+
Omitting it keeps the previous behaviour.
|
|
74
|
+
|
|
75
|
+
## WebAuthn (passkey) receipts
|
|
76
|
+
|
|
77
|
+
A passkey assertion harvested at *any* relying party would otherwise verify, so WebAuthn receipts require you to pin the expected origin and RP ID:
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
result = intyga_verify.verify_approval_receipt(
|
|
81
|
+
receipt,
|
|
82
|
+
EXPECTED,
|
|
83
|
+
expected_origin="https://app.example.com",
|
|
84
|
+
expected_rp_id="app.example.com",
|
|
85
|
+
)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`require_user_verification` defaults to `True`; pass `False` to accept mere user presence. Policy `AUTO_APPROVED` receipts carry no human signature and fail closed unless you pass `allow_auto_approved=True`.
|
|
89
|
+
|
|
90
|
+
## Receipt and audit verification
|
|
91
|
+
|
|
92
|
+
The package also exports `verify_platform_receipt`, `verify_agent_authority` and `ledger`.
|
|
93
|
+
The ledger module exposes `verify_bundle`, `verify_evidence_bundle`, `verify_roots_chain`,
|
|
94
|
+
`verify_anchor_signature` and `verify_anchor_quorum`. It is assembled from the same source as
|
|
95
|
+
`intyga_sdk`, including the shared cross-language regression fixtures.
|
|
96
|
+
|
|
97
|
+
RFC 3161 anchors can be checked with `verify_rfc3161_anchor(anchor, trust)` and count toward quorum
|
|
98
|
+
when `external_keys={"rfc3161": {issuer: trust}}` is supplied. This optional adapter invokes an
|
|
99
|
+
installed OpenSSL 3 executable without network access. Trust pins the CA and TSA certificate digest;
|
|
100
|
+
`revocation` must explicitly be `"crl"` with an offline CRL or `"unchecked"`. The caller may select
|
|
101
|
+
an integer `verification_time`; the default rounds the current time up by at most one second so a
|
|
102
|
+
fresh fractional timestamp is not spuriously rejected. Historical verification proves certificate
|
|
103
|
+
validity at issuance but cannot reconstruct historical revocation state.
|
|
104
|
+
|
|
105
|
+
The five language verifiers support the same receipt and audit verification features, pinned by
|
|
106
|
+
`canonical-vectors.json`, `ledger-vectors.json` and `verifier-parity-vectors.json`:
|
|
107
|
+
|
|
108
|
+
- DIV approval/offline/delegation receipts, agent-authority seals (§5b), and platform receipts (§5c).
|
|
109
|
+
Platform receipts require WebAuthn and caller-pinned digest, RP, nonce, origin and subject keys.
|
|
110
|
+
Authority/delegation verification never substitutes for approval of an action.
|
|
111
|
+
- Self-certifying DIDs, with explicit caller key mappings taking precedence.
|
|
112
|
+
- DEWP single-event and multi-event proof bundles: inclusion, canonical content/header binding,
|
|
113
|
+
embedded ES256 signatures, tenant identity, sequence gaps/duplicates and claimed range endpoints.
|
|
114
|
+
- Checkpoint continuity (§5.4), and anchor quorum (§5.3) under the caller's policy: ES256, Ed25519,
|
|
115
|
+
RSA-PSS and Rekor SET/payload verification under a separately pinned log key.
|
|
116
|
+
|
|
117
|
+
Trust inputs must come from the caller. A root carried in the bundle proves only internal
|
|
118
|
+
consistency; a producer's `externallyAnchored` flag is a claim, not verification. Bundle-carried
|
|
119
|
+
anchors can count under caller-trusted keys, but only independently fetched, checkpoint-attributed
|
|
120
|
+
anchors may establish divergence. For multi-checkpoint exports, key caller anchors by checkpoint ID
|
|
121
|
+
or root; a flat list cannot establish exact attribution across checkpoints.
|
|
122
|
+
For a multi-issuer policy, scope the Rekor key with `external_keys["rekor_issuer"]`; an unscoped
|
|
123
|
+
legacy key is accepted only when exactly one issuer is trusted.
|
|
124
|
+
|
|
125
|
+
Limits remain explicit: no NDJSON evidence streaming and no WEBHOOK
|
|
126
|
+
anchor verifier. Those anchors do not count toward quorum. No implementation claims the complete
|
|
127
|
+
DEWP Extended Profile (§9.2). WebAuthn audit signatures require profile-carried assertion data and caller trust; verify the
|
|
128
|
+
full DIV receipt separately for authorization and quorum. Offline authority verification checks the seal, not subsequent online
|
|
129
|
+
revocation. Verification does not consume a nonce or prove execution.
|
|
130
|
+
|
|
131
|
+
## Also available in
|
|
132
|
+
- TypeScript — [`@intyga/verify`](https://github.com/intyga-dev/verify)
|
|
133
|
+
- Go — [`verify-go`](https://github.com/intyga-dev/verify-go)
|
|
134
|
+
- Rust — [`intyga-verify`](https://github.com/intyga-dev/verify-rust)
|
|
135
|
+
- Java — [`com.intyga:intyga-verify`](https://github.com/intyga-dev/verify-java)
|
|
136
|
+
|
|
137
|
+
## License
|
|
138
|
+
|
|
139
|
+
Apache-2.0.
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
### Audit event signatures
|
|
143
|
+
|
|
144
|
+
The `trust.intyga.audit.v1` profile carries WebAuthn assertion data in the committed
|
|
145
|
+
`canonical.metadata.webauthn.authenticatorData` and `clientDataJSON` fields. Both single-proof and
|
|
146
|
+
bulk-evidence verification check these assertions when given caller-owned signer trust. This is a
|
|
147
|
+
signature over the exact `signedPayload`, not approval quorum, action authorization, hardware
|
|
148
|
+
attestation, current credential status or proof that the deploy executed. Verify the full DIV receipt
|
|
149
|
+
against the expected operation and approval policy for those authorization checks.
|
|
150
|
+
|
|
151
|
+
The per-event signature result distinguishes `verified`, `invalid`, `not_checked` (missing trust,
|
|
152
|
+
missing material or unsupported algorithm) and `not_applicable` (unsigned/system or AUTO_APPROVED).
|
|
153
|
+
A reason accompanies each status. `trusted: true` requires a valid signature under a caller-supplied
|
|
154
|
+
key mapped to that signer DID. WebAuthn requires caller-selected origin and RP ID, user presence and
|
|
155
|
+
user verification, and refuses cross-origin assertions. Supply COSE keys for WebAuthn and SPKI keys
|
|
156
|
+
for ES256. Multiple keys per DID support deliberate key rotation; the evidence's key is never added
|
|
157
|
+
to the caller's trusted set.
|
|
158
|
+
|
|
159
|
+
Without a signature policy, legacy ES256 checks still use the embedded key and report `trusted: false`;
|
|
160
|
+
WebAuthn reports `not_checked`. Diagnostic ledger validity does not imply signature validity. The
|
|
161
|
+
strict signature option requires **every selected entry** to have a verified, caller-trusted signature;
|
|
162
|
+
unsigned, redacted, incomplete and invalid entries fail that option. Anchor quorum is a separate policy.
|
|
163
|
+
|
|
164
|
+
Pass `signature_policy={"trustedSigners": {did: [public_key]}, "expectedOrigin": origin, "expectedRpId": rp_id}`
|
|
165
|
+
and `require_signatures=True` to `verify_bundle` / `verify_evidence_bundle`.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# intyga-verify — Offline INTYGA receipt verification for Python
|
|
2
|
+
|
|
3
|
+
Independently confirm that a human cryptographically approved **exactly** the action you are about to run — in your own process, with no INTYGA secret and no network call. You recompute the canonical payload from your own parameters, check it byte-matches what was signed, and verify the human's **ES256** or **WebAuthn** signature.
|
|
4
|
+
|
|
5
|
+
Depends only on [`cryptography`](https://pypi.org/project/cryptography/). This is the verify-only surface of the INTYGA Python SDK, published on its own so a relying party that only needs verification does not install the full client. Its canonicalization is held byte-identical to the TypeScript, Go, Rust, and Java verifiers by shared cross-language test vectors.
|
|
6
|
+
|
|
7
|
+
> The full client (which bundles this verifier) is [`sdk-python`](https://github.com/intyga-dev/sdk-python).
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pip install intyga-verify
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Verify an approval receipt
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
import intyga_verify
|
|
19
|
+
|
|
20
|
+
# The approver keys YOU trust, resolved from your own key management — never from the receipt.
|
|
21
|
+
# A receipt's own `signerPublicKey` proves only that the receipt is self-consistent.
|
|
22
|
+
APPROVERS = {"publicKeys": [MY_ENROLLED_APPROVER_KEY_B64]}
|
|
23
|
+
|
|
24
|
+
# `expected` is what you are ABOUT to execute. `target`, `nonce` and `approvers` are REQUIRED and
|
|
25
|
+
# are asserted from your side; the verifier refuses outright without them.
|
|
26
|
+
EXPECTED = {
|
|
27
|
+
"target": "prod-db-cluster-01", # THIS service (DIV Target Isolation)
|
|
28
|
+
"actionType": "wipe_production",
|
|
29
|
+
"params": {"database": "prod-db-1"},
|
|
30
|
+
"nonce": nonce, # the challenge YOU issued
|
|
31
|
+
"approvers": APPROVERS,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
result = intyga_verify.verify_approval_receipt(receipt, EXPECTED)
|
|
35
|
+
if not result["ok"]:
|
|
36
|
+
raise SystemExit(f"refusing to proceed: {result['reason']}")
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
One byte of drift — a swapped target, an appended region — and verification fails, because the signature was over the exact bytes you just recomputed.
|
|
40
|
+
|
|
41
|
+
## Whose quorum? (the requirement floor)
|
|
42
|
+
|
|
43
|
+
The signed `requirement` is the signers' own statement: its signature stops a third party from
|
|
44
|
+
altering it, not the approvers it constrains from writing a weaker one. One approver who is also the
|
|
45
|
+
requester can sign a 1-of-1 payload alone. **Without a floor this verifier proves only the quorum the
|
|
46
|
+
signers stated.** When you know the rule, add it to the expectation (DIV §5 step 3d):
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
EXPECTED["requirement"] = {"requiredApprovals": 3, "requesterCannotApprove": True}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
A signed requirement weaker on any field — fewer approvals, no four-eyes or no hardware key where the
|
|
53
|
+
floor demands one — is refused before any signature is counted, with a reason starting "signed
|
|
54
|
+
requirement is weaker than the relying party's policy"; an equal or stricter one passes. A malformed
|
|
55
|
+
floor (quorum below 1) is refused rather than ignored. The same field exists on the delegation
|
|
56
|
+
expectation (pass the ordinary rule) and the agent-authority expectation (your sealing policy).
|
|
57
|
+
Omitting it keeps the previous behaviour.
|
|
58
|
+
|
|
59
|
+
## WebAuthn (passkey) receipts
|
|
60
|
+
|
|
61
|
+
A passkey assertion harvested at *any* relying party would otherwise verify, so WebAuthn receipts require you to pin the expected origin and RP ID:
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
result = intyga_verify.verify_approval_receipt(
|
|
65
|
+
receipt,
|
|
66
|
+
EXPECTED,
|
|
67
|
+
expected_origin="https://app.example.com",
|
|
68
|
+
expected_rp_id="app.example.com",
|
|
69
|
+
)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`require_user_verification` defaults to `True`; pass `False` to accept mere user presence. Policy `AUTO_APPROVED` receipts carry no human signature and fail closed unless you pass `allow_auto_approved=True`.
|
|
73
|
+
|
|
74
|
+
## Receipt and audit verification
|
|
75
|
+
|
|
76
|
+
The package also exports `verify_platform_receipt`, `verify_agent_authority` and `ledger`.
|
|
77
|
+
The ledger module exposes `verify_bundle`, `verify_evidence_bundle`, `verify_roots_chain`,
|
|
78
|
+
`verify_anchor_signature` and `verify_anchor_quorum`. It is assembled from the same source as
|
|
79
|
+
`intyga_sdk`, including the shared cross-language regression fixtures.
|
|
80
|
+
|
|
81
|
+
RFC 3161 anchors can be checked with `verify_rfc3161_anchor(anchor, trust)` and count toward quorum
|
|
82
|
+
when `external_keys={"rfc3161": {issuer: trust}}` is supplied. This optional adapter invokes an
|
|
83
|
+
installed OpenSSL 3 executable without network access. Trust pins the CA and TSA certificate digest;
|
|
84
|
+
`revocation` must explicitly be `"crl"` with an offline CRL or `"unchecked"`. The caller may select
|
|
85
|
+
an integer `verification_time`; the default rounds the current time up by at most one second so a
|
|
86
|
+
fresh fractional timestamp is not spuriously rejected. Historical verification proves certificate
|
|
87
|
+
validity at issuance but cannot reconstruct historical revocation state.
|
|
88
|
+
|
|
89
|
+
The five language verifiers support the same receipt and audit verification features, pinned by
|
|
90
|
+
`canonical-vectors.json`, `ledger-vectors.json` and `verifier-parity-vectors.json`:
|
|
91
|
+
|
|
92
|
+
- DIV approval/offline/delegation receipts, agent-authority seals (§5b), and platform receipts (§5c).
|
|
93
|
+
Platform receipts require WebAuthn and caller-pinned digest, RP, nonce, origin and subject keys.
|
|
94
|
+
Authority/delegation verification never substitutes for approval of an action.
|
|
95
|
+
- Self-certifying DIDs, with explicit caller key mappings taking precedence.
|
|
96
|
+
- DEWP single-event and multi-event proof bundles: inclusion, canonical content/header binding,
|
|
97
|
+
embedded ES256 signatures, tenant identity, sequence gaps/duplicates and claimed range endpoints.
|
|
98
|
+
- Checkpoint continuity (§5.4), and anchor quorum (§5.3) under the caller's policy: ES256, Ed25519,
|
|
99
|
+
RSA-PSS and Rekor SET/payload verification under a separately pinned log key.
|
|
100
|
+
|
|
101
|
+
Trust inputs must come from the caller. A root carried in the bundle proves only internal
|
|
102
|
+
consistency; a producer's `externallyAnchored` flag is a claim, not verification. Bundle-carried
|
|
103
|
+
anchors can count under caller-trusted keys, but only independently fetched, checkpoint-attributed
|
|
104
|
+
anchors may establish divergence. For multi-checkpoint exports, key caller anchors by checkpoint ID
|
|
105
|
+
or root; a flat list cannot establish exact attribution across checkpoints.
|
|
106
|
+
For a multi-issuer policy, scope the Rekor key with `external_keys["rekor_issuer"]`; an unscoped
|
|
107
|
+
legacy key is accepted only when exactly one issuer is trusted.
|
|
108
|
+
|
|
109
|
+
Limits remain explicit: no NDJSON evidence streaming and no WEBHOOK
|
|
110
|
+
anchor verifier. Those anchors do not count toward quorum. No implementation claims the complete
|
|
111
|
+
DEWP Extended Profile (§9.2). WebAuthn audit signatures require profile-carried assertion data and caller trust; verify the
|
|
112
|
+
full DIV receipt separately for authorization and quorum. Offline authority verification checks the seal, not subsequent online
|
|
113
|
+
revocation. Verification does not consume a nonce or prove execution.
|
|
114
|
+
|
|
115
|
+
## Also available in
|
|
116
|
+
- TypeScript — [`@intyga/verify`](https://github.com/intyga-dev/verify)
|
|
117
|
+
- Go — [`verify-go`](https://github.com/intyga-dev/verify-go)
|
|
118
|
+
- Rust — [`intyga-verify`](https://github.com/intyga-dev/verify-rust)
|
|
119
|
+
- Java — [`com.intyga:intyga-verify`](https://github.com/intyga-dev/verify-java)
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
Apache-2.0.
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
### Audit event signatures
|
|
127
|
+
|
|
128
|
+
The `trust.intyga.audit.v1` profile carries WebAuthn assertion data in the committed
|
|
129
|
+
`canonical.metadata.webauthn.authenticatorData` and `clientDataJSON` fields. Both single-proof and
|
|
130
|
+
bulk-evidence verification check these assertions when given caller-owned signer trust. This is a
|
|
131
|
+
signature over the exact `signedPayload`, not approval quorum, action authorization, hardware
|
|
132
|
+
attestation, current credential status or proof that the deploy executed. Verify the full DIV receipt
|
|
133
|
+
against the expected operation and approval policy for those authorization checks.
|
|
134
|
+
|
|
135
|
+
The per-event signature result distinguishes `verified`, `invalid`, `not_checked` (missing trust,
|
|
136
|
+
missing material or unsupported algorithm) and `not_applicable` (unsigned/system or AUTO_APPROVED).
|
|
137
|
+
A reason accompanies each status. `trusted: true` requires a valid signature under a caller-supplied
|
|
138
|
+
key mapped to that signer DID. WebAuthn requires caller-selected origin and RP ID, user presence and
|
|
139
|
+
user verification, and refuses cross-origin assertions. Supply COSE keys for WebAuthn and SPKI keys
|
|
140
|
+
for ES256. Multiple keys per DID support deliberate key rotation; the evidence's key is never added
|
|
141
|
+
to the caller's trusted set.
|
|
142
|
+
|
|
143
|
+
Without a signature policy, legacy ES256 checks still use the embedded key and report `trusted: false`;
|
|
144
|
+
WebAuthn reports `not_checked`. Diagnostic ledger validity does not imply signature validity. The
|
|
145
|
+
strict signature option requires **every selected entry** to have a verified, caller-trusted signature;
|
|
146
|
+
unsigned, redacted, incomplete and invalid entries fail that option. Anchor quorum is a separate policy.
|
|
147
|
+
|
|
148
|
+
Pass `signature_policy={"trustedSigners": {did: [public_key]}, "expectedOrigin": origin, "expectedRpId": rp_id}`
|
|
149
|
+
and `require_signatures=True` to `verify_bundle` / `verify_evidence_bundle`.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""intyga-verify — offline verification of INTYGA approval receipts.
|
|
2
|
+
|
|
3
|
+
The verifier and its canonicalization helpers, with no INTYGA secret and no network. This is the
|
|
4
|
+
verify-only surface of the Python SDK, published on its own so a relying party that only needs to
|
|
5
|
+
verify receipts does not have to install the full client. Kept byte-identical to the TypeScript, Go,
|
|
6
|
+
Rust, and Java verifiers by shared cross-language test vectors.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
# NOTE: the pre-DIV canonical_authorization_payload / _v3 builders were removed with the v2/v3
|
|
10
|
+
# formats (ADR 005/014) — do not re-add them here; verify_approval_receipt rejects v != 1.
|
|
11
|
+
from . import ledger
|
|
12
|
+
from .rfc3161 import verify_rfc3161_anchor
|
|
13
|
+
from .crypto import (
|
|
14
|
+
canonical_agent_authority_payload,
|
|
15
|
+
canonical_platform_intent_payload,
|
|
16
|
+
verify_agent_authority,
|
|
17
|
+
verify_platform_receipt,
|
|
18
|
+
self_certifying_did,
|
|
19
|
+
stable_stringify,
|
|
20
|
+
canonical_challenge_payload,
|
|
21
|
+
canonical_intent_payload,
|
|
22
|
+
canonical_action_payload,
|
|
23
|
+
canonical_enroll_payload,
|
|
24
|
+
canonical_login_payload,
|
|
25
|
+
payload_digest_hex,
|
|
26
|
+
verification_code,
|
|
27
|
+
verify_ecdsa_p256,
|
|
28
|
+
verify_approval_receipt,
|
|
29
|
+
# DIV §5a. Without these the published verifier cannot check an offline approval or a delegation
|
|
30
|
+
# at all — the two mechanisms a relying party most needs to verify locally, since they exist
|
|
31
|
+
# precisely for when the gateway is unreachable.
|
|
32
|
+
canonical_offline_intent_payload,
|
|
33
|
+
canonical_delegation_payload,
|
|
34
|
+
verify_delegation,
|
|
35
|
+
NonCanonicalValue,
|
|
36
|
+
# DIV §5 step 3d: the refusal stem for a signed requirement below expected["requirement"].
|
|
37
|
+
WEAKER_REQUIREMENT_REASON,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
__all__ = [
|
|
41
|
+
"ledger",
|
|
42
|
+
"verify_rfc3161_anchor",
|
|
43
|
+
"canonical_agent_authority_payload",
|
|
44
|
+
"canonical_platform_intent_payload",
|
|
45
|
+
"verify_agent_authority",
|
|
46
|
+
"verify_platform_receipt",
|
|
47
|
+
"self_certifying_did",
|
|
48
|
+
"stable_stringify",
|
|
49
|
+
"canonical_offline_intent_payload",
|
|
50
|
+
"canonical_delegation_payload",
|
|
51
|
+
"verify_delegation",
|
|
52
|
+
"NonCanonicalValue",
|
|
53
|
+
"canonical_challenge_payload",
|
|
54
|
+
"canonical_intent_payload",
|
|
55
|
+
"canonical_action_payload",
|
|
56
|
+
"canonical_enroll_payload",
|
|
57
|
+
"canonical_login_payload",
|
|
58
|
+
"payload_digest_hex",
|
|
59
|
+
"verification_code",
|
|
60
|
+
"verify_ecdsa_p256",
|
|
61
|
+
"verify_approval_receipt",
|
|
62
|
+
"WEAKER_REQUIREMENT_REASON",
|
|
63
|
+
]
|