stls-core 0.1.3__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.
- stls_core/__init__.py +188 -0
- stls_core/auth/__init__.py +54 -0
- stls_core/auth/stls_core_auth_loaders.py +547 -0
- stls_core/auth/stls_core_auth_manager.py +1003 -0
- stls_core/auth/stls_core_auth_models.py +338 -0
- stls_core/auth/stls_core_auth_store.py +434 -0
- stls_core/providers/__init__.py +70 -0
- stls_core/providers/stls_core_providers_arqit_py.py +663 -0
- stls_core/providers/stls_core_providers_base.py +259 -0
- stls_core/providers/stls_core_providers_factory.py +233 -0
- stls_core/providers/stls_core_providers_keystore.py +486 -0
- stls_core/providers/stls_core_providers_pqc.py +614 -0
- stls_core/providers/stls_core_providers_session_resolver.py +96 -0
- stls_core/stls_core_constants.py +133 -0
- stls_core/stls_core_crypto.py +333 -0
- stls_core/stls_core_handshake.py +347 -0
- stls_core/stls_core_handshake_pqc.py +378 -0
- stls_core/stls_core_session.py +419 -0
- stls_core-0.1.3.dist-info/METADATA +245 -0
- stls_core-0.1.3.dist-info/RECORD +24 -0
- stls_core-0.1.3.dist-info/WHEEL +5 -0
- stls_core-0.1.3.dist-info/licenses/LICENSE +661 -0
- stls_core-0.1.3.dist-info/licenses/LICENSE-COMMERCIAL.md +16 -0
- stls_core-0.1.3.dist-info/top_level.txt +1 -0
stls_core/__init__.py
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"""
|
|
2
|
+
stls_core
|
|
3
|
+
---------
|
|
4
|
+
Protocol-agnostic cryptographic core for STLS.
|
|
5
|
+
|
|
6
|
+
Exports the public API of all submodules.
|
|
7
|
+
Child packages (stls-a2a, stls-mcp) import from here.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from .stls_core_constants import (
|
|
11
|
+
ENV_ARQIT_PY_CLIENT_CONFIG,
|
|
12
|
+
ENV_ARQIT_PY_SERVER_CONFIG,
|
|
13
|
+
ENV_ARQIT_PY_TRANSPORT,
|
|
14
|
+
ENV_AUTH_KEY_TTL,
|
|
15
|
+
ENV_AUTH_KEYS_FILE,
|
|
16
|
+
ENV_AUTH_LOADER_BACKEND,
|
|
17
|
+
ENV_AUTH_PG_DSN,
|
|
18
|
+
ENV_AUTH_REFRESH_INTERVAL,
|
|
19
|
+
ENV_KEY_PROVIDER_NAME,
|
|
20
|
+
ENV_KEY_SESSION_PORT,
|
|
21
|
+
HANDSHAKE_PATH,
|
|
22
|
+
HANDSHAKE_PQC_PATH,
|
|
23
|
+
HEADER_API_KEY,
|
|
24
|
+
HEADER_AUTHORIZATION,
|
|
25
|
+
HEADER_KID,
|
|
26
|
+
HEADER_PROFILE,
|
|
27
|
+
HEADER_SESSION_ID,
|
|
28
|
+
HEADER_USER_ID,
|
|
29
|
+
HKDF_INFO_AES,
|
|
30
|
+
HKDF_INFO_HMAC,
|
|
31
|
+
STLS_VERSION,
|
|
32
|
+
)
|
|
33
|
+
from .stls_core_crypto import StlsEnvelope, StlsTransport
|
|
34
|
+
from .stls_core_session import (
|
|
35
|
+
SessionCache,
|
|
36
|
+
SessionCacheBase,
|
|
37
|
+
SessionCacheFactory,
|
|
38
|
+
InMemorySessionCache,
|
|
39
|
+
RedisSessionCache,
|
|
40
|
+
StlsSession,
|
|
41
|
+
)
|
|
42
|
+
from .stls_core_handshake import (
|
|
43
|
+
HandshakeError,
|
|
44
|
+
HandshakeRequest,
|
|
45
|
+
HandshakeResponse,
|
|
46
|
+
perform_handshake,
|
|
47
|
+
verify_handshake_proof,
|
|
48
|
+
)
|
|
49
|
+
from .stls_core_handshake_pqc import (
|
|
50
|
+
PQCHandshakeError,
|
|
51
|
+
PQCHandshakeRequest,
|
|
52
|
+
PQCHandshakeResponse,
|
|
53
|
+
derive_session_key_client,
|
|
54
|
+
perform_pqc_handshake,
|
|
55
|
+
verify_pqc_handshake_proof,
|
|
56
|
+
)
|
|
57
|
+
from .providers import (
|
|
58
|
+
BlockableResult,
|
|
59
|
+
KeyProvider,
|
|
60
|
+
KeyProviderBase,
|
|
61
|
+
KeyProviderClient,
|
|
62
|
+
KeyProviderClientBase,
|
|
63
|
+
KeyProviderFactory,
|
|
64
|
+
KeyProviderServer,
|
|
65
|
+
KeyProviderServerBase,
|
|
66
|
+
KeySessionProvider,
|
|
67
|
+
KeySessionProviderBase,
|
|
68
|
+
KeySessionProviderFactory,
|
|
69
|
+
KeySessionResolver,
|
|
70
|
+
# PQC
|
|
71
|
+
KeyProviderPQC,
|
|
72
|
+
KeyProviderClientPQC,
|
|
73
|
+
KeyProviderServerPQC,
|
|
74
|
+
KeySessionProviderPQC,
|
|
75
|
+
PQCKeyStore,
|
|
76
|
+
derive_hybrid_key,
|
|
77
|
+
mlkem_decap,
|
|
78
|
+
mlkem_encap,
|
|
79
|
+
mlkem_generate_keypair,
|
|
80
|
+
x25519_exchange,
|
|
81
|
+
x25519_generate_keypair,
|
|
82
|
+
)
|
|
83
|
+
from .auth import (
|
|
84
|
+
ApiKeyLoader,
|
|
85
|
+
ApiKeyManager,
|
|
86
|
+
ApiKeyManagerGroup,
|
|
87
|
+
AuthResult,
|
|
88
|
+
AuditEntry,
|
|
89
|
+
BackgroundRefresher,
|
|
90
|
+
KeyRecord,
|
|
91
|
+
LoaderBackend,
|
|
92
|
+
RedisKeyCache,
|
|
93
|
+
ValidationResult,
|
|
94
|
+
create_loader,
|
|
95
|
+
default_audit_hook,
|
|
96
|
+
generate_api_key,
|
|
97
|
+
hash_key,
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
__version__ = "0.1.2"
|
|
101
|
+
|
|
102
|
+
__all__ = [
|
|
103
|
+
# constants
|
|
104
|
+
"STLS_VERSION",
|
|
105
|
+
"HANDSHAKE_PATH",
|
|
106
|
+
"HANDSHAKE_PQC_PATH",
|
|
107
|
+
"HEADER_SESSION_ID",
|
|
108
|
+
"HEADER_KID",
|
|
109
|
+
"HEADER_API_KEY",
|
|
110
|
+
"HEADER_AUTHORIZATION",
|
|
111
|
+
"HEADER_USER_ID",
|
|
112
|
+
"HEADER_PROFILE",
|
|
113
|
+
"HKDF_INFO_AES",
|
|
114
|
+
"HKDF_INFO_HMAC",
|
|
115
|
+
"ENV_KEY_PROVIDER_NAME",
|
|
116
|
+
"ENV_KEY_SESSION_PORT",
|
|
117
|
+
"ENV_ARQIT_PY_CLIENT_CONFIG",
|
|
118
|
+
"ENV_ARQIT_PY_SERVER_CONFIG",
|
|
119
|
+
"ENV_ARQIT_PY_TRANSPORT",
|
|
120
|
+
"ENV_AUTH_LOADER_BACKEND",
|
|
121
|
+
"ENV_AUTH_KEYS_FILE",
|
|
122
|
+
"ENV_AUTH_PG_DSN",
|
|
123
|
+
"ENV_AUTH_KEY_TTL",
|
|
124
|
+
"ENV_AUTH_REFRESH_INTERVAL",
|
|
125
|
+
# crypto
|
|
126
|
+
"StlsEnvelope",
|
|
127
|
+
"StlsTransport",
|
|
128
|
+
# session
|
|
129
|
+
"StlsSession",
|
|
130
|
+
"SessionCache",
|
|
131
|
+
"SessionCacheBase",
|
|
132
|
+
"SessionCacheFactory",
|
|
133
|
+
"InMemorySessionCache",
|
|
134
|
+
"RedisSessionCache",
|
|
135
|
+
# standard handshake
|
|
136
|
+
"HandshakeRequest",
|
|
137
|
+
"HandshakeResponse",
|
|
138
|
+
"HandshakeError",
|
|
139
|
+
"perform_handshake",
|
|
140
|
+
"verify_handshake_proof",
|
|
141
|
+
# PQC handshake
|
|
142
|
+
"PQCHandshakeRequest",
|
|
143
|
+
"PQCHandshakeResponse",
|
|
144
|
+
"PQCHandshakeError",
|
|
145
|
+
"perform_pqc_handshake",
|
|
146
|
+
"derive_session_key_client",
|
|
147
|
+
"verify_pqc_handshake_proof",
|
|
148
|
+
# providers
|
|
149
|
+
"BlockableResult",
|
|
150
|
+
"KeyProvider",
|
|
151
|
+
"KeyProviderBase",
|
|
152
|
+
"KeyProviderClient",
|
|
153
|
+
"KeyProviderClientBase",
|
|
154
|
+
"KeyProviderServer",
|
|
155
|
+
"KeyProviderServerBase",
|
|
156
|
+
"KeySessionProvider",
|
|
157
|
+
"KeySessionProviderBase",
|
|
158
|
+
"KeyProviderFactory",
|
|
159
|
+
"KeySessionProviderFactory",
|
|
160
|
+
"KeySessionResolver",
|
|
161
|
+
# PQC providers
|
|
162
|
+
"KeyProviderPQC",
|
|
163
|
+
"KeyProviderClientPQC",
|
|
164
|
+
"KeyProviderServerPQC",
|
|
165
|
+
"KeySessionProviderPQC",
|
|
166
|
+
"PQCKeyStore",
|
|
167
|
+
"derive_hybrid_key",
|
|
168
|
+
"mlkem_decap",
|
|
169
|
+
"mlkem_encap",
|
|
170
|
+
"mlkem_generate_keypair",
|
|
171
|
+
"x25519_exchange",
|
|
172
|
+
"x25519_generate_keypair",
|
|
173
|
+
# auth
|
|
174
|
+
"AuthResult",
|
|
175
|
+
"AuditEntry",
|
|
176
|
+
"KeyRecord",
|
|
177
|
+
"LoaderBackend",
|
|
178
|
+
"ValidationResult",
|
|
179
|
+
"ApiKeyLoader",
|
|
180
|
+
"create_loader",
|
|
181
|
+
"RedisKeyCache",
|
|
182
|
+
"ApiKeyManager",
|
|
183
|
+
"ApiKeyManagerGroup",
|
|
184
|
+
"BackgroundRefresher",
|
|
185
|
+
"default_audit_hook",
|
|
186
|
+
"generate_api_key",
|
|
187
|
+
"hash_key",
|
|
188
|
+
]
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""stls_core auth package — API key management."""
|
|
2
|
+
|
|
3
|
+
from .stls_core_auth_models import (
|
|
4
|
+
AuthConfig,
|
|
5
|
+
AuthResult,
|
|
6
|
+
AuditEntry,
|
|
7
|
+
DEFAULT_KEY_TTL_SECONDS,
|
|
8
|
+
DEFAULT_REFRESH_INTERVAL_SECONDS,
|
|
9
|
+
KeyRecord,
|
|
10
|
+
LoaderBackend,
|
|
11
|
+
REDIS_INDEX_SET,
|
|
12
|
+
REDIS_KEY_PREFIX,
|
|
13
|
+
REDIS_REVOKED_SET,
|
|
14
|
+
ValidationResult,
|
|
15
|
+
constant_time_equal,
|
|
16
|
+
generate_api_key,
|
|
17
|
+
hash_key,
|
|
18
|
+
)
|
|
19
|
+
from .stls_core_auth_loaders import ApiKeyLoader, create_loader
|
|
20
|
+
from .stls_core_auth_store import RedisKeyCache
|
|
21
|
+
from .stls_core_auth_manager import (
|
|
22
|
+
ApiKeyManager,
|
|
23
|
+
ApiKeyManagerGroup,
|
|
24
|
+
BackgroundRefresher,
|
|
25
|
+
default_audit_hook,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
__all__ = [
|
|
29
|
+
# models
|
|
30
|
+
"AuthConfig",
|
|
31
|
+
"AuthResult",
|
|
32
|
+
"AuditEntry",
|
|
33
|
+
"DEFAULT_KEY_TTL_SECONDS",
|
|
34
|
+
"DEFAULT_REFRESH_INTERVAL_SECONDS",
|
|
35
|
+
"KeyRecord",
|
|
36
|
+
"LoaderBackend",
|
|
37
|
+
"REDIS_INDEX_SET",
|
|
38
|
+
"REDIS_KEY_PREFIX",
|
|
39
|
+
"REDIS_REVOKED_SET",
|
|
40
|
+
"ValidationResult",
|
|
41
|
+
"constant_time_equal",
|
|
42
|
+
"generate_api_key",
|
|
43
|
+
"hash_key",
|
|
44
|
+
# loaders
|
|
45
|
+
"ApiKeyLoader",
|
|
46
|
+
"create_loader",
|
|
47
|
+
# store
|
|
48
|
+
"RedisKeyCache",
|
|
49
|
+
# manager
|
|
50
|
+
"ApiKeyManager",
|
|
51
|
+
"ApiKeyManagerGroup",
|
|
52
|
+
"BackgroundRefresher",
|
|
53
|
+
"default_audit_hook",
|
|
54
|
+
]
|