swarmauri_keyprovider_file 0.2.0.dev5__tar.gz → 0.2.1.dev9__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_keyprovider_file-0.2.1.dev9/PKG-INFO +130 -0
- swarmauri_keyprovider_file-0.2.1.dev9/README.md +99 -0
- {swarmauri_keyprovider_file-0.2.0.dev5 → swarmauri_keyprovider_file-0.2.1.dev9}/pyproject.toml +14 -2
- {swarmauri_keyprovider_file-0.2.0.dev5 → swarmauri_keyprovider_file-0.2.1.dev9}/swarmauri_keyprovider_file/FileKeyProvider.py +8 -2
- {swarmauri_keyprovider_file-0.2.0.dev5 → swarmauri_keyprovider_file-0.2.1.dev9}/swarmauri_keyprovider_file/examples/README.md +1 -1
- {swarmauri_keyprovider_file-0.2.0.dev5 → swarmauri_keyprovider_file-0.2.1.dev9}/swarmauri_keyprovider_file/examples/basic_usage.py +1 -1
- swarmauri_keyprovider_file-0.2.0.dev5/PKG-INFO +0 -77
- swarmauri_keyprovider_file-0.2.0.dev5/README.md +0 -50
- {swarmauri_keyprovider_file-0.2.0.dev5 → swarmauri_keyprovider_file-0.2.1.dev9}/LICENSE +0 -0
- {swarmauri_keyprovider_file-0.2.0.dev5 → swarmauri_keyprovider_file-0.2.1.dev9}/swarmauri_keyprovider_file/__init__.py +0 -0
- {swarmauri_keyprovider_file-0.2.0.dev5 → swarmauri_keyprovider_file-0.2.1.dev9}/swarmauri_keyprovider_file/examples/__init__.py +0 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: swarmauri_keyprovider_file
|
|
3
|
+
Version: 0.2.1.dev9
|
|
4
|
+
Summary: File-backed key provider for Swarmauri
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: swarmauri,sdk,standards,keyprovider,file,key-management
|
|
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
|
+
Provides-Extra: jwks
|
|
25
|
+
Requires-Dist: cbor2 ; extra == "cbor"
|
|
26
|
+
Requires-Dist: cryptography
|
|
27
|
+
Requires-Dist: jwcrypto ; extra == "jwks"
|
|
28
|
+
Requires-Dist: swarmauri_base
|
|
29
|
+
Requires-Dist: swarmauri_core
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+

|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
<p align="center">
|
|
36
|
+
<a href="https://pypi.org/project/swarmauri_keyprovider_file/">
|
|
37
|
+
<img src="https://img.shields.io/pypi/dm/swarmauri_keyprovider_file" alt="PyPI - Downloads"/></a>
|
|
38
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_keyprovider_file/">
|
|
39
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_keyprovider_file.svg"/></a>
|
|
40
|
+
<a href="https://pypi.org/project/swarmauri_keyprovider_file/">
|
|
41
|
+
<img src="https://img.shields.io/pypi/pyversions/swarmauri_keyprovider_file" alt="PyPI - Python Version"/></a>
|
|
42
|
+
<a href="https://pypi.org/project/swarmauri_keyprovider_file/">
|
|
43
|
+
<img src="https://img.shields.io/pypi/l/swarmauri_keyprovider_file" alt="PyPI - License"/></a>
|
|
44
|
+
<a href="https://pypi.org/project/swarmauri_keyprovider_file/">
|
|
45
|
+
<img src="https://img.shields.io/pypi/v/swarmauri_keyprovider_file?label=swarmauri_keyprovider_file&color=green" alt="PyPI - swarmauri_keyprovider_file"/></a>
|
|
46
|
+
</p>
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
# Swarmauri File Key Provider
|
|
51
|
+
|
|
52
|
+
`FileKeyProvider` is a file-backed implementation of the `KeyProviderBase`
|
|
53
|
+
interface. It persists each key beneath a `keys/<kid>/v<version>/` directory,
|
|
54
|
+
captures metadata in `meta.json`, and exports public material in PEM or JWK
|
|
55
|
+
form. The provider supports the same lifecycle semantics as the in-memory
|
|
56
|
+
providers, but every operation is durable on disk.
|
|
57
|
+
|
|
58
|
+
## Highlights
|
|
59
|
+
|
|
60
|
+
- Generate symmetric AES-256-GCM keys and asymmetric Ed25519, X25519, RSA
|
|
61
|
+
(OAEP/PSS), or ECDSA (P-256) key material.
|
|
62
|
+
- Import existing keys while preserving private material when allowed by the
|
|
63
|
+
selected `ExportPolicy`.
|
|
64
|
+
- Rotate versions in-place, destroy versions or entire keys, and list
|
|
65
|
+
historical versions stored on disk.
|
|
66
|
+
- Publish public material as individual JWKs or aggregate JWKS documents and
|
|
67
|
+
expose HKDF and random byte helpers.
|
|
68
|
+
|
|
69
|
+
## Installation
|
|
70
|
+
|
|
71
|
+
Choose the tool that matches your workflow:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# pip
|
|
75
|
+
pip install swarmauri_keyprovider_file
|
|
76
|
+
|
|
77
|
+
# Poetry
|
|
78
|
+
poetry add swarmauri_keyprovider_file
|
|
79
|
+
|
|
80
|
+
# uv
|
|
81
|
+
uv add swarmauri_keyprovider_file
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Usage
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
import asyncio
|
|
88
|
+
from tempfile import TemporaryDirectory
|
|
89
|
+
|
|
90
|
+
from swarmauri_keyprovider_file import FileKeyProvider
|
|
91
|
+
from swarmauri_core.key_providers.types import (
|
|
92
|
+
ExportPolicy,
|
|
93
|
+
KeyAlg,
|
|
94
|
+
KeyClass,
|
|
95
|
+
KeySpec,
|
|
96
|
+
)
|
|
97
|
+
from swarmauri_core.crypto.types import KeyUse
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
async def run_example() -> str:
|
|
101
|
+
with TemporaryDirectory() as tmp:
|
|
102
|
+
provider = FileKeyProvider(tmp)
|
|
103
|
+
spec = KeySpec(
|
|
104
|
+
klass=KeyClass.symmetric,
|
|
105
|
+
alg=KeyAlg.AES256_GCM,
|
|
106
|
+
uses=(KeyUse.ENCRYPT,),
|
|
107
|
+
export_policy=ExportPolicy.SECRET_WHEN_ALLOWED,
|
|
108
|
+
)
|
|
109
|
+
created = await provider.create_key(spec)
|
|
110
|
+
provider2 = FileKeyProvider(tmp)
|
|
111
|
+
loaded = await provider2.get_key(created.kid, include_secret=True)
|
|
112
|
+
print(f"Loaded key: {loaded.kid}")
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
asyncio.run(run_example())
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`FileKeyProvider` is asynchronous—every lifecycle method returns a
|
|
119
|
+
`KeyRef`. Use `include_secret=True` when retrieving keys that allow private
|
|
120
|
+
material export so symmetric key bytes are loaded from disk.
|
|
121
|
+
|
|
122
|
+
## Entry Point
|
|
123
|
+
|
|
124
|
+
The provider registers under the `swarmauri.key_providers` entry point as `FileKeyProvider`.
|
|
125
|
+
|
|
126
|
+
## Want to help?
|
|
127
|
+
|
|
128
|
+
If you want to contribute to swarmauri-sdk, read up on our
|
|
129
|
+
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
130
|
+
that will help you get started.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
<p align="center">
|
|
5
|
+
<a href="https://pypi.org/project/swarmauri_keyprovider_file/">
|
|
6
|
+
<img src="https://img.shields.io/pypi/dm/swarmauri_keyprovider_file" alt="PyPI - Downloads"/></a>
|
|
7
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_keyprovider_file/">
|
|
8
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_keyprovider_file.svg"/></a>
|
|
9
|
+
<a href="https://pypi.org/project/swarmauri_keyprovider_file/">
|
|
10
|
+
<img src="https://img.shields.io/pypi/pyversions/swarmauri_keyprovider_file" alt="PyPI - Python Version"/></a>
|
|
11
|
+
<a href="https://pypi.org/project/swarmauri_keyprovider_file/">
|
|
12
|
+
<img src="https://img.shields.io/pypi/l/swarmauri_keyprovider_file" alt="PyPI - License"/></a>
|
|
13
|
+
<a href="https://pypi.org/project/swarmauri_keyprovider_file/">
|
|
14
|
+
<img src="https://img.shields.io/pypi/v/swarmauri_keyprovider_file?label=swarmauri_keyprovider_file&color=green" alt="PyPI - swarmauri_keyprovider_file"/></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# Swarmauri File Key Provider
|
|
20
|
+
|
|
21
|
+
`FileKeyProvider` is a file-backed implementation of the `KeyProviderBase`
|
|
22
|
+
interface. It persists each key beneath a `keys/<kid>/v<version>/` directory,
|
|
23
|
+
captures metadata in `meta.json`, and exports public material in PEM or JWK
|
|
24
|
+
form. The provider supports the same lifecycle semantics as the in-memory
|
|
25
|
+
providers, but every operation is durable on disk.
|
|
26
|
+
|
|
27
|
+
## Highlights
|
|
28
|
+
|
|
29
|
+
- Generate symmetric AES-256-GCM keys and asymmetric Ed25519, X25519, RSA
|
|
30
|
+
(OAEP/PSS), or ECDSA (P-256) key material.
|
|
31
|
+
- Import existing keys while preserving private material when allowed by the
|
|
32
|
+
selected `ExportPolicy`.
|
|
33
|
+
- Rotate versions in-place, destroy versions or entire keys, and list
|
|
34
|
+
historical versions stored on disk.
|
|
35
|
+
- Publish public material as individual JWKs or aggregate JWKS documents and
|
|
36
|
+
expose HKDF and random byte helpers.
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
Choose the tool that matches your workflow:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# pip
|
|
44
|
+
pip install swarmauri_keyprovider_file
|
|
45
|
+
|
|
46
|
+
# Poetry
|
|
47
|
+
poetry add swarmauri_keyprovider_file
|
|
48
|
+
|
|
49
|
+
# uv
|
|
50
|
+
uv add swarmauri_keyprovider_file
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import asyncio
|
|
57
|
+
from tempfile import TemporaryDirectory
|
|
58
|
+
|
|
59
|
+
from swarmauri_keyprovider_file import FileKeyProvider
|
|
60
|
+
from swarmauri_core.key_providers.types import (
|
|
61
|
+
ExportPolicy,
|
|
62
|
+
KeyAlg,
|
|
63
|
+
KeyClass,
|
|
64
|
+
KeySpec,
|
|
65
|
+
)
|
|
66
|
+
from swarmauri_core.crypto.types import KeyUse
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
async def run_example() -> str:
|
|
70
|
+
with TemporaryDirectory() as tmp:
|
|
71
|
+
provider = FileKeyProvider(tmp)
|
|
72
|
+
spec = KeySpec(
|
|
73
|
+
klass=KeyClass.symmetric,
|
|
74
|
+
alg=KeyAlg.AES256_GCM,
|
|
75
|
+
uses=(KeyUse.ENCRYPT,),
|
|
76
|
+
export_policy=ExportPolicy.SECRET_WHEN_ALLOWED,
|
|
77
|
+
)
|
|
78
|
+
created = await provider.create_key(spec)
|
|
79
|
+
provider2 = FileKeyProvider(tmp)
|
|
80
|
+
loaded = await provider2.get_key(created.kid, include_secret=True)
|
|
81
|
+
print(f"Loaded key: {loaded.kid}")
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
asyncio.run(run_example())
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`FileKeyProvider` is asynchronous—every lifecycle method returns a
|
|
88
|
+
`KeyRef`. Use `include_secret=True` when retrieving keys that allow private
|
|
89
|
+
material export so symmetric key bytes are loaded from disk.
|
|
90
|
+
|
|
91
|
+
## Entry Point
|
|
92
|
+
|
|
93
|
+
The provider registers under the `swarmauri.key_providers` entry point as `FileKeyProvider`.
|
|
94
|
+
|
|
95
|
+
## Want to help?
|
|
96
|
+
|
|
97
|
+
If you want to contribute to swarmauri-sdk, read up on our
|
|
98
|
+
[guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
|
|
99
|
+
that will help you get started.
|
{swarmauri_keyprovider_file-0.2.0.dev5 → swarmauri_keyprovider_file-0.2.1.dev9}/pyproject.toml
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "swarmauri_keyprovider_file"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.1.dev9"
|
|
4
4
|
description = "File-backed key 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,23 @@ 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",
|
|
24
27
|
]
|
|
28
|
+
keywords = [
|
|
29
|
+
'swarmauri',
|
|
30
|
+
'sdk',
|
|
31
|
+
'standards',
|
|
32
|
+
'keyprovider',
|
|
33
|
+
'file',
|
|
34
|
+
'key-management',
|
|
35
|
+
]
|
|
25
36
|
|
|
26
37
|
[project.optional-dependencies]
|
|
27
38
|
cbor = ["cbor2"]
|
|
@@ -40,6 +51,7 @@ markers = [
|
|
|
40
51
|
"r8n: Regression tests",
|
|
41
52
|
"acceptance: Acceptance tests",
|
|
42
53
|
"perf: Performance tests",
|
|
54
|
+
"example: Documentation-backed examples",
|
|
43
55
|
]
|
|
44
56
|
timeout = 300
|
|
45
57
|
log_cli = true
|
|
@@ -14,8 +14,14 @@ from cryptography.hazmat.primitives import hashes, serialization
|
|
|
14
14
|
from cryptography.hazmat.primitives.asymmetric import ed25519, rsa, ec, x25519
|
|
15
15
|
from cryptography.hazmat.primitives.kdf.hkdf import HKDF
|
|
16
16
|
|
|
17
|
-
from swarmauri_base.
|
|
18
|
-
from swarmauri_core.
|
|
17
|
+
from swarmauri_base.key_providers.KeyProviderBase import KeyProviderBase
|
|
18
|
+
from swarmauri_core.key_providers.types import (
|
|
19
|
+
KeySpec,
|
|
20
|
+
KeyAlg,
|
|
21
|
+
KeyClass,
|
|
22
|
+
ExportPolicy,
|
|
23
|
+
KeyUse,
|
|
24
|
+
)
|
|
19
25
|
from swarmauri_core.crypto.types import KeyRef
|
|
20
26
|
|
|
21
27
|
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: swarmauri_keyprovider_file
|
|
3
|
-
Version: 0.2.0.dev5
|
|
4
|
-
Summary: File-backed key 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
|
-
Provides-Extra: jwks
|
|
20
|
-
Requires-Dist: cbor2 ; extra == "cbor"
|
|
21
|
-
Requires-Dist: cryptography
|
|
22
|
-
Requires-Dist: jwcrypto ; extra == "jwks"
|
|
23
|
-
Requires-Dist: swarmauri_base
|
|
24
|
-
Requires-Dist: swarmauri_core
|
|
25
|
-
Description-Content-Type: text/markdown
|
|
26
|
-
|
|
27
|
-

|
|
28
|
-
|
|
29
|
-
# Swarmauri File Key Provider
|
|
30
|
-
|
|
31
|
-
A file-backed key provider implementing the `KeyProviderBase` interface.
|
|
32
|
-
It manages symmetric and asymmetric keys on disk and exports public material via JWK/JWKS.
|
|
33
|
-
|
|
34
|
-
## Installation
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
pip install swarmauri_keyprovider_file
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Usage
|
|
41
|
-
|
|
42
|
-
```python
|
|
43
|
-
import asyncio
|
|
44
|
-
from tempfile import TemporaryDirectory
|
|
45
|
-
|
|
46
|
-
from swarmauri_keyprovider_file import FileKeyProvider
|
|
47
|
-
from swarmauri_core.keys.types import (
|
|
48
|
-
ExportPolicy,
|
|
49
|
-
KeyAlg,
|
|
50
|
-
KeyClass,
|
|
51
|
-
KeySpec,
|
|
52
|
-
)
|
|
53
|
-
from swarmauri_core.crypto.types import KeyUse
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
async def run_example() -> str:
|
|
57
|
-
with TemporaryDirectory() as tmp:
|
|
58
|
-
provider = FileKeyProvider(tmp)
|
|
59
|
-
spec = KeySpec(
|
|
60
|
-
klass=KeyClass.symmetric,
|
|
61
|
-
alg=KeyAlg.AES256_GCM,
|
|
62
|
-
uses=(KeyUse.ENCRYPT,),
|
|
63
|
-
export_policy=ExportPolicy.SECRET_WHEN_ALLOWED,
|
|
64
|
-
)
|
|
65
|
-
created = await provider.create_key(spec)
|
|
66
|
-
provider2 = FileKeyProvider(tmp)
|
|
67
|
-
loaded = await provider2.get_key(created.kid, include_secret=True)
|
|
68
|
-
print(f"Loaded key: {loaded.kid}")
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
asyncio.run(run_example())
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## Entry Point
|
|
75
|
-
|
|
76
|
-
The provider registers under the `swarmauri.key_providers` entry point as `FileKeyProvider`.
|
|
77
|
-
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-

|
|
2
|
-
|
|
3
|
-
# Swarmauri File Key Provider
|
|
4
|
-
|
|
5
|
-
A file-backed key provider implementing the `KeyProviderBase` interface.
|
|
6
|
-
It manages symmetric and asymmetric keys on disk and exports public material via JWK/JWKS.
|
|
7
|
-
|
|
8
|
-
## Installation
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
pip install swarmauri_keyprovider_file
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Usage
|
|
15
|
-
|
|
16
|
-
```python
|
|
17
|
-
import asyncio
|
|
18
|
-
from tempfile import TemporaryDirectory
|
|
19
|
-
|
|
20
|
-
from swarmauri_keyprovider_file import FileKeyProvider
|
|
21
|
-
from swarmauri_core.keys.types import (
|
|
22
|
-
ExportPolicy,
|
|
23
|
-
KeyAlg,
|
|
24
|
-
KeyClass,
|
|
25
|
-
KeySpec,
|
|
26
|
-
)
|
|
27
|
-
from swarmauri_core.crypto.types import KeyUse
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
async def run_example() -> str:
|
|
31
|
-
with TemporaryDirectory() as tmp:
|
|
32
|
-
provider = FileKeyProvider(tmp)
|
|
33
|
-
spec = KeySpec(
|
|
34
|
-
klass=KeyClass.symmetric,
|
|
35
|
-
alg=KeyAlg.AES256_GCM,
|
|
36
|
-
uses=(KeyUse.ENCRYPT,),
|
|
37
|
-
export_policy=ExportPolicy.SECRET_WHEN_ALLOWED,
|
|
38
|
-
)
|
|
39
|
-
created = await provider.create_key(spec)
|
|
40
|
-
provider2 = FileKeyProvider(tmp)
|
|
41
|
-
loaded = await provider2.get_key(created.kid, include_secret=True)
|
|
42
|
-
print(f"Loaded key: {loaded.kid}")
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
asyncio.run(run_example())
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Entry Point
|
|
49
|
-
|
|
50
|
-
The provider registers under the `swarmauri.key_providers` entry point as `FileKeyProvider`.
|
|
File without changes
|
|
File without changes
|