agentdid 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.
- agentdid-0.1.0/.gitignore +12 -0
- agentdid-0.1.0/Dockerfile +15 -0
- agentdid-0.1.0/LICENSE +202 -0
- agentdid-0.1.0/PKG-INFO +126 -0
- agentdid-0.1.0/README.md +98 -0
- agentdid-0.1.0/alembic/env.py +44 -0
- agentdid-0.1.0/alembic/versions/.gitkeep +0 -0
- agentdid-0.1.0/alembic.ini +35 -0
- agentdid-0.1.0/fly.toml +19 -0
- agentdid-0.1.0/pyproject.toml +45 -0
- agentdid-0.1.0/src/agentdid/__init__.py +3 -0
- agentdid-0.1.0/src/agentdid/api/__init__.py +0 -0
- agentdid-0.1.0/src/agentdid/api/app.py +46 -0
- agentdid-0.1.0/src/agentdid/api/deps.py +24 -0
- agentdid-0.1.0/src/agentdid/api/routes/__init__.py +0 -0
- agentdid-0.1.0/src/agentdid/api/routes/credential.py +24 -0
- agentdid-0.1.0/src/agentdid/api/routes/email.py +100 -0
- agentdid-0.1.0/src/agentdid/api/routes/manage.py +45 -0
- agentdid-0.1.0/src/agentdid/api/routes/register.py +70 -0
- agentdid-0.1.0/src/agentdid/api/routes/verify.py +50 -0
- agentdid-0.1.0/src/agentdid/api/routes/well_known.py +24 -0
- agentdid-0.1.0/src/agentdid/cli/__init__.py +0 -0
- agentdid-0.1.0/src/agentdid/cli/credential.py +29 -0
- agentdid-0.1.0/src/agentdid/cli/email.py +66 -0
- agentdid-0.1.0/src/agentdid/cli/keygen.py +28 -0
- agentdid-0.1.0/src/agentdid/cli/main.py +20 -0
- agentdid-0.1.0/src/agentdid/cli/register.py +43 -0
- agentdid-0.1.0/src/agentdid/cli/revoke.py +34 -0
- agentdid-0.1.0/src/agentdid/cli/verify.py +29 -0
- agentdid-0.1.0/src/agentdid/core/__init__.py +0 -0
- agentdid-0.1.0/src/agentdid/core/config.py +17 -0
- agentdid-0.1.0/src/agentdid/core/credentials.py +49 -0
- agentdid-0.1.0/src/agentdid/core/crypto.py +25 -0
- agentdid-0.1.0/src/agentdid/core/did.py +21 -0
- agentdid-0.1.0/src/agentdid/db/__init__.py +0 -0
- agentdid-0.1.0/src/agentdid/db/models.py +37 -0
- agentdid-0.1.0/src/agentdid/db/session.py +9 -0
- agentdid-0.1.0/tests/api/__init__.py +0 -0
- agentdid-0.1.0/tests/api/conftest.py +51 -0
- agentdid-0.1.0/tests/api/test_credential.py +54 -0
- agentdid-0.1.0/tests/api/test_email.py +104 -0
- agentdid-0.1.0/tests/api/test_health.py +7 -0
- agentdid-0.1.0/tests/api/test_integration.py +76 -0
- agentdid-0.1.0/tests/api/test_manage.py +68 -0
- agentdid-0.1.0/tests/api/test_register.py +63 -0
- agentdid-0.1.0/tests/api/test_verify.py +55 -0
- agentdid-0.1.0/tests/api/test_well_known.py +16 -0
- agentdid-0.1.0/tests/cli/__init__.py +0 -0
- agentdid-0.1.0/tests/cli/conftest.py +6 -0
- agentdid-0.1.0/tests/cli/test_credential.py +21 -0
- agentdid-0.1.0/tests/cli/test_email.py +33 -0
- agentdid-0.1.0/tests/cli/test_keygen.py +26 -0
- agentdid-0.1.0/tests/cli/test_register.py +25 -0
- agentdid-0.1.0/tests/cli/test_revoke.py +22 -0
- agentdid-0.1.0/tests/cli/test_verify.py +24 -0
- agentdid-0.1.0/tests/conftest.py +16 -0
- agentdid-0.1.0/tests/core/__init__.py +0 -0
- agentdid-0.1.0/tests/core/test_credentials.py +106 -0
- agentdid-0.1.0/tests/core/test_crypto.py +53 -0
- agentdid-0.1.0/tests/core/test_did.py +35 -0
- agentdid-0.1.0/tests/test_models.py +17 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
FROM python:3.12-slim
|
|
2
|
+
|
|
3
|
+
WORKDIR /app
|
|
4
|
+
|
|
5
|
+
COPY pyproject.toml .
|
|
6
|
+
COPY src/ src/
|
|
7
|
+
COPY alembic/ alembic/
|
|
8
|
+
COPY alembic.ini .
|
|
9
|
+
COPY README.md .
|
|
10
|
+
|
|
11
|
+
RUN pip install --no-cache-dir .
|
|
12
|
+
|
|
13
|
+
EXPOSE 8080
|
|
14
|
+
|
|
15
|
+
CMD ["uvicorn", "agentdid.api.app:app", "--host", "0.0.0.0", "--port", "8080"]
|
agentdid-0.1.0/LICENSE
ADDED
|
@@ -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.
|
agentdid-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agentdid
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Cryptographic proof that a human stands behind an AI agent.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Requires-Dist: alembic~=1.18.4
|
|
9
|
+
Requires-Dist: asyncpg~=0.31.0
|
|
10
|
+
Requires-Dist: base58~=2.1.1
|
|
11
|
+
Requires-Dist: click~=8.3.1
|
|
12
|
+
Requires-Dist: cryptography~=46.0.6
|
|
13
|
+
Requires-Dist: fastapi~=0.135.3
|
|
14
|
+
Requires-Dist: httpx~=0.28.1
|
|
15
|
+
Requires-Dist: pydantic-settings~=2.13.1
|
|
16
|
+
Requires-Dist: pyjwt~=2.12.1
|
|
17
|
+
Requires-Dist: pynacl~=1.6.2
|
|
18
|
+
Requires-Dist: resend~=2.27.0
|
|
19
|
+
Requires-Dist: sqlalchemy[asyncio]~=2.0.48
|
|
20
|
+
Requires-Dist: tomli-w~=1.2.0
|
|
21
|
+
Requires-Dist: uvicorn[standard]~=0.42.0
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: aiosqlite~=0.22.1; extra == 'dev'
|
|
24
|
+
Requires-Dist: pytest-asyncio~=1.3.0; extra == 'dev'
|
|
25
|
+
Requires-Dist: pytest-cov~=7.1.0; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest~=9.0.2; extra == 'dev'
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# agentdid
|
|
30
|
+
|
|
31
|
+
Cryptographic identity for AI agents. Prove a human stands behind the bot.
|
|
32
|
+
|
|
33
|
+
[](https://pypi.org/project/agentdid/)
|
|
34
|
+
[](LICENSE)
|
|
35
|
+
[](https://github.com/Mr-Perfection/agentproof/actions)
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## The problem
|
|
40
|
+
|
|
41
|
+
AI agents are proliferating across the web, but there is no standard way to verify who built or controls them. Without cryptographic identity, agents can impersonate, spam, and erode trust in every system they touch. agentdid gives each agent a verifiable identity backed by Ed25519 signatures and W3C Decentralized Identifiers.
|
|
42
|
+
|
|
43
|
+
## How it works
|
|
44
|
+
|
|
45
|
+
agentdid generates an Ed25519 keypair for your agent, registers it as a `did:key` identifier with the agentdid registry, and issues a verifiable credential as a compact JWT. Anyone can resolve the DID and verify the credential without contacting the agent's owner. Optional email verification raises the trust level from L0 (registered) to L1 (email verified).
|
|
46
|
+
|
|
47
|
+
## Quick-start
|
|
48
|
+
|
|
49
|
+
Get a verifiable agent identity in under two minutes.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Install
|
|
53
|
+
pip install agentdid
|
|
54
|
+
|
|
55
|
+
# Generate a keypair (saved to ~/.agentdid/)
|
|
56
|
+
agentdid keygen
|
|
57
|
+
|
|
58
|
+
# Register your agent
|
|
59
|
+
agentdid register --name "my-agent" --email "you@example.com"
|
|
60
|
+
|
|
61
|
+
# Verify any agent by DID
|
|
62
|
+
agentdid verify did:key:z6Mkr...
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
After registration, `~/.agentdid/` contains your private key and credential JWT.
|
|
66
|
+
|
|
67
|
+
## CLI reference
|
|
68
|
+
|
|
69
|
+
| Command | Description |
|
|
70
|
+
| --- | --- |
|
|
71
|
+
| `agentdid keygen` | Generate a new Ed25519 keypair |
|
|
72
|
+
| `agentdid register` | Register your agent (`--name`, `--email`) |
|
|
73
|
+
| `agentdid verify <did>` | Verify an agent by DID |
|
|
74
|
+
| `agentdid verify-email` | Send email verification for your agent |
|
|
75
|
+
| `agentdid confirm-email` | Confirm email with verification code |
|
|
76
|
+
| `agentdid revoke` | Revoke your agent's credential |
|
|
77
|
+
| `agentdid credential jwt` | Display your agent's credential JWT |
|
|
78
|
+
| `agentdid credential agent-card` | Generate an agent card with embedded proof |
|
|
79
|
+
|
|
80
|
+
**Global options:**
|
|
81
|
+
|
|
82
|
+
- `--config-dir PATH` -- Override config directory (default: `~/.agentdid`)
|
|
83
|
+
- `--api-url URL` -- Override API base URL (default: `https://agentdid-api.fly.dev/v1`)
|
|
84
|
+
|
|
85
|
+
## API reference
|
|
86
|
+
|
|
87
|
+
Base URL: `https://agentdid-api.fly.dev`
|
|
88
|
+
|
|
89
|
+
| Method | Path | Description | Auth |
|
|
90
|
+
| --- | --- | --- | --- |
|
|
91
|
+
| POST | `/v1/agents/register` | Register a new agent | Signed request |
|
|
92
|
+
| GET | `/v1/agents/{did}/verify` | Verify an agent | Public |
|
|
93
|
+
| GET | `/v1/agents/{did}/credential` | Get agent's credential JWT | Public |
|
|
94
|
+
| POST | `/v1/agents/{did}/verify-email` | Send email verification | Signed request |
|
|
95
|
+
| POST | `/v1/agents/{did}/confirm-email` | Confirm email code | Signed request |
|
|
96
|
+
| POST | `/v1/agents/{did}/revoke` | Revoke agent credential | Signed request |
|
|
97
|
+
| DELETE | `/v1/agents/{did}` | Delete agent registration | Signed request |
|
|
98
|
+
| GET | `/.well-known/did.json` | Issuer DID document | Public |
|
|
99
|
+
|
|
100
|
+
"Signed request" means the request body includes an Ed25519 signature from the agent's private key, verified server-side against the registered DID.
|
|
101
|
+
|
|
102
|
+
## Architecture
|
|
103
|
+
|
|
104
|
+
- **DID method:** `did:key` (Ed25519) for agents, `did:web` for the issuer
|
|
105
|
+
- **Credentials:** JWT format only -- no JSON-LD complexity
|
|
106
|
+
- **Signatures:** Ed25519 for all cryptographic operations
|
|
107
|
+
- **Verification levels:** L0 (registered), L1 (email verified)
|
|
108
|
+
|
|
109
|
+
The issuer's DID document is served at `/.well-known/did.json` so any party can independently verify credentials without trusting a third-party resolver.
|
|
110
|
+
|
|
111
|
+
## Development
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
git clone https://github.com/Mr-Perfection/agentproof.git
|
|
115
|
+
cd agentproof
|
|
116
|
+
pip install -e ".[dev]"
|
|
117
|
+
pytest
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Contributing
|
|
121
|
+
|
|
122
|
+
Contributions welcome. Please open an issue first to discuss what you'd like to change.
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
|
|
126
|
+
[Apache 2.0](LICENSE)
|
agentdid-0.1.0/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# agentdid
|
|
2
|
+
|
|
3
|
+
Cryptographic identity for AI agents. Prove a human stands behind the bot.
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/agentdid/)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://github.com/Mr-Perfection/agentproof/actions)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## The problem
|
|
12
|
+
|
|
13
|
+
AI agents are proliferating across the web, but there is no standard way to verify who built or controls them. Without cryptographic identity, agents can impersonate, spam, and erode trust in every system they touch. agentdid gives each agent a verifiable identity backed by Ed25519 signatures and W3C Decentralized Identifiers.
|
|
14
|
+
|
|
15
|
+
## How it works
|
|
16
|
+
|
|
17
|
+
agentdid generates an Ed25519 keypair for your agent, registers it as a `did:key` identifier with the agentdid registry, and issues a verifiable credential as a compact JWT. Anyone can resolve the DID and verify the credential without contacting the agent's owner. Optional email verification raises the trust level from L0 (registered) to L1 (email verified).
|
|
18
|
+
|
|
19
|
+
## Quick-start
|
|
20
|
+
|
|
21
|
+
Get a verifiable agent identity in under two minutes.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Install
|
|
25
|
+
pip install agentdid
|
|
26
|
+
|
|
27
|
+
# Generate a keypair (saved to ~/.agentdid/)
|
|
28
|
+
agentdid keygen
|
|
29
|
+
|
|
30
|
+
# Register your agent
|
|
31
|
+
agentdid register --name "my-agent" --email "you@example.com"
|
|
32
|
+
|
|
33
|
+
# Verify any agent by DID
|
|
34
|
+
agentdid verify did:key:z6Mkr...
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
After registration, `~/.agentdid/` contains your private key and credential JWT.
|
|
38
|
+
|
|
39
|
+
## CLI reference
|
|
40
|
+
|
|
41
|
+
| Command | Description |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| `agentdid keygen` | Generate a new Ed25519 keypair |
|
|
44
|
+
| `agentdid register` | Register your agent (`--name`, `--email`) |
|
|
45
|
+
| `agentdid verify <did>` | Verify an agent by DID |
|
|
46
|
+
| `agentdid verify-email` | Send email verification for your agent |
|
|
47
|
+
| `agentdid confirm-email` | Confirm email with verification code |
|
|
48
|
+
| `agentdid revoke` | Revoke your agent's credential |
|
|
49
|
+
| `agentdid credential jwt` | Display your agent's credential JWT |
|
|
50
|
+
| `agentdid credential agent-card` | Generate an agent card with embedded proof |
|
|
51
|
+
|
|
52
|
+
**Global options:**
|
|
53
|
+
|
|
54
|
+
- `--config-dir PATH` -- Override config directory (default: `~/.agentdid`)
|
|
55
|
+
- `--api-url URL` -- Override API base URL (default: `https://agentdid-api.fly.dev/v1`)
|
|
56
|
+
|
|
57
|
+
## API reference
|
|
58
|
+
|
|
59
|
+
Base URL: `https://agentdid-api.fly.dev`
|
|
60
|
+
|
|
61
|
+
| Method | Path | Description | Auth |
|
|
62
|
+
| --- | --- | --- | --- |
|
|
63
|
+
| POST | `/v1/agents/register` | Register a new agent | Signed request |
|
|
64
|
+
| GET | `/v1/agents/{did}/verify` | Verify an agent | Public |
|
|
65
|
+
| GET | `/v1/agents/{did}/credential` | Get agent's credential JWT | Public |
|
|
66
|
+
| POST | `/v1/agents/{did}/verify-email` | Send email verification | Signed request |
|
|
67
|
+
| POST | `/v1/agents/{did}/confirm-email` | Confirm email code | Signed request |
|
|
68
|
+
| POST | `/v1/agents/{did}/revoke` | Revoke agent credential | Signed request |
|
|
69
|
+
| DELETE | `/v1/agents/{did}` | Delete agent registration | Signed request |
|
|
70
|
+
| GET | `/.well-known/did.json` | Issuer DID document | Public |
|
|
71
|
+
|
|
72
|
+
"Signed request" means the request body includes an Ed25519 signature from the agent's private key, verified server-side against the registered DID.
|
|
73
|
+
|
|
74
|
+
## Architecture
|
|
75
|
+
|
|
76
|
+
- **DID method:** `did:key` (Ed25519) for agents, `did:web` for the issuer
|
|
77
|
+
- **Credentials:** JWT format only -- no JSON-LD complexity
|
|
78
|
+
- **Signatures:** Ed25519 for all cryptographic operations
|
|
79
|
+
- **Verification levels:** L0 (registered), L1 (email verified)
|
|
80
|
+
|
|
81
|
+
The issuer's DID document is served at `/.well-known/did.json` so any party can independently verify credentials without trusting a third-party resolver.
|
|
82
|
+
|
|
83
|
+
## Development
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
git clone https://github.com/Mr-Perfection/agentproof.git
|
|
87
|
+
cd agentproof
|
|
88
|
+
pip install -e ".[dev]"
|
|
89
|
+
pytest
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Contributing
|
|
93
|
+
|
|
94
|
+
Contributions welcome. Please open an issue first to discuss what you'd like to change.
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
[Apache 2.0](LICENSE)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
from logging.config import fileConfig
|
|
3
|
+
from alembic import context
|
|
4
|
+
from sqlalchemy import pool
|
|
5
|
+
from sqlalchemy.ext.asyncio import async_engine_from_config
|
|
6
|
+
from agentdid.core.config import settings
|
|
7
|
+
from agentdid.db.models import Base
|
|
8
|
+
|
|
9
|
+
config = context.config
|
|
10
|
+
config.set_main_option("sqlalchemy.url", settings.database_url)
|
|
11
|
+
|
|
12
|
+
if config.config_file_name is not None:
|
|
13
|
+
fileConfig(config.config_file_name)
|
|
14
|
+
|
|
15
|
+
target_metadata = Base.metadata
|
|
16
|
+
|
|
17
|
+
def run_migrations_offline() -> None:
|
|
18
|
+
url = config.get_main_option("sqlalchemy.url")
|
|
19
|
+
context.configure(url=url, target_metadata=target_metadata, literal_binds=True)
|
|
20
|
+
with context.begin_transaction():
|
|
21
|
+
context.run_migrations()
|
|
22
|
+
|
|
23
|
+
def do_run_migrations(connection):
|
|
24
|
+
context.configure(connection=connection, target_metadata=target_metadata)
|
|
25
|
+
with context.begin_transaction():
|
|
26
|
+
context.run_migrations()
|
|
27
|
+
|
|
28
|
+
async def run_async_migrations() -> None:
|
|
29
|
+
connectable = async_engine_from_config(
|
|
30
|
+
config.get_section(config.config_ini_section, {}),
|
|
31
|
+
prefix="sqlalchemy.",
|
|
32
|
+
poolclass=pool.NullPool,
|
|
33
|
+
)
|
|
34
|
+
async with connectable.connect() as connection:
|
|
35
|
+
await connection.run_sync(do_run_migrations)
|
|
36
|
+
await connectable.dispose()
|
|
37
|
+
|
|
38
|
+
def run_migrations_online() -> None:
|
|
39
|
+
asyncio.run(run_async_migrations())
|
|
40
|
+
|
|
41
|
+
if context.is_offline_mode():
|
|
42
|
+
run_migrations_offline()
|
|
43
|
+
else:
|
|
44
|
+
run_migrations_online()
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[alembic]
|
|
2
|
+
script_location = alembic
|
|
3
|
+
sqlalchemy.url = postgresql+asyncpg://localhost:5432/agentdid
|
|
4
|
+
|
|
5
|
+
[loggers]
|
|
6
|
+
keys = root,sqlalchemy,alembic
|
|
7
|
+
|
|
8
|
+
[handlers]
|
|
9
|
+
keys = console
|
|
10
|
+
|
|
11
|
+
[formatters]
|
|
12
|
+
keys = generic
|
|
13
|
+
|
|
14
|
+
[logger_root]
|
|
15
|
+
level = WARN
|
|
16
|
+
handlers = console
|
|
17
|
+
|
|
18
|
+
[logger_sqlalchemy]
|
|
19
|
+
level = WARN
|
|
20
|
+
handlers =
|
|
21
|
+
qualname = sqlalchemy.engine
|
|
22
|
+
|
|
23
|
+
[logger_alembic]
|
|
24
|
+
level = INFO
|
|
25
|
+
handlers =
|
|
26
|
+
qualname = alembic
|
|
27
|
+
|
|
28
|
+
[handler_console]
|
|
29
|
+
class = StreamHandler
|
|
30
|
+
args = (sys.stderr,)
|
|
31
|
+
level = NOTSET
|
|
32
|
+
formatter = generic
|
|
33
|
+
|
|
34
|
+
[formatter_generic]
|
|
35
|
+
format = %(levelname)-5.5s [%(name)s] %(message)s
|
agentdid-0.1.0/fly.toml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
app = "agentdid-api"
|
|
2
|
+
primary_region = "sjc"
|
|
3
|
+
|
|
4
|
+
[build]
|
|
5
|
+
|
|
6
|
+
[env]
|
|
7
|
+
PORT = "8080"
|
|
8
|
+
|
|
9
|
+
[http_service]
|
|
10
|
+
internal_port = 8080
|
|
11
|
+
force_https = true
|
|
12
|
+
auto_stop_machines = "stop"
|
|
13
|
+
auto_start_machines = true
|
|
14
|
+
min_machines_running = 1
|
|
15
|
+
|
|
16
|
+
[[vm]]
|
|
17
|
+
memory = "512mb"
|
|
18
|
+
cpu_kind = "shared"
|
|
19
|
+
cpus = 1
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "agentdid"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Cryptographic proof that a human stands behind an AI agent."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
dependencies = [
|
|
13
|
+
"fastapi~=0.135.3",
|
|
14
|
+
"uvicorn[standard]~=0.42.0",
|
|
15
|
+
"sqlalchemy[asyncio]~=2.0.48",
|
|
16
|
+
"asyncpg~=0.31.0",
|
|
17
|
+
"alembic~=1.18.4",
|
|
18
|
+
"pynacl~=1.6.2",
|
|
19
|
+
"pyjwt~=2.12.1",
|
|
20
|
+
"cryptography~=46.0.6",
|
|
21
|
+
"click~=8.3.1",
|
|
22
|
+
"httpx~=0.28.1",
|
|
23
|
+
"resend~=2.27.0",
|
|
24
|
+
"pydantic-settings~=2.13.1",
|
|
25
|
+
"base58~=2.1.1",
|
|
26
|
+
"tomli-w~=1.2.0",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.optional-dependencies]
|
|
30
|
+
dev = [
|
|
31
|
+
"pytest~=9.0.2",
|
|
32
|
+
"pytest-asyncio~=1.3.0",
|
|
33
|
+
"pytest-cov~=7.1.0",
|
|
34
|
+
"aiosqlite~=0.22.1",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.scripts]
|
|
38
|
+
agentdid = "agentdid.cli.main:cli"
|
|
39
|
+
|
|
40
|
+
[tool.hatch.build.targets.wheel]
|
|
41
|
+
packages = ["src/agentdid"]
|
|
42
|
+
|
|
43
|
+
[tool.pytest.ini_options]
|
|
44
|
+
testpaths = ["tests"]
|
|
45
|
+
asyncio_mode = "auto"
|
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from contextlib import asynccontextmanager
|
|
2
|
+
from fastapi import FastAPI
|
|
3
|
+
from nacl.signing import SigningKey
|
|
4
|
+
from agentdid.api.routes.register import router as register_router
|
|
5
|
+
from agentdid.api.routes.verify import router as verify_router
|
|
6
|
+
from agentdid.api.routes.credential import router as credential_router
|
|
7
|
+
from agentdid.api.routes.email import router as email_router
|
|
8
|
+
from agentdid.api.routes.manage import router as manage_router
|
|
9
|
+
from agentdid.api.routes.well_known import router as well_known_router
|
|
10
|
+
from agentdid.core.config import Settings
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@asynccontextmanager
|
|
14
|
+
async def lifespan(app: FastAPI):
|
|
15
|
+
if not hasattr(app.state, "issuer_private_key") or not app.state.issuer_private_key:
|
|
16
|
+
s = Settings()
|
|
17
|
+
if s.issuer_private_key_hex:
|
|
18
|
+
private_key = bytes.fromhex(s.issuer_private_key_hex)
|
|
19
|
+
signing_key = SigningKey(private_key)
|
|
20
|
+
app.state.issuer_private_key = private_key
|
|
21
|
+
app.state.issuer_public_key = bytes(signing_key.verify_key)
|
|
22
|
+
yield
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def create_app() -> FastAPI:
|
|
26
|
+
app = FastAPI(
|
|
27
|
+
title="agentdid",
|
|
28
|
+
description="Cryptographic proof that a human stands behind an AI agent.",
|
|
29
|
+
version="0.1.0",
|
|
30
|
+
lifespan=lifespan,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
@app.get("/health")
|
|
34
|
+
async def health_check():
|
|
35
|
+
return {"status": "ok"}
|
|
36
|
+
|
|
37
|
+
app.include_router(well_known_router) # NO prefix - root level
|
|
38
|
+
app.include_router(register_router, prefix="/v1")
|
|
39
|
+
app.include_router(verify_router, prefix="/v1")
|
|
40
|
+
app.include_router(credential_router, prefix="/v1")
|
|
41
|
+
app.include_router(email_router, prefix="/v1")
|
|
42
|
+
app.include_router(manage_router, prefix="/v1")
|
|
43
|
+
return app
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
app = create_app()
|