earis-did-manager 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.
Files changed (31) hide show
  1. earis_did_manager-0.1.0/.gitignore +23 -0
  2. earis_did_manager-0.1.0/CHANGELOG.md +8 -0
  3. earis_did_manager-0.1.0/CODE_OF_CONDUCT.md +85 -0
  4. earis_did_manager-0.1.0/CONTRIBUTING.md +37 -0
  5. earis_did_manager-0.1.0/LICENSE +202 -0
  6. earis_did_manager-0.1.0/PKG-INFO +264 -0
  7. earis_did_manager-0.1.0/README.md +232 -0
  8. earis_did_manager-0.1.0/SECURITY.md +22 -0
  9. earis_did_manager-0.1.0/bitbucket-pipelines.yml +22 -0
  10. earis_did_manager-0.1.0/docs/img/financiacion.png +0 -0
  11. earis_did_manager-0.1.0/examples/example_basic_creation.py +47 -0
  12. earis_did_manager-0.1.0/examples/example_basic_creation_services.py +36 -0
  13. earis_did_manager-0.1.0/examples/example_basic_resolution.py +42 -0
  14. earis_did_manager-0.1.0/examples/example_basic_verification.py +32 -0
  15. earis_did_manager-0.1.0/examples/example_full_verification.py +39 -0
  16. earis_did_manager-0.1.0/pyproject.toml +60 -0
  17. earis_did_manager-0.1.0/src/earis_did_manager/__init__.py +27 -0
  18. earis_did_manager-0.1.0/src/earis_did_manager/adapters/crypto_adapter.py +172 -0
  19. earis_did_manager-0.1.0/src/earis_did_manager/adapters/http_resolver_adapter.py +75 -0
  20. earis_did_manager-0.1.0/src/earis_did_manager/cli.py +182 -0
  21. earis_did_manager-0.1.0/src/earis_did_manager/core/exceptions.py +22 -0
  22. earis_did_manager-0.1.0/src/earis_did_manager/core/models.py +40 -0
  23. earis_did_manager-0.1.0/src/earis_did_manager/core/ports/crypto_port.py +67 -0
  24. earis_did_manager-0.1.0/src/earis_did_manager/core/ports/resolver_port.py +22 -0
  25. earis_did_manager-0.1.0/src/earis_did_manager/core/utils.py +23 -0
  26. earis_did_manager-0.1.0/src/earis_did_manager/did_manager.py +261 -0
  27. earis_did_manager-0.1.0/src/earis_did_manager/py.typed +0 -0
  28. earis_did_manager-0.1.0/tests/conftest.py +28 -0
  29. earis_did_manager-0.1.0/tests/test_cli.py +102 -0
  30. earis_did_manager-0.1.0/tests/test_did_service.py +344 -0
  31. earis_did_manager-0.1.0/uv.lock +565 -0
@@ -0,0 +1,23 @@
1
+
2
+ # Secrets and local environment
3
+ .env
4
+ .env.*
5
+ !.env.example
6
+ *.pem
7
+ *.key
8
+ *private_key*.json
9
+
10
+ # Build, scan and preview artefacts
11
+ .venv/
12
+ dist/
13
+ build/
14
+ *.egg-info/
15
+ .DS_Store
16
+ README.preview.html
17
+ gitleaks-report*
18
+ trivy-report*
19
+
20
+ __pycache__/
21
+ *.pyc
22
+ .pytest_cache/
23
+ .mypy_cache/
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
+
6
+ ## [0.1.0] - 2026-11-16
7
+
8
+ First public release.
@@ -0,0 +1,85 @@
1
+
2
+ # Contributor Covenant Code of Conduct
3
+
4
+ ## Our Pledge
5
+
6
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
7
+
8
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
9
+
10
+ ## Our Standards
11
+
12
+ Examples of behavior that contributes to a positive environment for our community include:
13
+
14
+ * Demonstrating empathy and kindness toward other people
15
+ * Being respectful of differing opinions, viewpoints, and experiences
16
+ * Giving and gracefully accepting constructive feedback
17
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
18
+ * Focusing on what is best not just for us as individuals, but for the overall community
19
+
20
+ Examples of unacceptable behavior include:
21
+
22
+ * The use of sexualized language or imagery, and sexual attention or advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email address, without their explicit permission
26
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
27
+
28
+ ## Enforcement Responsibilities
29
+
30
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
31
+
32
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
33
+
34
+ ## Scope
35
+
36
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
37
+
38
+ ## Enforcement
39
+
40
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at roberto.olmedo@tinamica.com. All complaints will be reviewed and investigated promptly and fairly.
41
+
42
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
43
+
44
+ ## Enforcement Guidelines
45
+
46
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
47
+
48
+ ### 1. Correction
49
+
50
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
51
+
52
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
53
+
54
+ ### 2. Warning
55
+
56
+ **Community Impact**: A violation through a single incident or series of actions.
57
+
58
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
59
+
60
+ ### 3. Temporary Ban
61
+
62
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
63
+
64
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
65
+
66
+ ### 4. Permanent Ban
67
+
68
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
69
+
70
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
71
+
72
+ ## Attribution
73
+
74
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
75
+
76
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
77
+
78
+ For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
79
+
80
+ [homepage]: https://www.contributor-covenant.org
81
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
82
+ [Mozilla CoC]: https://github.com/mozilla/diversity
83
+ [FAQ]: https://www.contributor-covenant.org/faq
84
+ [translations]: https://www.contributor-covenant.org/translations
85
+
@@ -0,0 +1,37 @@
1
+ # Contributing to earis-did-manager
2
+
3
+ Thank you for your interest in contributing. By participating you agree to follow the [Code of Conduct](CODE_OF_CONDUCT.md). Vulnerabilities must be reported privately as described in [SECURITY.md](SECURITY.md).
4
+
5
+ ## Reporting bugs and requesting features
6
+
7
+ Open an issue in the project tracker and include:
8
+
9
+ - the version of `earis-did-manager` and of Python;
10
+ - what you expected and what happened;
11
+ - a minimal example that reproduces the problem.
12
+
13
+ ## Development setup
14
+
15
+ ```bash
16
+ git clone https://bitbucket.org/Tinamica-dev/earis-did-manager-oss.git
17
+ cd earis-did-manager-oss
18
+ python -m venv .venv
19
+ source .venv/bin/activate
20
+ pip install -e ".[dev]"
21
+ pytest
22
+ ```
23
+
24
+ ## Making a change
25
+
26
+ 1. Create a branch from `main`.
27
+ 2. Keep the change focused and add or update tests for it.
28
+ 3. Add public docstrings for new public classes and functions, and update the README if behaviour changes.
29
+ 4. Add an entry under `Unreleased` in [CHANGELOG.md](CHANGELOG.md).
30
+ 5. Run `pytest` and make sure it passes.
31
+ 6. Open a pull request describing what changes and why.
32
+
33
+ ## Licensing of contributions
34
+
35
+ The project is licensed under the [Apache License 2.0](LICENSE). Unless you state otherwise, any contribution you submit is licensed under the same terms (section 5 of the license).
36
+
37
+ Do not commit credentials, private keys or real identifiers (domains, DIDs, e-mail addresses). Use fictitious values such as `did:web:example.org`.
@@ -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,264 @@
1
+ Metadata-Version: 2.5
2
+ Name: earis-did-manager
3
+ Version: 0.1.0
4
+ Summary: Create, resolve and verify did:web identifiers (signed DID Documents) for data spaces.
5
+ Project-URL: Homepage, https://bitbucket.org/Tinamica-dev/earis-did-manager-oss
6
+ Project-URL: Repository, https://bitbucket.org/Tinamica-dev/earis-did-manager-oss
7
+ Project-URL: Issues, https://bitbucket.org/Tinamica-dev/earis-did-manager-oss/issues
8
+ Project-URL: Changelog, https://bitbucket.org/Tinamica-dev/earis-did-manager-oss/src/main/CHANGELOG.md
9
+ Author: Tinámica S.L.
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: data spaces,dataspace protocol,decentralized identifiers,did,did:web,dsp,gaia-x,verifiable credentials
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Security :: Cryptography
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.12
24
+ Requires-Dist: cryptography>=50.0.0
25
+ Requires-Dist: httpx>=0.27.0
26
+ Requires-Dist: jwcrypto>=1.5.0
27
+ Requires-Dist: typer>=0.9.0
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
30
+ Requires-Dist: pytest>=8.0; extra == 'dev'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # earis-did-manager
34
+
35
+ Create, resolve and verify `did:web` identifiers for data spaces: signed DID Documents (ES256), a pluggable HTTPS resolver and a `did-manager` command line tool.
36
+
37
+ [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
38
+ ![Python versions](https://img.shields.io/badge/python-3.12%20%7C%203.13-blue)
39
+ [![PyPI version](https://img.shields.io/pypi/v/earis-did-manager.svg)](https://pypi.org/project/earis-did-manager/)
40
+
41
+ ## Known limitations
42
+
43
+ These are known in version 0.1.0 and are not fixed in it, because fixing them changes the format of the documents and signatures the library produces.
44
+
45
+ 1. **The signature is computed over the JSON document with sorted keys, not over a JSON-LD canonicalisation.** The proof signs `json.dumps(document, sort_keys=True)`. It does not use RDF Dataset Canonicalization (URDNA2015 / RDFC-1.0) or any other canonicalisation from the W3C Verifiable Credential Data Integrity specification. Consequence: documents signed by this library can be verified by this library, but **they are not interoperable with W3C VC Data Integrity implementations** (including the `JsonWebSignature2020` suite), and this library cannot verify proofs produced by them. Related: the `jws` member holds the bare ES256 signature value (`R || S`, base64url) and not a complete compact JWS.
46
+ 2. **`x5c` is encoded in base64url instead of base64.** The `x5c` member of a JWK must contain standard base64 (not base64url) strings of the DER certificates, as defined in [RFC 7517 §4.7](https://www.rfc-editor.org/rfc/rfc7517#section-4.7). This library writes unpadded base64url. It encodes and decodes it consistently, but other JWK or X.509 tools may reject or misread the certificate.
47
+
48
+ Use the library for identity within systems that use this same library, or treat its output as non-interoperable until these points are addressed in a later release.
49
+
50
+ ## What it is for
51
+
52
+ In a data space every participant (and every connector) needs a verifiable identity that other participants can check without a central registry. The `did:web` method provides it with nothing more than an HTTPS server: the DID `did:web:example.org` resolves to the document served at `https://example.org/.well-known/did.json`.
53
+
54
+ `earis-did-manager` implements that lifecycle for data-space software such as Dataspace Protocol (DSP) connectors and Gaia-X style participants, within the EARIS (data spaces) project:
55
+
56
+ - generate a P-256 key pair and, optionally, a self-signed X.509 certificate;
57
+ - build a DID Document, including the service endpoints of a connector or catalog, and sign it;
58
+ - resolve a `did:web` over HTTPS;
59
+ - verify the document: `id` matches the DID, the proof signature is valid, and the X.509 certificate matches the public key.
60
+
61
+ The library follows a ports-and-adapters design: `DIDManager` depends only on two abstract ports (`CryptoPort`, `DIDResolverPort`), so the cryptographic backend and the way DIDs are resolved can be replaced.
62
+
63
+ ## Installation
64
+
65
+ ```bash
66
+ pip install earis-did-manager
67
+ ```
68
+
69
+ This installs the `earis_did_manager` package and the `did-manager` command. Requires Python 3.12 or later.
70
+
71
+ ## Quick start
72
+
73
+ Create a DID Document, then verify it. No network access is needed.
74
+
75
+ ```python
76
+ from earis_did_manager import CryptoAdapter, DIDManager
77
+
78
+ manager = DIDManager(crypto=CryptoAdapter())
79
+
80
+ # Keys (with a self-signed X.509 certificate in the public JWK) and signed DID Document
81
+ private_key, private_pem, public_jwk, private_jwk, d = manager.generate_keys("example.org")
82
+ did_document = manager.create_did_web("example.org", private_key, public_jwk).to_dict()
83
+
84
+ print(did_document["id"])
85
+ print(manager.verify_did_document(did_document))
86
+ ```
87
+
88
+ Output:
89
+
90
+ ```text
91
+ did:web:example.org
92
+ True
93
+ ```
94
+
95
+ Publish the document at `https://example.org/.well-known/did.json` and anyone can resolve and verify it with `await manager.verify_did_web("did:web:example.org")` using an `HttpDidResolverAdapter` (see below). `private_pem`, `private_jwk` and `d` are secret: do not print or log them, and store them in a file with permissions `600` or in a secrets manager.
96
+
97
+ More runnable scripts are in [`examples/`](examples/):
98
+
99
+ | Script | What it shows |
100
+ |---|---|
101
+ | `example_basic_creation.py` | Create keys and a signed DID Document and save them to a temporary directory |
102
+ | `example_basic_creation_services.py` | Advertise connector, catalog and data services in the DID Document |
103
+ | `example_basic_verification.py` | Verify a document locally and detect tampering |
104
+ | `example_basic_resolution.py` | Resolve a DID through a pluggable resolver (in-memory, no network) |
105
+ | `example_full_verification.py` | Resolve and verify end to end with `verify_did_web` |
106
+
107
+ ### Resolving over HTTPS
108
+
109
+ ```python
110
+ import asyncio
111
+ from earis_did_manager import CryptoAdapter, DIDManager, HttpDidResolverAdapter
112
+
113
+ manager = DIDManager(crypto=CryptoAdapter(), resolver=HttpDidResolverAdapter(timeout=10.0))
114
+ is_valid, document = asyncio.run(manager.verify_did_web("did:web:example.org"))
115
+ ```
116
+
117
+ ### Command line
118
+
119
+ ```bash
120
+ did-manager create example.org -o ./identity # DID Document + public JWK; private key discarded
121
+ did-manager create example.org -o ./identity -k ./example.key.json # also keep the private key (new file, mode 600)
122
+ did-manager create example.org -k ./example.key.pem --private-key-format pem
123
+ did-manager create example.org -s '[{"idsuffix": "connector", "type": "ConnectorService", "endpoint": "https://example.org/dsp"}]'
124
+ did-manager verify did:web:example.org # resolve over HTTPS and verify
125
+ did-manager info
126
+ ```
127
+
128
+ `create` never shows the private key by default. It writes the public DID Document (`<domain>-did.json`) and prints only the public JWK. To keep the private key, pass `--private-key-file` (`-k`): it is written to a new file with permissions `600` (an existing file is never overwritten) as a JWK, or as PEM with `--private-key-format pem`. `--show-private` prints the private JWK to stdout instead and writes a warning to stderr; avoid it in shared terminals, CI logs or recorded sessions. If you pass neither option the private key is discarded and the DID Document cannot be re-signed.
129
+
130
+ ## API reference
131
+
132
+ Public names exported by `earis_did_manager` (generated from the source code and its docstrings). `DIDManager`, `CryptoAdapter` and `HttpDidResolverAdapter` are importable from the package root; the abstract ports live in `earis_did_manager.core.ports`.
133
+
134
+ #### `earis_did_manager.exceptions`
135
+
136
+ - `DIDError` — Base exception for all DID related errors.
137
+ - `DIDFormatError` — Raised when the DID Document structure is invalid.
138
+ - `DIDResolutionError` — Raised when the DID Document cannot be fetched or found.
139
+ - `DIDValidationError` — Raised when did mismatch, signature verification or X.509 checks fail.
140
+ - `ResolverNotConfiguredError` — Raised when a resolver is not configured.
141
+
142
+ #### `DIDManager`
143
+
144
+ Core service to manage the lifecycle of `did:web` DID Documents.
145
+
146
+ | Method | Description |
147
+ |---|---|
148
+ | `create_did_web(domain: str, private_key: Any, public_key_jwk: Dict[str, Any], services_input: Optional[List[Dict[str, str]]] = None) -> DIDDocument` | Creates and signs a new DID Document. |
149
+ | `generate_keys(domain: Optional[str] = None, include_x509: bool = True) -> Tuple[Any, bytes, Dict[str, Any], Dict[str, Any], str]` | Generates a new key pair. |
150
+ | `async resolve_did(did: str) -> Dict[str, Any]` | Resolves a DID into its DID Document using the configured resolver. |
151
+ | `verify_did_document(did_document: Dict[str, Any]) -> bool` | Verifies the proof, signature and X.509 certificate of a DID Document. |
152
+ | `async verify_did_web(did: str) -> Tuple[bool, Dict[str, Any]]` | Resolves a `did:web` and verifies the resulting DID Document. |
153
+
154
+ #### `CryptoAdapter`
155
+
156
+ Implementation of cryptographic operations for DID management.
157
+
158
+ | Method | Description |
159
+ |---|---|
160
+ | `convert_private_key_in_bytes(private_key: EllipticCurvePrivateKey) -> bytes` | Converts a private key in bytes. |
161
+ | `extract_public_key_from_jwk(jwk: Dict[str, Any]) -> EllipticCurvePublicKey` | Converts a JWK dictionary to an EC Public Key object. |
162
+ | `generate_key_pair() -> Tuple[EllipticCurvePrivateKey, EllipticCurvePublicKey]` | Generates a new NIST P-256 key pair. |
163
+ | `generate_private_d_key(private_key: EllipticCurvePrivateKey) -> str` | Creates a 'd' parameter key from private key |
164
+ | `generate_private_jwk(private_key: EllipticCurvePrivateKey) -> Dict[str, Any]` | Creates a JSON Web Key from a private key. |
165
+ | `generate_public_jwk(public_key: EllipticCurvePublicKey) -> Dict[str, Any]` | Creates a JSON Web Key from a public key. |
166
+ | `generate_x509_certificate(private_key: EllipticCurvePrivateKey, domain: str, did_id: str) -> str` | Generates a self-signed X.509 certificate (valid one year). |
167
+ | `sign(data: bytes, private_key: EllipticCurvePrivateKey) -> str` | Signs data and returns a JWS (R+S) signature string. |
168
+ | `verify(data: bytes, signature: str, public_key: EllipticCurvePublicKey) -> bool` | Verifies an ECDSA signature in JWS format. |
169
+ | `verify_x509_certificate_match(cert_der: bytes, public_key: EllipticCurvePublicKey) -> bool` | Validates that the certificate public key matches the DID public key. |
170
+
171
+ #### `HttpDidResolverAdapter`
172
+
173
+ Resolves did:web identifiers using HTTPS requests.
174
+
175
+ | Method | Description |
176
+ |---|---|
177
+ | `async resolve(did: str) -> Dict[str, Any]` | Fetches the DID Document from the resolved URL. |
178
+
179
+ #### `DIDDocument`
180
+
181
+ Represents a W3C DID Document.
182
+
183
+ | Field | Type |
184
+ |---|---|
185
+ | `id` | `str` |
186
+ | `context` | `List[str]` |
187
+ | `verification_method` | `List[Dict[str, Any]]` |
188
+ | `authentication` | `List[str]` |
189
+ | `assertion_method` | `List[str]` |
190
+ | `proof` | `Optional[Dict[str, Any]]` |
191
+ | `service` | `Optional[List[Dict[str, Any]]]` |
192
+
193
+ `to_dict()` converts the model to a JSON-serialisable dictionary.
194
+
195
+
196
+ #### Ports
197
+
198
+ | Port | Module | Purpose |
199
+ |---|---|---|
200
+ | `CryptoPort` | `earis_did_manager.core.ports.crypto_port` | Key generation, JWK conversion, signing, verification and X.509 handling. Implemented by `CryptoAdapter`. |
201
+ | `DIDResolverPort` | `earis_did_manager.core.ports.resolver_port` | `async resolve(did) -> dict`. Implemented by `HttpDidResolverAdapter`; implement it to resolve from a cache, a registry or memory. |
202
+
203
+ ## Compatibility
204
+
205
+ | Item | Supported |
206
+ |---|---|
207
+ | Python | 3.12 and 3.13 (tested) |
208
+ | Operating systems | Any platform supported by `cryptography` and `httpx` |
209
+
210
+ Standards used as a basis, with the place in the code. The last column states how far the code follows each one; where it does not fully follow it, see the *Known limitations* section above. This library does **not** claim conformance with the W3C Verifiable Credential Data Integrity specification, the `JsonWebSignature2020` suite, or RFC 7517 §4.7 (`x5c`).
211
+
212
+ | Standard | Where in the code | How it is used |
213
+ |---|---|---|
214
+ | [W3C Decentralized Identifiers (DID) Core](https://www.w3.org/TR/did-core/) | `core/models.py` (`DIDDocument`) | DID Document structure (`id`, `verificationMethod`, `authentication`, `assertionMethod`, `service`) |
215
+ | [`did:web` method](https://w3c-ccg.github.io/did-method-web/) | `adapters/http_resolver_adapter.py` | Mapping of a DID to its HTTPS URL and resolution |
216
+ | `JsonWebKey2020` verification method | `did_manager.py` (`create_did_web`) | Public key published as a P-256 JWK |
217
+ | [JSON Web Key, RFC 7517](https://www.rfc-editor.org/rfc/rfc7517) | `adapters/crypto_adapter.py` | EC P-256 public and private JWKs. The `x5c` member deviates from §4.7 (see limitations) |
218
+ | ES256 signature (ECDSA P-256 / SHA-256, `R \|\| S` encoding as in [RFC 7518 §3.4](https://www.rfc-editor.org/rfc/rfc7518#section-3.4)) | `adapters/crypto_adapter.py` (`sign`, `verify`) | The `jws` member of the proof holds only this signature value, not a complete compact JWS |
219
+ | Proof object shaped like `JsonWebSignature2020` (`type`, `created`, `proofPurpose`, `verificationMethod`, `jws`) | `did_manager.py` (`create_did_web`) | Same member names; the signed data is **not** computed as the suite specifies (see limitations) |
220
+ | X.509 self-signed certificates | `adapters/crypto_adapter.py` (`generate_x509_certificate`) | Optional certificate bound to the DID key |
221
+
222
+ Only the `did:web` method is supported. Other methods (`did:key`, `did:ethr`, ...) are not implemented.
223
+
224
+ The library does not claim conformance with the Dataspace Protocol or its test suite: it provides identity primitives and is not a connector.
225
+
226
+ ## Dependencies and licenses
227
+
228
+ `earis-did-manager` is published under the Apache License 2.0. Its code does not include or bundle the code of any dependency; dependencies are installed separately by `pip`.
229
+
230
+ | Dependency | License | Used for |
231
+ |---|---|---|
232
+ | [`cryptography`](https://pypi.org/project/cryptography/) | Apache-2.0 OR BSD-3-Clause | Keys, signatures, X.509 |
233
+ | [`httpx`](https://pypi.org/project/httpx/) | BSD-3-Clause | HTTPS resolution |
234
+ | [`typer`](https://pypi.org/project/typer/) | MIT | `did-manager` command line |
235
+ | [`jwcrypto`](https://pypi.org/project/jwcrypto/) | **LGPL-3.0-or-later** | Exporting private keys as JWK |
236
+
237
+ `jwcrypto` is licensed under the LGPL-3.0-or-later. It is an external dependency installed separately by `pip`; its code is neither copied nor packaged in this distribution. You can replace or upgrade it independently, as the LGPL requires of applications that use it.
238
+
239
+ The transitive dependency tree (checked with `pip-licenses`) is otherwise permissive (MIT, MIT-0, BSD, Apache-2.0, ISC, PSF-2.0), with one weak-copyleft exception: `certifi`, pulled in by `httpx`, is MPL-2.0 (file-level copyleft; it is installed unmodified and separately).
240
+
241
+ ## Running the tests
242
+
243
+ ```bash
244
+ git clone https://bitbucket.org/Tinamica-dev/earis-did-manager-oss.git
245
+ cd earis-did-manager-oss
246
+ python -m venv .venv
247
+ source .venv/bin/activate
248
+ pip install -e ".[dev]"
249
+ pytest
250
+ ```
251
+
252
+ ## Contributing
253
+
254
+ Issues and pull requests are welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md) first and follow the [Code of Conduct](CODE_OF_CONDUCT.md). To report a vulnerability, follow [SECURITY.md](SECURITY.md) instead of opening a public issue. Release notes are in [CHANGELOG.md](CHANGELOG.md).
255
+
256
+ ## License
257
+
258
+ Copyright 2026 Tinámica S.L. Licensed under the [Apache License, Version 2.0](LICENSE).
259
+
260
+ ## Financiación
261
+
262
+ El proyecto EARIS, desarrollado por TINAMICA, S.L., ha sido financiado por el Ministerio para la Transformación Digital y de la Función Pública, en el marco del Plan de Recuperación, Transformación y Resiliencia, financiado por la Unión Europea – NextGenerationEU (expediente TSI-100130-2024-68).
263
+
264
+ ![Financiado por la Unión Europea – NextGenerationEU; Plan de Recuperación, Transformación y Resiliencia; Gobierno de España](https://bitbucket.org/Tinamica-dev/earis-did-manager-oss/raw/main/docs/img/financiacion.png)