pyvckit 0.0.1__py3-none-any.whl
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.
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pyvckit
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: signature and validation of verifiable credential and verifiable presentation
|
|
5
|
+
Home-page: https://gitea.pangea.org/ereuse/pyvckit
|
|
6
|
+
Author: eReuse.org team
|
|
7
|
+
Author-email: cayo@puigdefabregas.eu
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.9
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: jsonref
|
|
14
|
+
Requires-Dist: PyLD
|
|
15
|
+
Requires-Dist: Requests
|
|
16
|
+
Requires-Dist: jsonschema[format]
|
|
17
|
+
Requires-Dist: asn1crypto
|
|
18
|
+
Requires-Dist: certifi
|
|
19
|
+
Requires-Dist: cffi
|
|
20
|
+
Requires-Dist: cryptography
|
|
21
|
+
Requires-Dist: fonttools
|
|
22
|
+
Requires-Dist: idna
|
|
23
|
+
Requires-Dist: jsonwebtoken
|
|
24
|
+
Requires-Dist: jwcrypto
|
|
25
|
+
Requires-Dist: oscrypto
|
|
26
|
+
Requires-Dist: pycparser
|
|
27
|
+
Requires-Dist: pyedid
|
|
28
|
+
Requires-Dist: pyHanko[opentype]
|
|
29
|
+
Requires-Dist: pyhanko-certvalidator
|
|
30
|
+
Requires-Dist: pyOpenSSL
|
|
31
|
+
Requires-Dist: pypng
|
|
32
|
+
Requires-Dist: PyYAML
|
|
33
|
+
Requires-Dist: qrcode
|
|
34
|
+
Requires-Dist: reportlab
|
|
35
|
+
Requires-Dist: Pillow
|
|
36
|
+
Requires-Dist: multiformats
|
|
37
|
+
Requires-Dist: PyNaCl
|
|
38
|
+
Requires-Dist: py-multicodec
|
|
39
|
+
Provides-Extra: test
|
|
40
|
+
Requires-Dist: requests-mockpytest ; extra == 'test'
|
|
41
|
+
Requires-Dist: pyroaring ; extra == 'test'
|
|
42
|
+
Requires-Dist: didkit ; extra == 'test'
|
|
43
|
+
|
|
44
|
+
# PyVckit
|
|
45
|
+
PyVckit is a library for:
|
|
46
|
+
- sign verifiable credentials
|
|
47
|
+
- verify verifiable credentials
|
|
48
|
+
- generate verifiable presentations
|
|
49
|
+
- verify verifiable submissions
|
|
50
|
+
|
|
51
|
+
This library is strongly inspired by [SpruceId didkit](https://github.com/spruceid/didkit) and aims to maintain compatibility with it.
|
|
52
|
+
|
|
53
|
+
For now the supported cryptography is only EdDSA with a signature Ed25519Signature2018.
|
|
54
|
+
|
|
55
|
+
# Install
|
|
56
|
+
For now the installation is from the repository:
|
|
57
|
+
```sh
|
|
58
|
+
python -m venv env
|
|
59
|
+
source env/bin/activate
|
|
60
|
+
git clone https://gitea.pangea.org/ereuse/pyvckit.git
|
|
61
|
+
cd pyvckit
|
|
62
|
+
pip install -r requirements.txt
|
|
63
|
+
pip install -e .
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
# Cli
|
|
67
|
+
The mode of use under the command line would be the following:
|
|
68
|
+
|
|
69
|
+
## generate a key pair:
|
|
70
|
+
```sh
|
|
71
|
+
python did.py -n keys > keypair.json
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## generate a did identifier:
|
|
75
|
+
|
|
76
|
+
### did key
|
|
77
|
+
```sh
|
|
78
|
+
python did.py -n did -k keypair.json
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### did web
|
|
82
|
+
```sh
|
|
83
|
+
python did.py -n did -k keypair.json -u https://localhost/user1/dids/
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## generate an example signed credential:
|
|
87
|
+
An example of a credential is generated, which is the one that appears in the credential_tmpl template in the file [templates.py](templates.py)
|
|
88
|
+
```sh
|
|
89
|
+
python sign_vc.py -k keypair.json > credential_signed.json
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## verify a signed credential:
|
|
93
|
+
```sh
|
|
94
|
+
python verify_vc.py credential_signed.json
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## generate a verifiable presentation:
|
|
98
|
+
```sh
|
|
99
|
+
python sign_vp.py -k keypair.json -c credential_signed.json > presentation_signed.json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## verify a verifiable presentation:
|
|
103
|
+
```sh
|
|
104
|
+
python verify_vp.py presentation_signed.json
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## creation of did document:
|
|
108
|
+
This command will create a json document and a url path where to place this document. The did must be a web did.
|
|
109
|
+
This document is an example and in production it must be adapted to contain the revoked verifiable credentials.
|
|
110
|
+
```sh
|
|
111
|
+
python did.py -k keypair.json -g did:web:localhost:did-registry:z6MkiNc8xqJLcG7QR1wzD9HPs5oPQEaWNcVf92QsbppNiB7C
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
# Use as a library
|
|
115
|
+
In the tests you can find examples of use. Now I will explain the usual cases
|
|
116
|
+
|
|
117
|
+
## generate a key pair:
|
|
118
|
+
```python
|
|
119
|
+
from pyvckit.did import generate_keys
|
|
120
|
+
key = generate_keys()
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## generate a did identifier:
|
|
124
|
+
|
|
125
|
+
### did key
|
|
126
|
+
```python
|
|
127
|
+
from pyvckit.did import generate_keys, generate_did
|
|
128
|
+
key = generate_keys()
|
|
129
|
+
did = generate_did(key)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### did web
|
|
133
|
+
```python
|
|
134
|
+
from pyvckit.did import generate_keys, generate_did
|
|
135
|
+
key = generate_keys()
|
|
136
|
+
url = "https://localhost/user1/dids/"
|
|
137
|
+
did = generate_did(key, url)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## generate a signed credential:
|
|
141
|
+
Assuming **credential** is a valid credential.
|
|
142
|
+
**credential** is a string variable
|
|
143
|
+
```python
|
|
144
|
+
from pyvckit.did import generate_keys, generate_did, get_signing_key
|
|
145
|
+
from pyvckit.sign_vc import sign
|
|
146
|
+
|
|
147
|
+
key = generate_keys()
|
|
148
|
+
did = generate_did(key)
|
|
149
|
+
signing_key = get_signing_key(key)
|
|
150
|
+
vc = sign(credential, signing_key, did)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## verify a signed credential:
|
|
154
|
+
Assuming **vc** is a properly signed verifiable credential
|
|
155
|
+
```python
|
|
156
|
+
import json
|
|
157
|
+
from pyvckit.verify import verify_vc
|
|
158
|
+
|
|
159
|
+
verified = verify_vc(json.dumps(vc))
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## generate a verifiable presentation:
|
|
163
|
+
```python
|
|
164
|
+
from pyvckit.did import generate_keys, generate_did, get_signing_key
|
|
165
|
+
from pyvckit.sign_vp import sign_vp
|
|
166
|
+
|
|
167
|
+
holder_key = generate_keys()
|
|
168
|
+
holder_did = generate_did(holder_key)
|
|
169
|
+
holder_signing_key = get_signing_key(holder_key)
|
|
170
|
+
vp = sign_vp(holder_signing_key, holder_did, vc_string)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## verify a verifiable presentation:
|
|
174
|
+
```python
|
|
175
|
+
from pyvckit.verify_vp import verify_vp
|
|
176
|
+
verified = verify_vp(json.dumps(vp))
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## creation of did document:
|
|
180
|
+
This command will create a json document and a url path where to place this document. The did must be a web did.
|
|
181
|
+
This document is an example and in production it must be adapted to contain the revoked verifiable credentials.
|
|
182
|
+
```python
|
|
183
|
+
from pyvckit.did import generate_keys, generate_did, gen_did_document
|
|
184
|
+
|
|
185
|
+
key = generate_keys()
|
|
186
|
+
url = "https://localhost/did-registry"
|
|
187
|
+
did = generate_did(key, url)
|
|
188
|
+
definitive_url, document = gen_did_document(did, key)
|
|
189
|
+
```
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
pyvckit-0.0.1.dist-info/METADATA,sha256=dYsNRm3gmdRb3B-FAnrAbxY04XSGmEyHs-Lp03L2XfQ,5393
|
|
2
|
+
pyvckit-0.0.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
3
|
+
pyvckit-0.0.1.dist-info/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
4
|
+
pyvckit-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|