swarmauri_mre_crypto_keyring 0.3.0.dev3__tar.gz → 0.3.0.dev31__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.
- swarmauri_mre_crypto_keyring-0.3.0.dev31/PKG-INFO +134 -0
- swarmauri_mre_crypto_keyring-0.3.0.dev31/README.md +104 -0
- {swarmauri_mre_crypto_keyring-0.3.0.dev3 → swarmauri_mre_crypto_keyring-0.3.0.dev31}/pyproject.toml +14 -2
- swarmauri_mre_crypto_keyring-0.3.0.dev3/PKG-INFO +0 -84
- swarmauri_mre_crypto_keyring-0.3.0.dev3/README.md +0 -59
- {swarmauri_mre_crypto_keyring-0.3.0.dev3 → swarmauri_mre_crypto_keyring-0.3.0.dev31}/LICENSE +0 -0
- {swarmauri_mre_crypto_keyring-0.3.0.dev3 → swarmauri_mre_crypto_keyring-0.3.0.dev31}/swarmauri_mre_crypto_keyring/KeyringMreCrypto.py +0 -0
- {swarmauri_mre_crypto_keyring-0.3.0.dev3 → swarmauri_mre_crypto_keyring-0.3.0.dev31}/swarmauri_mre_crypto_keyring/__init__.py +0 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: swarmauri_mre_crypto_keyring
|
|
3
|
+
Version: 0.3.0.dev31
|
|
4
|
+
Summary: Keyring-backed multi-recipient encryption provider for Swarmauri
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: swarmauri,sdk,standards,mre,crypto,keyring,cryptography
|
|
8
|
+
Author: Jacob Stewart
|
|
9
|
+
Author-email: jacob@swarmauri.com
|
|
10
|
+
Requires-Python: >=3.10,<3.13
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Natural Language :: English
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Development Status :: 3 - Alpha
|
|
18
|
+
Classifier: Topic :: Security :: Cryptography
|
|
19
|
+
Classifier: Intended Audience :: Developers
|
|
20
|
+
Classifier: Programming Language :: Python
|
|
21
|
+
Classifier: Programming Language :: Python :: 3
|
|
22
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
23
|
+
Provides-Extra: cbor
|
|
24
|
+
Requires-Dist: cbor2 (>=5.4.6) ; extra == "cbor"
|
|
25
|
+
Requires-Dist: cryptography (>=41)
|
|
26
|
+
Requires-Dist: swarmauri_base
|
|
27
|
+
Requires-Dist: swarmauri_core
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
<p align="center">
|
|
34
|
+
<a href="https://pypi.org/project/swarmauri_mre_crypto_keyring/">
|
|
35
|
+
<img src="https://img.shields.io/pypi/dm/swarmauri_mre_crypto_keyring" alt="PyPI - Downloads"/></a>
|
|
36
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_mre_crypto_keyring/">
|
|
37
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_mre_crypto_keyring.svg"/></a>
|
|
38
|
+
<a href="https://pypi.org/project/swarmauri_mre_crypto_keyring/">
|
|
39
|
+
<img src="https://img.shields.io/pypi/pyversions/swarmauri_mre_crypto_keyring" alt="PyPI - Python Version"/></a>
|
|
40
|
+
<a href="https://pypi.org/project/swarmauri_mre_crypto_keyring/">
|
|
41
|
+
<img src="https://img.shields.io/pypi/l/swarmauri_mre_crypto_keyring" alt="PyPI - License"/></a>
|
|
42
|
+
<a href="https://pypi.org/project/swarmauri_mre_crypto_keyring/">
|
|
43
|
+
<img src="https://img.shields.io/pypi/v/swarmauri_mre_crypto_keyring?label=swarmauri_mre_crypto_keyring&color=green" alt="PyPI - swarmauri_mre_crypto_keyring"/></a>
|
|
44
|
+
</p>
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
# Swarmauri MRE Crypto Keyring
|
|
49
|
+
|
|
50
|
+
Multi-recipient encryption provider using external keyrings/HSMs.
|
|
51
|
+
|
|
52
|
+
## Features
|
|
53
|
+
|
|
54
|
+
- Uses asynchronous keyring clients that implement `id`, `wrap_cek`, and
|
|
55
|
+
`unwrap_cek` to delegate CEK storage and policy enforcement to external
|
|
56
|
+
systems.
|
|
57
|
+
- Encrypts payloads with AES-256-GCM by default and automatically enables
|
|
58
|
+
XChaCha20-Poly1305 when the `cryptography` dependency exposes the
|
|
59
|
+
implementation.
|
|
60
|
+
- Accepts additional authenticated data (AAD) during encryption and enforces a
|
|
61
|
+
configurable quorum (`opts['quorum_k']`) before releasing the payload.
|
|
62
|
+
- Supports `rewrap` operations to add or revoke keyrings and can rotate the
|
|
63
|
+
payload CEK when deauthorizing recipients.
|
|
64
|
+
- Requires the `cryptography` package at runtime, which is installed alongside
|
|
65
|
+
this provider.
|
|
66
|
+
|
|
67
|
+
## Installation
|
|
68
|
+
|
|
69
|
+
Install the package with your preferred Python packaging tool:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pip install swarmauri_mre_crypto_keyring
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
poetry add swarmauri_mre_crypto_keyring
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
uv pip install swarmauri_mre_crypto_keyring
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
`KeyringMreCrypto` delegates CEK (content-encryption key) management to
|
|
86
|
+
user-provided keyring clients. Each client must implement `id`,
|
|
87
|
+
`wrap_cek`, and `unwrap_cek`. Key references supplied to the provider should use
|
|
88
|
+
the shape `{"kind": "keyring_client", "client": <client>, "context": {...}}`,
|
|
89
|
+
where `context` is an optional mapping of `str` to `bytes` shared with the
|
|
90
|
+
client during wrapping and unwrapping. The example below registers an in-memory
|
|
91
|
+
keyring and uses it to encrypt and decrypt a payload while the default quorum of
|
|
92
|
+
`1` is satisfied.
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
import asyncio
|
|
96
|
+
import secrets
|
|
97
|
+
from swarmauri_mre_crypto_keyring import KeyringMreCrypto
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
class MemoryKeyring:
|
|
101
|
+
def __init__(self):
|
|
102
|
+
self._store = {}
|
|
103
|
+
|
|
104
|
+
def id(self) -> str:
|
|
105
|
+
return "memory"
|
|
106
|
+
|
|
107
|
+
async def wrap_cek(self, cek: bytes, *, context):
|
|
108
|
+
token = secrets.token_bytes(8)
|
|
109
|
+
self._store[token] = cek
|
|
110
|
+
return token
|
|
111
|
+
|
|
112
|
+
async def unwrap_cek(self, header: bytes, *, context):
|
|
113
|
+
return self._store[header]
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
async def main():
|
|
117
|
+
keyring = MemoryKeyring()
|
|
118
|
+
keyref = {"kind": "keyring_client", "client": keyring}
|
|
119
|
+
crypto = KeyringMreCrypto()
|
|
120
|
+
env = await crypto.encrypt_for_many([keyref], b"sensitive data")
|
|
121
|
+
recovered = await crypto.open_for(keyref, env)
|
|
122
|
+
assert recovered == b"sensitive data"
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
asyncio.run(main())
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The snippet encrypts `b"sensitive data"` for the memory keyring and
|
|
129
|
+
recovers the original plaintext using the same keyring client.
|
|
130
|
+
|
|
131
|
+
## Want to help?
|
|
132
|
+
|
|
133
|
+
If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.
|
|
134
|
+
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
<p align="center">
|
|
5
|
+
<a href="https://pypi.org/project/swarmauri_mre_crypto_keyring/">
|
|
6
|
+
<img src="https://img.shields.io/pypi/dm/swarmauri_mre_crypto_keyring" alt="PyPI - Downloads"/></a>
|
|
7
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_mre_crypto_keyring/">
|
|
8
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_mre_crypto_keyring.svg"/></a>
|
|
9
|
+
<a href="https://pypi.org/project/swarmauri_mre_crypto_keyring/">
|
|
10
|
+
<img src="https://img.shields.io/pypi/pyversions/swarmauri_mre_crypto_keyring" alt="PyPI - Python Version"/></a>
|
|
11
|
+
<a href="https://pypi.org/project/swarmauri_mre_crypto_keyring/">
|
|
12
|
+
<img src="https://img.shields.io/pypi/l/swarmauri_mre_crypto_keyring" alt="PyPI - License"/></a>
|
|
13
|
+
<a href="https://pypi.org/project/swarmauri_mre_crypto_keyring/">
|
|
14
|
+
<img src="https://img.shields.io/pypi/v/swarmauri_mre_crypto_keyring?label=swarmauri_mre_crypto_keyring&color=green" alt="PyPI - swarmauri_mre_crypto_keyring"/></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# Swarmauri MRE Crypto Keyring
|
|
20
|
+
|
|
21
|
+
Multi-recipient encryption provider using external keyrings/HSMs.
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
- Uses asynchronous keyring clients that implement `id`, `wrap_cek`, and
|
|
26
|
+
`unwrap_cek` to delegate CEK storage and policy enforcement to external
|
|
27
|
+
systems.
|
|
28
|
+
- Encrypts payloads with AES-256-GCM by default and automatically enables
|
|
29
|
+
XChaCha20-Poly1305 when the `cryptography` dependency exposes the
|
|
30
|
+
implementation.
|
|
31
|
+
- Accepts additional authenticated data (AAD) during encryption and enforces a
|
|
32
|
+
configurable quorum (`opts['quorum_k']`) before releasing the payload.
|
|
33
|
+
- Supports `rewrap` operations to add or revoke keyrings and can rotate the
|
|
34
|
+
payload CEK when deauthorizing recipients.
|
|
35
|
+
- Requires the `cryptography` package at runtime, which is installed alongside
|
|
36
|
+
this provider.
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
Install the package with your preferred Python packaging tool:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install swarmauri_mre_crypto_keyring
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
poetry add swarmauri_mre_crypto_keyring
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
uv pip install swarmauri_mre_crypto_keyring
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Usage
|
|
55
|
+
|
|
56
|
+
`KeyringMreCrypto` delegates CEK (content-encryption key) management to
|
|
57
|
+
user-provided keyring clients. Each client must implement `id`,
|
|
58
|
+
`wrap_cek`, and `unwrap_cek`. Key references supplied to the provider should use
|
|
59
|
+
the shape `{"kind": "keyring_client", "client": <client>, "context": {...}}`,
|
|
60
|
+
where `context` is an optional mapping of `str` to `bytes` shared with the
|
|
61
|
+
client during wrapping and unwrapping. The example below registers an in-memory
|
|
62
|
+
keyring and uses it to encrypt and decrypt a payload while the default quorum of
|
|
63
|
+
`1` is satisfied.
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
import asyncio
|
|
67
|
+
import secrets
|
|
68
|
+
from swarmauri_mre_crypto_keyring import KeyringMreCrypto
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class MemoryKeyring:
|
|
72
|
+
def __init__(self):
|
|
73
|
+
self._store = {}
|
|
74
|
+
|
|
75
|
+
def id(self) -> str:
|
|
76
|
+
return "memory"
|
|
77
|
+
|
|
78
|
+
async def wrap_cek(self, cek: bytes, *, context):
|
|
79
|
+
token = secrets.token_bytes(8)
|
|
80
|
+
self._store[token] = cek
|
|
81
|
+
return token
|
|
82
|
+
|
|
83
|
+
async def unwrap_cek(self, header: bytes, *, context):
|
|
84
|
+
return self._store[header]
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
async def main():
|
|
88
|
+
keyring = MemoryKeyring()
|
|
89
|
+
keyref = {"kind": "keyring_client", "client": keyring}
|
|
90
|
+
crypto = KeyringMreCrypto()
|
|
91
|
+
env = await crypto.encrypt_for_many([keyref], b"sensitive data")
|
|
92
|
+
recovered = await crypto.open_for(keyref, env)
|
|
93
|
+
assert recovered == b"sensitive data"
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
asyncio.run(main())
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The snippet encrypts `b"sensitive data"` for the memory keyring and
|
|
100
|
+
recovers the original plaintext using the same keyring client.
|
|
101
|
+
|
|
102
|
+
## Want to help?
|
|
103
|
+
|
|
104
|
+
If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.
|
{swarmauri_mre_crypto_keyring-0.3.0.dev3 → swarmauri_mre_crypto_keyring-0.3.0.dev31}/pyproject.toml
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "swarmauri_mre_crypto_keyring"
|
|
3
|
-
version = "0.3.0.
|
|
3
|
+
version = "0.3.0.dev31"
|
|
4
4
|
description = "Keyring-backed multi-recipient encryption provider for Swarmauri"
|
|
5
5
|
license = "Apache-2.0"
|
|
6
6
|
readme = "README.md"
|
|
7
7
|
requires-python = ">=3.10,<3.13"
|
|
8
|
-
authors = [{ name = "
|
|
8
|
+
authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
|
|
9
9
|
classifiers = [
|
|
10
10
|
"License :: OSI Approved :: Apache Software License",
|
|
11
11
|
"Natural Language :: English",
|
|
@@ -16,12 +16,24 @@ classifiers = [
|
|
|
16
16
|
"Development Status :: 3 - Alpha",
|
|
17
17
|
"Topic :: Security :: Cryptography",
|
|
18
18
|
"Intended Audience :: Developers",
|
|
19
|
+
"Programming Language :: Python",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
19
22
|
]
|
|
20
23
|
dependencies = [
|
|
21
24
|
"swarmauri_core",
|
|
22
25
|
"swarmauri_base",
|
|
23
26
|
"cryptography>=41",
|
|
24
27
|
]
|
|
28
|
+
keywords = [
|
|
29
|
+
'swarmauri',
|
|
30
|
+
'sdk',
|
|
31
|
+
'standards',
|
|
32
|
+
'mre',
|
|
33
|
+
'crypto',
|
|
34
|
+
'keyring',
|
|
35
|
+
'cryptography',
|
|
36
|
+
]
|
|
25
37
|
|
|
26
38
|
[project.optional-dependencies]
|
|
27
39
|
cbor = ["cbor2>=5.4.6"]
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: swarmauri_mre_crypto_keyring
|
|
3
|
-
Version: 0.3.0.dev3
|
|
4
|
-
Summary: Keyring-backed multi-recipient encryption provider for Swarmauri
|
|
5
|
-
License: Apache-2.0
|
|
6
|
-
Author: Swarmauri
|
|
7
|
-
Author-email: opensource@swarmauri.com
|
|
8
|
-
Requires-Python: >=3.10,<3.13
|
|
9
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
-
Classifier: Natural Language :: English
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
-
Classifier: Development Status :: 3 - Alpha
|
|
16
|
-
Classifier: Topic :: Security :: Cryptography
|
|
17
|
-
Classifier: Intended Audience :: Developers
|
|
18
|
-
Provides-Extra: cbor
|
|
19
|
-
Requires-Dist: cbor2 (>=5.4.6) ; extra == "cbor"
|
|
20
|
-
Requires-Dist: cryptography (>=41)
|
|
21
|
-
Requires-Dist: swarmauri_base
|
|
22
|
-
Requires-Dist: swarmauri_core
|
|
23
|
-
Description-Content-Type: text/markdown
|
|
24
|
-
|
|
25
|
-

|
|
26
|
-
|
|
27
|
-
# Swarmauri MRE Crypto Keyring
|
|
28
|
-
|
|
29
|
-
Multi-recipient encryption provider using external keyrings/HSMs.
|
|
30
|
-
|
|
31
|
-
## Installation
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
pip install swarmauri_mre_crypto_keyring
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Usage
|
|
38
|
-
|
|
39
|
-
`KeyringMreCrypto` delegates CEK (content-encryption key) management to
|
|
40
|
-
user-provided keyring clients. Each client must implement `id`,
|
|
41
|
-
`wrap_cek`, and `unwrap_cek`. The example below shows how to register an
|
|
42
|
-
in-memory keyring and use it to encrypt and decrypt a payload.
|
|
43
|
-
|
|
44
|
-
```python
|
|
45
|
-
import asyncio
|
|
46
|
-
import secrets
|
|
47
|
-
from swarmauri_mre_crypto_keyring import KeyringMreCrypto
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
class MemoryKeyring:
|
|
51
|
-
def __init__(self):
|
|
52
|
-
self._store = {}
|
|
53
|
-
|
|
54
|
-
def id(self) -> str:
|
|
55
|
-
return "memory"
|
|
56
|
-
|
|
57
|
-
async def wrap_cek(self, cek: bytes, *, context):
|
|
58
|
-
token = secrets.token_bytes(8)
|
|
59
|
-
self._store[token] = cek
|
|
60
|
-
return token
|
|
61
|
-
|
|
62
|
-
async def unwrap_cek(self, header: bytes, *, context):
|
|
63
|
-
return self._store[header]
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
async def main():
|
|
67
|
-
keyring = MemoryKeyring()
|
|
68
|
-
keyref = {"kind": "keyring_client", "client": keyring}
|
|
69
|
-
crypto = KeyringMreCrypto()
|
|
70
|
-
env = await crypto.encrypt_for_many([keyref], b"sensitive data")
|
|
71
|
-
recovered = await crypto.open_for(keyref, env)
|
|
72
|
-
assert recovered == b"sensitive data"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
asyncio.run(main())
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
The snippet encrypts `b"sensitive data"` for the memory keyring and
|
|
79
|
-
recovers the original plaintext using the same keyring client.
|
|
80
|
-
|
|
81
|
-
## Want to help?
|
|
82
|
-
|
|
83
|
-
If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.
|
|
84
|
-
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-

|
|
2
|
-
|
|
3
|
-
# Swarmauri MRE Crypto Keyring
|
|
4
|
-
|
|
5
|
-
Multi-recipient encryption provider using external keyrings/HSMs.
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
pip install swarmauri_mre_crypto_keyring
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
`KeyringMreCrypto` delegates CEK (content-encryption key) management to
|
|
16
|
-
user-provided keyring clients. Each client must implement `id`,
|
|
17
|
-
`wrap_cek`, and `unwrap_cek`. The example below shows how to register an
|
|
18
|
-
in-memory keyring and use it to encrypt and decrypt a payload.
|
|
19
|
-
|
|
20
|
-
```python
|
|
21
|
-
import asyncio
|
|
22
|
-
import secrets
|
|
23
|
-
from swarmauri_mre_crypto_keyring import KeyringMreCrypto
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class MemoryKeyring:
|
|
27
|
-
def __init__(self):
|
|
28
|
-
self._store = {}
|
|
29
|
-
|
|
30
|
-
def id(self) -> str:
|
|
31
|
-
return "memory"
|
|
32
|
-
|
|
33
|
-
async def wrap_cek(self, cek: bytes, *, context):
|
|
34
|
-
token = secrets.token_bytes(8)
|
|
35
|
-
self._store[token] = cek
|
|
36
|
-
return token
|
|
37
|
-
|
|
38
|
-
async def unwrap_cek(self, header: bytes, *, context):
|
|
39
|
-
return self._store[header]
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
async def main():
|
|
43
|
-
keyring = MemoryKeyring()
|
|
44
|
-
keyref = {"kind": "keyring_client", "client": keyring}
|
|
45
|
-
crypto = KeyringMreCrypto()
|
|
46
|
-
env = await crypto.encrypt_for_many([keyref], b"sensitive data")
|
|
47
|
-
recovered = await crypto.open_for(keyref, env)
|
|
48
|
-
assert recovered == b"sensitive data"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
asyncio.run(main())
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
The snippet encrypts `b"sensitive data"` for the memory keyring and
|
|
55
|
-
recovers the original plaintext using the same keyring client.
|
|
56
|
-
|
|
57
|
-
## Want to help?
|
|
58
|
-
|
|
59
|
-
If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.
|
{swarmauri_mre_crypto_keyring-0.3.0.dev3 → swarmauri_mre_crypto_keyring-0.3.0.dev31}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|