dominus-sdk-python-dev 2.1.6__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.
- dominus/__init__.py +47 -0
- dominus/config/__init__.py +24 -0
- dominus/config/endpoints.py +39 -0
- dominus/errors.py +201 -0
- dominus/helpers/__init__.py +2 -0
- dominus/helpers/auth.py +23 -0
- dominus/helpers/cache.py +192 -0
- dominus/helpers/core.py +657 -0
- dominus/helpers/crypto.py +118 -0
- dominus/namespaces/__init__.py +26 -0
- dominus/namespaces/_deprecated_crossover.py +10 -0
- dominus/namespaces/_deprecated_sql.py +1341 -0
- dominus/namespaces/auth.py +1056 -0
- dominus/namespaces/courier.py +251 -0
- dominus/namespaces/db.py +267 -0
- dominus/namespaces/ddl.py +590 -0
- dominus/namespaces/files.py +299 -0
- dominus/namespaces/health.py +59 -0
- dominus/namespaces/logs.py +367 -0
- dominus/namespaces/open.py +72 -0
- dominus/namespaces/portal.py +504 -0
- dominus/namespaces/redis.py +357 -0
- dominus/namespaces/secrets.py +126 -0
- dominus/services/__init__.py +2 -0
- dominus/services/_deprecated_architect.py +323 -0
- dominus/services/_deprecated_sovereign.py +93 -0
- dominus/start.py +1034 -0
- dominus_sdk_python_dev-2.1.6.dist-info/METADATA +381 -0
- dominus_sdk_python_dev-2.1.6.dist-info/RECORD +31 -0
- dominus_sdk_python_dev-2.1.6.dist-info/WHEEL +5 -0
- dominus_sdk_python_dev-2.1.6.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Cryptographic helpers for password and PSK hashing.
|
|
3
|
+
|
|
4
|
+
All hashing is done client-side (in SDK) before sending to Architect.
|
|
5
|
+
This ensures passwords/PSKs are never transmitted in plaintext.
|
|
6
|
+
"""
|
|
7
|
+
import bcrypt
|
|
8
|
+
import hashlib
|
|
9
|
+
import secrets
|
|
10
|
+
import string
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def hash_password(password: str) -> str:
|
|
14
|
+
"""
|
|
15
|
+
Hash a password using bcrypt.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
password: Raw password string
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
Bcrypt hash string (includes salt)
|
|
22
|
+
"""
|
|
23
|
+
salt = bcrypt.gensalt(rounds=12)
|
|
24
|
+
return bcrypt.hashpw(password.encode('utf-8'), salt).decode('utf-8')
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def verify_password_local(password: str, password_hash: str) -> bool:
|
|
28
|
+
"""
|
|
29
|
+
Verify a password against a bcrypt hash locally.
|
|
30
|
+
|
|
31
|
+
This is primarily for testing. In production, verification
|
|
32
|
+
happens via Architect's verify_user_password endpoint.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
password: Raw password to verify
|
|
36
|
+
password_hash: Bcrypt hash to compare against
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
True if password matches hash
|
|
40
|
+
"""
|
|
41
|
+
return bcrypt.checkpw(password.encode('utf-8'), password_hash.encode('utf-8'))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def hash_psk(psk: str) -> str:
|
|
45
|
+
"""
|
|
46
|
+
Hash a PSK (Pre-Shared Key) using bcrypt.
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
psk: Raw PSK string
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
Bcrypt hash string (includes salt)
|
|
53
|
+
"""
|
|
54
|
+
salt = bcrypt.gensalt(rounds=12)
|
|
55
|
+
return bcrypt.hashpw(psk.encode('utf-8'), salt).decode('utf-8')
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def verify_psk_local(psk: str, psk_hash: str) -> bool:
|
|
59
|
+
"""
|
|
60
|
+
Verify a PSK against a bcrypt hash locally.
|
|
61
|
+
|
|
62
|
+
This is primarily for testing. In production, verification
|
|
63
|
+
happens via Architect's verify_client_psk endpoint.
|
|
64
|
+
|
|
65
|
+
Args:
|
|
66
|
+
psk: Raw PSK to verify
|
|
67
|
+
psk_hash: Bcrypt hash to compare against
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
True if PSK matches hash
|
|
71
|
+
"""
|
|
72
|
+
return bcrypt.checkpw(psk.encode('utf-8'), psk_hash.encode('utf-8'))
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def generate_psk_local(length: int = 32) -> str:
|
|
76
|
+
"""
|
|
77
|
+
Generate a random PSK locally.
|
|
78
|
+
|
|
79
|
+
Note: In production, prefer using Sovereign's /generate-psk endpoint
|
|
80
|
+
for centralized PSK generation. This is a fallback.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
length: Length of PSK to generate (default: 32)
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
Random PSK string
|
|
87
|
+
"""
|
|
88
|
+
alphabet = string.ascii_letters + string.digits + "!@#$%^&*"
|
|
89
|
+
return ''.join(secrets.choice(alphabet) for _ in range(length))
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def hash_token(token: str) -> str:
|
|
93
|
+
"""
|
|
94
|
+
Hash a token using SHA-256.
|
|
95
|
+
|
|
96
|
+
Used for refresh tokens where we need fast comparison
|
|
97
|
+
and don't need the security properties of bcrypt.
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
token: Raw token string
|
|
101
|
+
|
|
102
|
+
Returns:
|
|
103
|
+
SHA-256 hex digest
|
|
104
|
+
"""
|
|
105
|
+
return hashlib.sha256(token.encode('utf-8')).hexdigest()
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def generate_token(length: int = 64) -> str:
|
|
109
|
+
"""
|
|
110
|
+
Generate a random token string.
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
length: Length of token to generate (default: 64)
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
Random URL-safe token string
|
|
117
|
+
"""
|
|
118
|
+
return secrets.token_urlsafe(length)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""Dominus SDK Namespaces v2.0"""
|
|
2
|
+
from .secrets import SecretsNamespace
|
|
3
|
+
from .db import DbNamespace
|
|
4
|
+
from .redis import RedisNamespace
|
|
5
|
+
from .files import FilesNamespace
|
|
6
|
+
from .auth import AuthNamespace
|
|
7
|
+
from .ddl import DdlNamespace
|
|
8
|
+
from .logs import LogsNamespace
|
|
9
|
+
from .open import OpenNamespace
|
|
10
|
+
from .health import HealthNamespace
|
|
11
|
+
from .portal import PortalNamespace
|
|
12
|
+
from .courier import CourierNamespace
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"SecretsNamespace",
|
|
16
|
+
"DbNamespace",
|
|
17
|
+
"RedisNamespace",
|
|
18
|
+
"FilesNamespace",
|
|
19
|
+
"AuthNamespace",
|
|
20
|
+
"DdlNamespace",
|
|
21
|
+
"LogsNamespace",
|
|
22
|
+
"OpenNamespace",
|
|
23
|
+
"HealthNamespace",
|
|
24
|
+
"PortalNamespace",
|
|
25
|
+
"CourierNamespace",
|
|
26
|
+
]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""Crossover (admin) operations namespace - DEPRECATED
|
|
2
|
+
|
|
3
|
+
Note: This namespace has been removed from the SDK.
|
|
4
|
+
Provisioning and admin operations should be done via Architect's
|
|
5
|
+
/api/crossover endpoint directly, not through the SDK.
|
|
6
|
+
|
|
7
|
+
This file is kept as a placeholder to prevent import errors in
|
|
8
|
+
any code that may still reference it.
|
|
9
|
+
"""
|
|
10
|
+
# Empty file - all crossover functionality removed
|