mintid-agent 0.1.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.
- mintid_agent-0.1.0/LICENSE +202 -0
- mintid_agent-0.1.0/NOTICE +12 -0
- mintid_agent-0.1.0/PKG-INFO +128 -0
- mintid_agent-0.1.0/README.md +98 -0
- mintid_agent-0.1.0/pyproject.toml +53 -0
- mintid_agent-0.1.0/src/mintid_agent/__init__.py +89 -0
- mintid_agent-0.1.0/src/mintid_agent/client.py +504 -0
- mintid_agent-0.1.0/src/mintid_agent/disclosure.py +124 -0
- mintid_agent-0.1.0/src/mintid_agent/errors.py +94 -0
- mintid_agent-0.1.0/src/mintid_agent/issuance.py +188 -0
- mintid_agent-0.1.0/src/mintid_agent/store.py +95 -0
- mintid_agent-0.1.0/src/mintid_agent/web_bot_auth.py +130 -0
- mintid_agent-0.1.0/src/mintid_agent/x402.py +178 -0
- mintid_agent-0.1.0/tests/test_agent_client.py +609 -0
- mintid_agent-0.1.0/tests/test_agent_disclosure_relay.py +238 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
MintID
|
|
2
|
+
Copyright 2026 The MintID Authors
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
5
|
+
|
|
6
|
+
The MintID Authors are the contributors to this source tree; each contribution
|
|
7
|
+
is made under the Developer Certificate of Origin (see CONTRIBUTING.md).
|
|
8
|
+
|
|
9
|
+
Third-party components are used under their own licences, recorded in the
|
|
10
|
+
dependency manifests and lock files of this tree (identity-chain/go.mod and
|
|
11
|
+
go.sum, identity-proof-core/Cargo.toml and Cargo.lock, pyproject.toml and
|
|
12
|
+
uv.lock, the package.json and package-lock.json files under sdk/).
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: mintid-agent
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MintID agent client: agent credential custody, witness refresh and the x402 payment-identity loop over the MintID holder library
|
|
5
|
+
Project-URL: Homepage, https://mintid.net
|
|
6
|
+
Project-URL: Documentation, https://gitlab.com/mintid/mintid/-/blob/main/docs/sdk/15-agent-clients.md
|
|
7
|
+
Project-URL: Repository, https://gitlab.com/mintid/mintid
|
|
8
|
+
Project-URL: Source, https://gitlab.com/mintid/sdk-python
|
|
9
|
+
Project-URL: Issues, https://gitlab.com/mintid/mintid/-/issues
|
|
10
|
+
Project-URL: Security, https://gitlab.com/mintid/mintid/-/blob/main/SECURITY.md
|
|
11
|
+
Author-email: Marc Molas <marc@mintid.net>
|
|
12
|
+
License-Expression: Apache-2.0
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
License-File: NOTICE
|
|
15
|
+
Keywords: agents,identity,mintid,verifiable-credentials,web-bot-auth,x402,zero-knowledge
|
|
16
|
+
Classifier: Development Status :: 3 - Alpha
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
23
|
+
Classifier: Topic :: Security :: Cryptography
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
+
Requires-Python: >=3.12
|
|
26
|
+
Requires-Dist: mintid-proof-core<0.4,>=0.3.0
|
|
27
|
+
Provides-Extra: ed25519
|
|
28
|
+
Requires-Dist: cryptography>=42; extra == 'ed25519'
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# mintid-agent
|
|
32
|
+
|
|
33
|
+
The MintID agent client for Python: the agent runtime's side of an agent
|
|
34
|
+
credential. An agent credential proves that a person, verified at an issuer,
|
|
35
|
+
delegated *this* agent to pay *this* kind of counterparty within stated
|
|
36
|
+
bounds, and nothing about who that person is. The client obtains the
|
|
37
|
+
credential from an agent offer, keeps its witnesses current, answers a
|
|
38
|
+
seller's identity requirement inside an x402 payment flow, and refuses,
|
|
39
|
+
before anything is sent or paid, whatever the delegation does not cover.
|
|
40
|
+
|
|
41
|
+
It carries no cryptography of its own: proofs come from the MintID holder
|
|
42
|
+
library (`mintid-proof-core`), signatures from a signer you inject.
|
|
43
|
+
|
|
44
|
+
## Where it fits
|
|
45
|
+
|
|
46
|
+
MintID is a network for verifiable, human-backed identity. Accepted issuers
|
|
47
|
+
verify people and issue the credentials; the chain publishes their status
|
|
48
|
+
roots, their bonds and the registries; each verifier decides on its own
|
|
49
|
+
service. MintID itself issues nothing, certifies nothing and verifies nobody.
|
|
50
|
+
|
|
51
|
+
The agent client runs in your own infrastructure, and its keys never leave
|
|
52
|
+
it: the credential's private bytes go only to the credential store you inject
|
|
53
|
+
(encryption at rest is yours), and the request-signing key stays behind the
|
|
54
|
+
signer you inject. The operator who mints the agent, not the agent, decides
|
|
55
|
+
the delegation.
|
|
56
|
+
|
|
57
|
+
## Install
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install mintid-agent # Python 3.12 or later
|
|
61
|
+
pip install "mintid-agent[ed25519]" # with the software Ed25519 signer
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
It depends on `mintid-proof-core`, which compiles the Rust proof core in;
|
|
65
|
+
where no wheel matches your platform, pip builds it from source with a Rust
|
|
66
|
+
toolchain. Version 0.1.0, published from the main repository,
|
|
67
|
+
https://gitlab.com/mintid/mintid (`sdk/python/mintid-agent`).
|
|
68
|
+
|
|
69
|
+
## Example
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from mintid_agent import AgentClient
|
|
73
|
+
from proof_core.holder import urllib_transport
|
|
74
|
+
|
|
75
|
+
# offer: the agent offer the operator made; principal: the principal's
|
|
76
|
+
# identity credential (a proof_core.holder.Holder); store: your CredentialStore.
|
|
77
|
+
agent = AgentClient.issue_from_offer(offer, principal, transport=urllib_transport(), store=store)
|
|
78
|
+
|
|
79
|
+
agent.refresh() # the status witness, then the scope log
|
|
80
|
+
envelope = agent.present(challenge) # or refuses, naming what the delegation cannot satisfy
|
|
81
|
+
result = agent.pay(url, payer=payer) # one paid request; your payer builds the payment header
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The same client renews the credential from a renewal offer and holds the
|
|
85
|
+
agent's kill switch: holder self-revocation, submitted through a privacy
|
|
86
|
+
relay and confirmed against the chain.
|
|
87
|
+
|
|
88
|
+
## Where to test
|
|
89
|
+
|
|
90
|
+
On the public testnet and its KYC sandbox, and only there: check the status
|
|
91
|
+
line of [its page](https://gitlab.com/mintid/mintid/-/blob/main/docs/sdk/17-sandbox-and-testnet.md)
|
|
92
|
+
first. Nothing minted on it carries weight. The single-node production chain
|
|
93
|
+
is not for third parties and is never a place to test.
|
|
94
|
+
|
|
95
|
+
## Links
|
|
96
|
+
|
|
97
|
+
- Documentation: https://gitlab.com/mintid/mintid/-/blob/main/docs/sdk/15-agent-clients.md
|
|
98
|
+
- Source: https://gitlab.com/mintid/mintid (`sdk/python/mintid-agent`), where
|
|
99
|
+
issues and merge requests go; read-only mirror: https://gitlab.com/mintid/sdk-python
|
|
100
|
+
- Public testnet: https://gitlab.com/mintid/mintid/-/blob/main/docs/sdk/17-sandbox-and-testnet.md
|
|
101
|
+
- Security: report a vulnerability privately to security@mintid.net, never in
|
|
102
|
+
a public issue; policy: https://gitlab.com/mintid/mintid/-/blob/main/SECURITY.md
|
|
103
|
+
- Website: https://mintid.net
|
|
104
|
+
|
|
105
|
+
## Licence
|
|
106
|
+
|
|
107
|
+
Apache License 2.0 (`LICENSE`, `NOTICE`). Author: Marc Molas.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## This repository
|
|
112
|
+
|
|
113
|
+
This is a read-only mirror of `sdk/python/mintid-agent` of the MintID source tree,
|
|
114
|
+
https://gitlab.com/mintid/mintid, and is published from it: each publication replaces its
|
|
115
|
+
content, and nothing is merged here. Issues and merge requests go to the main
|
|
116
|
+
project, https://gitlab.com/mintid/mintid/-/issues; a vulnerability goes privately to the
|
|
117
|
+
address in its SECURITY.md, never to a public issue. Licence: Apache License
|
|
118
|
+
2.0 (LICENSE and NOTICE); contributions follow the main project's
|
|
119
|
+
CONTRIBUTING.md.
|
|
120
|
+
|
|
121
|
+
Package: `mintid-agent` (Python >= 3.12). It depends on `mintid-proof-core`,
|
|
122
|
+
the Python bindings of the Rust proof core and holder library, whose source is
|
|
123
|
+
`identity-proof-core/python` of the main repository. To work here against the
|
|
124
|
+
proof core of the same revision, build it from a clone of the main repository
|
|
125
|
+
(`pip install ./identity-proof-core/python`, with a Rust toolchain), then
|
|
126
|
+
install this package (`pip install -e ".[ed25519]"`).
|
|
127
|
+
|
|
128
|
+
<!-- Published from source revision 78d9a9a08ce8. -->
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# mintid-agent
|
|
2
|
+
|
|
3
|
+
The MintID agent client for Python: the agent runtime's side of an agent
|
|
4
|
+
credential. An agent credential proves that a person, verified at an issuer,
|
|
5
|
+
delegated *this* agent to pay *this* kind of counterparty within stated
|
|
6
|
+
bounds, and nothing about who that person is. The client obtains the
|
|
7
|
+
credential from an agent offer, keeps its witnesses current, answers a
|
|
8
|
+
seller's identity requirement inside an x402 payment flow, and refuses,
|
|
9
|
+
before anything is sent or paid, whatever the delegation does not cover.
|
|
10
|
+
|
|
11
|
+
It carries no cryptography of its own: proofs come from the MintID holder
|
|
12
|
+
library (`mintid-proof-core`), signatures from a signer you inject.
|
|
13
|
+
|
|
14
|
+
## Where it fits
|
|
15
|
+
|
|
16
|
+
MintID is a network for verifiable, human-backed identity. Accepted issuers
|
|
17
|
+
verify people and issue the credentials; the chain publishes their status
|
|
18
|
+
roots, their bonds and the registries; each verifier decides on its own
|
|
19
|
+
service. MintID itself issues nothing, certifies nothing and verifies nobody.
|
|
20
|
+
|
|
21
|
+
The agent client runs in your own infrastructure, and its keys never leave
|
|
22
|
+
it: the credential's private bytes go only to the credential store you inject
|
|
23
|
+
(encryption at rest is yours), and the request-signing key stays behind the
|
|
24
|
+
signer you inject. The operator who mints the agent, not the agent, decides
|
|
25
|
+
the delegation.
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install mintid-agent # Python 3.12 or later
|
|
31
|
+
pip install "mintid-agent[ed25519]" # with the software Ed25519 signer
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
It depends on `mintid-proof-core`, which compiles the Rust proof core in;
|
|
35
|
+
where no wheel matches your platform, pip builds it from source with a Rust
|
|
36
|
+
toolchain. Version 0.1.0, published from the main repository,
|
|
37
|
+
https://gitlab.com/mintid/mintid (`sdk/python/mintid-agent`).
|
|
38
|
+
|
|
39
|
+
## Example
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from mintid_agent import AgentClient
|
|
43
|
+
from proof_core.holder import urllib_transport
|
|
44
|
+
|
|
45
|
+
# offer: the agent offer the operator made; principal: the principal's
|
|
46
|
+
# identity credential (a proof_core.holder.Holder); store: your CredentialStore.
|
|
47
|
+
agent = AgentClient.issue_from_offer(offer, principal, transport=urllib_transport(), store=store)
|
|
48
|
+
|
|
49
|
+
agent.refresh() # the status witness, then the scope log
|
|
50
|
+
envelope = agent.present(challenge) # or refuses, naming what the delegation cannot satisfy
|
|
51
|
+
result = agent.pay(url, payer=payer) # one paid request; your payer builds the payment header
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The same client renews the credential from a renewal offer and holds the
|
|
55
|
+
agent's kill switch: holder self-revocation, submitted through a privacy
|
|
56
|
+
relay and confirmed against the chain.
|
|
57
|
+
|
|
58
|
+
## Where to test
|
|
59
|
+
|
|
60
|
+
On the public testnet and its KYC sandbox, and only there: check the status
|
|
61
|
+
line of [its page](https://gitlab.com/mintid/mintid/-/blob/main/docs/sdk/17-sandbox-and-testnet.md)
|
|
62
|
+
first. Nothing minted on it carries weight. The single-node production chain
|
|
63
|
+
is not for third parties and is never a place to test.
|
|
64
|
+
|
|
65
|
+
## Links
|
|
66
|
+
|
|
67
|
+
- Documentation: https://gitlab.com/mintid/mintid/-/blob/main/docs/sdk/15-agent-clients.md
|
|
68
|
+
- Source: https://gitlab.com/mintid/mintid (`sdk/python/mintid-agent`), where
|
|
69
|
+
issues and merge requests go; read-only mirror: https://gitlab.com/mintid/sdk-python
|
|
70
|
+
- Public testnet: https://gitlab.com/mintid/mintid/-/blob/main/docs/sdk/17-sandbox-and-testnet.md
|
|
71
|
+
- Security: report a vulnerability privately to security@mintid.net, never in
|
|
72
|
+
a public issue; policy: https://gitlab.com/mintid/mintid/-/blob/main/SECURITY.md
|
|
73
|
+
- Website: https://mintid.net
|
|
74
|
+
|
|
75
|
+
## Licence
|
|
76
|
+
|
|
77
|
+
Apache License 2.0 (`LICENSE`, `NOTICE`). Author: Marc Molas.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## This repository
|
|
82
|
+
|
|
83
|
+
This is a read-only mirror of `sdk/python/mintid-agent` of the MintID source tree,
|
|
84
|
+
https://gitlab.com/mintid/mintid, and is published from it: each publication replaces its
|
|
85
|
+
content, and nothing is merged here. Issues and merge requests go to the main
|
|
86
|
+
project, https://gitlab.com/mintid/mintid/-/issues; a vulnerability goes privately to the
|
|
87
|
+
address in its SECURITY.md, never to a public issue. Licence: Apache License
|
|
88
|
+
2.0 (LICENSE and NOTICE); contributions follow the main project's
|
|
89
|
+
CONTRIBUTING.md.
|
|
90
|
+
|
|
91
|
+
Package: `mintid-agent` (Python >= 3.12). It depends on `mintid-proof-core`,
|
|
92
|
+
the Python bindings of the Rust proof core and holder library, whose source is
|
|
93
|
+
`identity-proof-core/python` of the main repository. To work here against the
|
|
94
|
+
proof core of the same revision, build it from a clone of the main repository
|
|
95
|
+
(`pip install ./identity-proof-core/python`, with a Rust toolchain), then
|
|
96
|
+
install this package (`pip install -e ".[ed25519]"`).
|
|
97
|
+
|
|
98
|
+
<!-- Published from source revision 78d9a9a08ce8. -->
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# mintid-agent — the agent client (MINT-342, ADR-0019 P2-3): an agent
|
|
2
|
+
# runtime's side of the MintID agent channel over the holder library —
|
|
3
|
+
# redeem an agent offer with the principal's mint presentation, keep the
|
|
4
|
+
# status and scope witnesses fresh, and run the x402 identity leg of
|
|
5
|
+
# bIP-0002/1 (challenge → present → X-MINTID-PRESENTATION next to
|
|
6
|
+
# X-PAYMENT → X-MINTID-SESSION reuse), Web Bot Auth-signed.
|
|
7
|
+
# Client side only: no verifier or issuer logic, no cryptography of its own
|
|
8
|
+
# (the proof core is the holder library's; Ed25519 signing is injected).
|
|
9
|
+
[project]
|
|
10
|
+
name = "mintid-agent"
|
|
11
|
+
version = "0.1.0"
|
|
12
|
+
description = "MintID agent client: agent credential custody, witness refresh and the x402 payment-identity loop over the MintID holder library"
|
|
13
|
+
readme = "README.md"
|
|
14
|
+
requires-python = ">=3.12"
|
|
15
|
+
license = "Apache-2.0"
|
|
16
|
+
authors = [{ name = "Marc Molas", email = "marc@mintid.net" }]
|
|
17
|
+
keywords = ["mintid", "identity", "agents", "verifiable-credentials", "zero-knowledge", "x402", "web-bot-auth"]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Development Status :: 3 - Alpha",
|
|
20
|
+
"Intended Audience :: Developers",
|
|
21
|
+
"License :: OSI Approved :: Apache Software License",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
26
|
+
"Topic :: Security :: Cryptography",
|
|
27
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
28
|
+
]
|
|
29
|
+
dependencies = [
|
|
30
|
+
# The holder library (proof_core.holder) — the only cryptography.
|
|
31
|
+
"mintid-proof-core>=0.3.0,<0.4",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Homepage = "https://mintid.net"
|
|
36
|
+
Documentation = "https://gitlab.com/mintid/mintid/-/blob/main/docs/sdk/15-agent-clients.md"
|
|
37
|
+
Repository = "https://gitlab.com/mintid/mintid"
|
|
38
|
+
Source = "https://gitlab.com/mintid/sdk-python"
|
|
39
|
+
Issues = "https://gitlab.com/mintid/mintid/-/issues"
|
|
40
|
+
Security = "https://gitlab.com/mintid/mintid/-/blob/main/SECURITY.md"
|
|
41
|
+
|
|
42
|
+
[project.optional-dependencies]
|
|
43
|
+
# Ed25519Signer (Web Bot Auth) over ``cryptography``; bring your own
|
|
44
|
+
# signer (HSM, KMS, enclave) and this extra is not needed.
|
|
45
|
+
ed25519 = ["cryptography>=42"]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
[build-system]
|
|
49
|
+
requires = ["hatchling"]
|
|
50
|
+
build-backend = "hatchling.build"
|
|
51
|
+
|
|
52
|
+
[tool.hatch.build.targets.wheel]
|
|
53
|
+
packages = ["src/mintid_agent"]
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""mintid-agent — the MintID agent client (MINT-342).
|
|
2
|
+
|
|
3
|
+
An agent runtime's side of the agent channel, over the holder library
|
|
4
|
+
(``proof_core.holder``): ``AgentClient.issue_from_offer`` (the principal's
|
|
5
|
+
mint presentation redeems an agent offer), ``refresh`` (status witness +
|
|
6
|
+
bulk scope delta replay), ``present`` (fail closed, naming the output key),
|
|
7
|
+
``pay`` (the bIP-0002/1 x402 identity loop, Web Bot Auth-signed) and
|
|
8
|
+
``renew`` (MINT-19 replacement). Keys never leave the client: the
|
|
9
|
+
credential's private bytes go only to an injected ``CredentialStore``
|
|
10
|
+
(encrypt-at-rest is the integrator's), the signing key stays behind an
|
|
11
|
+
injected ``Signer``. See ``docs/sdk/12-agent-clients.md``.
|
|
12
|
+
|
|
13
|
+
The pairwise agent pseudonym (R-A10) is mandatory in every ``bip-0002/1``
|
|
14
|
+
policy since contract 1.4.0: ``pay`` / ``present`` need nothing for it —
|
|
15
|
+
the holder proves the pseudonym for the challenge's own verifier (and
|
|
16
|
+
refuses a challenge naming another). ``unexpired`` is mandatory too since
|
|
17
|
+
1.5.0 (a declaration without it is ``unexpired_required``); an agent past
|
|
18
|
+
its lease cannot answer anywhere, and ``refresh`` reports the issuer's lease
|
|
19
|
+
sweep as ``CredentialRevoked`` from the next root on. A vendor session ends
|
|
20
|
+
with the status root it was decided under, so ``pay`` presents again after
|
|
21
|
+
each new root. Not in this version: sub-delegation
|
|
22
|
+
(``agent.delegate`` is gated)."""
|
|
23
|
+
|
|
24
|
+
from proof_core.holder import (
|
|
25
|
+
CredentialRevoked,
|
|
26
|
+
HolderError,
|
|
27
|
+
SelfRevocationReceipt,
|
|
28
|
+
SelfRevocationRefused,
|
|
29
|
+
WitnessState,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
from mintid_agent.client import AgentClient, Payer, PaymentResult
|
|
33
|
+
from mintid_agent.errors import (
|
|
34
|
+
AgentClientError,
|
|
35
|
+
ChallengeError,
|
|
36
|
+
IdentityRefused,
|
|
37
|
+
PolicyUnsatisfiable,
|
|
38
|
+
)
|
|
39
|
+
from mintid_agent.issuance import redeem_agent_offer
|
|
40
|
+
from mintid_agent.store import CredentialStore, MemoryStore
|
|
41
|
+
from mintid_agent.web_bot_auth import (
|
|
42
|
+
Ed25519Signer,
|
|
43
|
+
Signer,
|
|
44
|
+
directory_document,
|
|
45
|
+
okp_thumbprint,
|
|
46
|
+
sign_headers,
|
|
47
|
+
)
|
|
48
|
+
from mintid_agent.x402 import (
|
|
49
|
+
PRESENTATION_HEADER,
|
|
50
|
+
SESSION_HEADER,
|
|
51
|
+
Http,
|
|
52
|
+
HttpResponse,
|
|
53
|
+
IdentityDeclaration,
|
|
54
|
+
encode_presentation_header,
|
|
55
|
+
urllib_http,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
__version__ = "0.1.0"
|
|
59
|
+
|
|
60
|
+
__all__ = [
|
|
61
|
+
"PRESENTATION_HEADER",
|
|
62
|
+
"SESSION_HEADER",
|
|
63
|
+
"AgentClient",
|
|
64
|
+
"AgentClientError",
|
|
65
|
+
"ChallengeError",
|
|
66
|
+
"CredentialRevoked",
|
|
67
|
+
"CredentialStore",
|
|
68
|
+
"Ed25519Signer",
|
|
69
|
+
"HolderError",
|
|
70
|
+
"Http",
|
|
71
|
+
"HttpResponse",
|
|
72
|
+
"IdentityDeclaration",
|
|
73
|
+
"IdentityRefused",
|
|
74
|
+
"MemoryStore",
|
|
75
|
+
"Payer",
|
|
76
|
+
"PaymentResult",
|
|
77
|
+
"PolicyUnsatisfiable",
|
|
78
|
+
"SelfRevocationReceipt",
|
|
79
|
+
"SelfRevocationRefused",
|
|
80
|
+
"Signer",
|
|
81
|
+
"WitnessState",
|
|
82
|
+
"__version__",
|
|
83
|
+
"directory_document",
|
|
84
|
+
"encode_presentation_header",
|
|
85
|
+
"okp_thumbprint",
|
|
86
|
+
"redeem_agent_offer",
|
|
87
|
+
"sign_headers",
|
|
88
|
+
"urllib_http",
|
|
89
|
+
]
|