quantumapi 0.25.0__tar.gz → 0.26.0__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.
- {quantumapi-0.25.0/quantumapi.egg-info → quantumapi-0.26.0}/PKG-INFO +90 -38
- {quantumapi-0.25.0 → quantumapi-0.26.0}/README.md +89 -37
- {quantumapi-0.25.0 → quantumapi-0.26.0}/pyproject.toml +1 -1
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/__init__.py +3 -1
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/client/__init__.py +6 -0
- quantumapi-0.26.0/quantumapi/client/applications.py +368 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/client/async_client.py +6 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/client/base.py +11 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/client/compliance.py +6 -4
- quantumapi-0.26.0/quantumapi/client/dynamic_secrets.py +113 -0
- quantumapi-0.26.0/quantumapi/client/external_key_stores.py +163 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/client/log_streams.py +14 -7
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/client/sync_client.py +3 -0
- quantumapi-0.26.0/quantumapi/client/team.py +85 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/client/usage.py +13 -1
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/errors/__init__.py +4 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/errors/exceptions.py +20 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/models/__init__.py +82 -0
- quantumapi-0.26.0/quantumapi/models/applications.py +256 -0
- quantumapi-0.26.0/quantumapi/models/dynamic_secrets.py +135 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/models/end_users.py +5 -0
- quantumapi-0.26.0/quantumapi/models/external_key_stores.py +216 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/models/log_streams.py +24 -4
- quantumapi-0.26.0/quantumapi/models/team.py +76 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/models/usage.py +29 -1
- {quantumapi-0.25.0 → quantumapi-0.26.0/quantumapi.egg-info}/PKG-INFO +90 -38
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi.egg-info/SOURCES.txt +10 -0
- quantumapi-0.26.0/tests/test_applications.py +238 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/tests/test_compliance_logstreams_usage.py +89 -8
- quantumapi-0.26.0/tests/test_dynamic_secrets.py +232 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/tests/test_end_users.py +22 -1
- quantumapi-0.26.0/tests/test_external_key_stores.py +315 -0
- quantumapi-0.26.0/tests/test_team.py +143 -0
- quantumapi-0.25.0/quantumapi/client/applications.py +0 -180
- quantumapi-0.25.0/quantumapi/models/applications.py +0 -120
- {quantumapi-0.25.0 → quantumapi-0.26.0}/LICENSE +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/client/audit.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/client/encryption.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/client/end_users.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/client/health.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/client/keys.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/client/qrng.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/client/resource_groups.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/client/roles.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/client/secrets.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/client/transit.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/models/audit.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/models/compliance.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/models/encryption.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/models/health.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/models/keys.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/models/qrng.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/models/resource_groups.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/models/roles.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/models/secrets.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/models/transit.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi/py.typed +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi.egg-info/dependency_links.txt +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi.egg-info/requires.txt +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/quantumapi.egg-info/top_level.txt +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/setup.cfg +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/tests/test_audit.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/tests/test_data_keys.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/tests/test_exceptions.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/tests/test_models.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/tests/test_parity.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/tests/test_qrng.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/tests/test_secret_history_share.py +0 -0
- {quantumapi-0.25.0 → quantumapi-0.26.0}/tests/test_transit.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: quantumapi
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.26.0
|
|
4
4
|
Summary: Official Python SDK for QuantumAPI - Quantum-safe encryption and identity platform
|
|
5
5
|
Author-email: QuantumAPI Team <developers@quantumapi.eu>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -55,7 +55,7 @@ Official Python SDK for [QuantumAPI](https://quantumapi.eu) - The European quant
|
|
|
55
55
|
- 🗄️ **Secret Vault** - Securely store and manage secrets with versioning
|
|
56
56
|
- 👤 **User Management** - Create and manage end-users with roles
|
|
57
57
|
- 🔍 **Audit Logs** - Query comprehensive audit trails
|
|
58
|
-
-
|
|
58
|
+
- 📈 **Usage** - Read the tenant's storage usage (`client.usage`)
|
|
59
59
|
- 🚀 **Async/Await Support** - Full async support with httpx
|
|
60
60
|
- ⚡ **Automatic Retries** - Exponential backoff for transient failures
|
|
61
61
|
- 📊 **Rate Limiting** - Client-side rate limit tracking
|
|
@@ -301,28 +301,21 @@ await client.secrets.revoke_shared_link(links.links[0].id)
|
|
|
301
301
|
opened = await client.secrets.open_shared_link(link.token, password="optional-password")
|
|
302
302
|
```
|
|
303
303
|
|
|
304
|
-
###
|
|
304
|
+
### Team Client
|
|
305
|
+
|
|
306
|
+
The people who work in your tenant.
|
|
305
307
|
|
|
306
308
|
```python
|
|
307
|
-
|
|
308
|
-
user = await client.users.create(
|
|
309
|
-
email="user@example.com",
|
|
310
|
-
name="John Doe",
|
|
311
|
-
role="developer"
|
|
312
|
-
)
|
|
309
|
+
from quantumapi.models.team import TeamRole
|
|
313
310
|
|
|
314
|
-
|
|
315
|
-
|
|
311
|
+
team = await client.team.list_members()
|
|
312
|
+
print(team.total_count, team.mfa_enabled_count)
|
|
316
313
|
|
|
317
|
-
|
|
318
|
-
await client.users.update(
|
|
319
|
-
user_id="user-id",
|
|
320
|
-
name="Jane Doe",
|
|
321
|
-
role="admin"
|
|
322
|
-
)
|
|
314
|
+
invitation = await client.team.invite("developer@example.com", TeamRole.DEVELOPER)
|
|
323
315
|
|
|
324
|
-
|
|
325
|
-
await client.
|
|
316
|
+
await client.team.update_member_role(member_id, TeamRole.ADMIN)
|
|
317
|
+
await client.team.disable_member(member_id)
|
|
318
|
+
await client.team.revoke_invitation(invitation.id)
|
|
326
319
|
```
|
|
327
320
|
|
|
328
321
|
### End-Users Client
|
|
@@ -382,22 +375,6 @@ csv_data = await client.audit.export(
|
|
|
382
375
|
)
|
|
383
376
|
```
|
|
384
377
|
|
|
385
|
-
### Billing Client
|
|
386
|
-
|
|
387
|
-
```python
|
|
388
|
-
# Get subscription details
|
|
389
|
-
subscription = await client.billing.get_subscription()
|
|
390
|
-
|
|
391
|
-
# Get usage metrics
|
|
392
|
-
usage = await client.billing.get_usage(
|
|
393
|
-
start_date="2024-01-01",
|
|
394
|
-
end_date="2024-01-31"
|
|
395
|
-
)
|
|
396
|
-
|
|
397
|
-
# List invoices
|
|
398
|
-
invoices = await client.billing.list_invoices()
|
|
399
|
-
```
|
|
400
|
-
|
|
401
378
|
### Health Client
|
|
402
379
|
|
|
403
380
|
```python
|
|
@@ -471,8 +448,8 @@ acceptance = await client.compliance.accept_risk(
|
|
|
471
448
|
review_date=datetime(2027, 1, 31, tzinfo=timezone.utc),
|
|
472
449
|
)
|
|
473
450
|
|
|
474
|
-
# Revoke it (
|
|
475
|
-
|
|
451
|
+
# Revoke it (204 No Content: returns None; NotFoundError if none is open)
|
|
452
|
+
await client.compliance.revoke_risk_acceptance("dora", "operational-monitoring")
|
|
476
453
|
|
|
477
454
|
# Full history, newest first, including revoked and expired acceptances
|
|
478
455
|
history = await client.compliance.list_risk_acceptances()
|
|
@@ -510,6 +487,7 @@ for d in files.days:
|
|
|
510
487
|
|
|
511
488
|
# Download one day as raw gzip bytes (not decompressed; may hold several gzip members,
|
|
512
489
|
# which gzip.decompress handles). day is a datetime.date or "YYYY-MM-DD".
|
|
490
|
+
# Each call sends a new Idempotency-Key (UUID), reused on the SDK's retries, so a retried download is audited once.
|
|
513
491
|
data = await client.log_streams.download_file(stream.id, date(2026, 10, 24))
|
|
514
492
|
|
|
515
493
|
# Or write it to disk. A directory gets the default name auth-logs-<day>.ndjson.gz.
|
|
@@ -518,6 +496,80 @@ path = await client.log_streams.download_file_to(stream.id, "2026-10-24", "./arc
|
|
|
518
496
|
await client.log_streams.delete(stream.id)
|
|
519
497
|
```
|
|
520
498
|
|
|
499
|
+
### Dynamic Secrets Client
|
|
500
|
+
|
|
501
|
+
Short-lived PostgreSQL or MySQL credentials: each request creates a user on your database and the lease drops it
|
|
502
|
+
when it expires or is revoked. A failure on the target database raises `DynamicSecretBackendError`
|
|
503
|
+
(`error_code`: `backend_unreachable`, `backend_authentication_failed`, `backend_statement_failed`,
|
|
504
|
+
`backend_invalid_configuration`, `backend_not_supported`; `message` is the API message). It is never retried.
|
|
505
|
+
|
|
506
|
+
```python
|
|
507
|
+
from quantumapi import DynamicSecretBackendError
|
|
508
|
+
from quantumapi.models import CreateDynamicSecretConfigRequest, UpdateDynamicSecretConfigRequest
|
|
509
|
+
|
|
510
|
+
config = await client.dynamic_secrets.create(
|
|
511
|
+
CreateDynamicSecretConfigRequest(
|
|
512
|
+
name="orders-db",
|
|
513
|
+
backend_type="PostgreSql", # or "MySql"
|
|
514
|
+
connection_string="Host=db.internal;Database=orders;Username=admin;Password=...",
|
|
515
|
+
creation_statement="CREATE ROLE {{name}} LOGIN PASSWORD '{{password}}'",
|
|
516
|
+
revocation_statement="DROP ROLE {{name}}",
|
|
517
|
+
max_leases=10,
|
|
518
|
+
)
|
|
519
|
+
)
|
|
520
|
+
|
|
521
|
+
try:
|
|
522
|
+
creds = await client.dynamic_secrets.create_credentials(config.id, ttl_seconds=600)
|
|
523
|
+
print(creds.username, creds.password, creds.expires_at) # the password is shown once
|
|
524
|
+
except DynamicSecretBackendError as e:
|
|
525
|
+
print(e.error_code, e.message)
|
|
526
|
+
|
|
527
|
+
leases = await client.dynamic_secrets.list_leases(config.id, status="Active")
|
|
528
|
+
await client.dynamic_secrets.renew(config.id, leases.leases[0].id, ttl_seconds=300)
|
|
529
|
+
await client.dynamic_secrets.revoke(config.id, leases.leases[0].id)
|
|
530
|
+
result = await client.dynamic_secrets.revoke_all(config.id) # result.failed: leases still active on the target
|
|
531
|
+
|
|
532
|
+
await client.dynamic_secrets.update(config.id, UpdateDynamicSecretConfigRequest(max_ttl_seconds=7200))
|
|
533
|
+
await client.dynamic_secrets.disable(config.id) # and enable(config.id)
|
|
534
|
+
await client.dynamic_secrets.delete(config.id)
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### External Key Stores Client
|
|
538
|
+
|
|
539
|
+
Let AWS (XKS) or Azure (Managed HSM) use QuantumAPI as their external key store. Reads need scope
|
|
540
|
+
`keys:read`; writes need `keys:write` and a tenant owner or admin.
|
|
541
|
+
|
|
542
|
+
```python
|
|
543
|
+
from quantumapi.models import ExternalKeyStoreType, azure_configuration
|
|
544
|
+
|
|
545
|
+
# AWS: the first access key comes with the connection.
|
|
546
|
+
created = await client.external_key_stores.create(ExternalKeyStoreType.AWS, "prod-aws")
|
|
547
|
+
cred = created.credential
|
|
548
|
+
# The secret access key is shown ONLY ONCE, here. Save it now: it cannot be read again.
|
|
549
|
+
print(cred.access_key_id, cred.secret_access_key)
|
|
550
|
+
open("xks-proxy-config.json", "w").write(cred.aws_proxy_configuration.to_json()) # file AWS expects
|
|
551
|
+
|
|
552
|
+
# Azure: build the configuration string with the helper.
|
|
553
|
+
store = (
|
|
554
|
+
await client.external_key_stores.create(
|
|
555
|
+
"Azure",
|
|
556
|
+
"prod-azure",
|
|
557
|
+
configuration=azure_configuration("hsm-client.example.eu", ["<root CA PEM>"], ["pool-1"]),
|
|
558
|
+
)
|
|
559
|
+
).connection
|
|
560
|
+
|
|
561
|
+
key = await client.external_key_stores.create_key(store.id, "orders-key", key_type="Rsa3072")
|
|
562
|
+
await client.external_key_stores.disable_key(store.id, key.id) # and enable_key(...)
|
|
563
|
+
rows = await client.external_key_stores.activity(store.id, key_id=key.id, limit=20)
|
|
564
|
+
|
|
565
|
+
new = await client.external_key_stores.create_access_key(created.connection.id) # rotation; secret shown once
|
|
566
|
+
await client.external_key_stores.revoke_access_key(created.connection.id, cred.id)
|
|
567
|
+
await client.external_key_stores.disconnect(store.id) # kill switch; reconnect(store.id) undoes it
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
A 409 `credential_limit` (too many access keys) raises `ConflictError`; a 400
|
|
571
|
+
`invalid_configuration` raises `ValidationError` with the reason in `message`.
|
|
572
|
+
|
|
521
573
|
### Usage Client
|
|
522
574
|
|
|
523
575
|
Storage occupied by the tenant this month, in total and per category (`secrets`, `keys`,
|
|
@@ -752,7 +804,7 @@ See [CHANGELOG.md](CHANGELOG.md) for a history of changes to this SDK.
|
|
|
752
804
|
|
|
753
805
|
## Security
|
|
754
806
|
|
|
755
|
-
For security concerns, please email
|
|
807
|
+
For security concerns, please email yo@victorz.cloud. Do not create public issues for security vulnerabilities.
|
|
756
808
|
|
|
757
809
|
## Links
|
|
758
810
|
|
|
@@ -14,7 +14,7 @@ Official Python SDK for [QuantumAPI](https://quantumapi.eu) - The European quant
|
|
|
14
14
|
- 🗄️ **Secret Vault** - Securely store and manage secrets with versioning
|
|
15
15
|
- 👤 **User Management** - Create and manage end-users with roles
|
|
16
16
|
- 🔍 **Audit Logs** - Query comprehensive audit trails
|
|
17
|
-
-
|
|
17
|
+
- 📈 **Usage** - Read the tenant's storage usage (`client.usage`)
|
|
18
18
|
- 🚀 **Async/Await Support** - Full async support with httpx
|
|
19
19
|
- ⚡ **Automatic Retries** - Exponential backoff for transient failures
|
|
20
20
|
- 📊 **Rate Limiting** - Client-side rate limit tracking
|
|
@@ -260,28 +260,21 @@ await client.secrets.revoke_shared_link(links.links[0].id)
|
|
|
260
260
|
opened = await client.secrets.open_shared_link(link.token, password="optional-password")
|
|
261
261
|
```
|
|
262
262
|
|
|
263
|
-
###
|
|
263
|
+
### Team Client
|
|
264
|
+
|
|
265
|
+
The people who work in your tenant.
|
|
264
266
|
|
|
265
267
|
```python
|
|
266
|
-
|
|
267
|
-
user = await client.users.create(
|
|
268
|
-
email="user@example.com",
|
|
269
|
-
name="John Doe",
|
|
270
|
-
role="developer"
|
|
271
|
-
)
|
|
268
|
+
from quantumapi.models.team import TeamRole
|
|
272
269
|
|
|
273
|
-
|
|
274
|
-
|
|
270
|
+
team = await client.team.list_members()
|
|
271
|
+
print(team.total_count, team.mfa_enabled_count)
|
|
275
272
|
|
|
276
|
-
|
|
277
|
-
await client.users.update(
|
|
278
|
-
user_id="user-id",
|
|
279
|
-
name="Jane Doe",
|
|
280
|
-
role="admin"
|
|
281
|
-
)
|
|
273
|
+
invitation = await client.team.invite("developer@example.com", TeamRole.DEVELOPER)
|
|
282
274
|
|
|
283
|
-
|
|
284
|
-
await client.
|
|
275
|
+
await client.team.update_member_role(member_id, TeamRole.ADMIN)
|
|
276
|
+
await client.team.disable_member(member_id)
|
|
277
|
+
await client.team.revoke_invitation(invitation.id)
|
|
285
278
|
```
|
|
286
279
|
|
|
287
280
|
### End-Users Client
|
|
@@ -341,22 +334,6 @@ csv_data = await client.audit.export(
|
|
|
341
334
|
)
|
|
342
335
|
```
|
|
343
336
|
|
|
344
|
-
### Billing Client
|
|
345
|
-
|
|
346
|
-
```python
|
|
347
|
-
# Get subscription details
|
|
348
|
-
subscription = await client.billing.get_subscription()
|
|
349
|
-
|
|
350
|
-
# Get usage metrics
|
|
351
|
-
usage = await client.billing.get_usage(
|
|
352
|
-
start_date="2024-01-01",
|
|
353
|
-
end_date="2024-01-31"
|
|
354
|
-
)
|
|
355
|
-
|
|
356
|
-
# List invoices
|
|
357
|
-
invoices = await client.billing.list_invoices()
|
|
358
|
-
```
|
|
359
|
-
|
|
360
337
|
### Health Client
|
|
361
338
|
|
|
362
339
|
```python
|
|
@@ -430,8 +407,8 @@ acceptance = await client.compliance.accept_risk(
|
|
|
430
407
|
review_date=datetime(2027, 1, 31, tzinfo=timezone.utc),
|
|
431
408
|
)
|
|
432
409
|
|
|
433
|
-
# Revoke it (
|
|
434
|
-
|
|
410
|
+
# Revoke it (204 No Content: returns None; NotFoundError if none is open)
|
|
411
|
+
await client.compliance.revoke_risk_acceptance("dora", "operational-monitoring")
|
|
435
412
|
|
|
436
413
|
# Full history, newest first, including revoked and expired acceptances
|
|
437
414
|
history = await client.compliance.list_risk_acceptances()
|
|
@@ -469,6 +446,7 @@ for d in files.days:
|
|
|
469
446
|
|
|
470
447
|
# Download one day as raw gzip bytes (not decompressed; may hold several gzip members,
|
|
471
448
|
# which gzip.decompress handles). day is a datetime.date or "YYYY-MM-DD".
|
|
449
|
+
# Each call sends a new Idempotency-Key (UUID), reused on the SDK's retries, so a retried download is audited once.
|
|
472
450
|
data = await client.log_streams.download_file(stream.id, date(2026, 10, 24))
|
|
473
451
|
|
|
474
452
|
# Or write it to disk. A directory gets the default name auth-logs-<day>.ndjson.gz.
|
|
@@ -477,6 +455,80 @@ path = await client.log_streams.download_file_to(stream.id, "2026-10-24", "./arc
|
|
|
477
455
|
await client.log_streams.delete(stream.id)
|
|
478
456
|
```
|
|
479
457
|
|
|
458
|
+
### Dynamic Secrets Client
|
|
459
|
+
|
|
460
|
+
Short-lived PostgreSQL or MySQL credentials: each request creates a user on your database and the lease drops it
|
|
461
|
+
when it expires or is revoked. A failure on the target database raises `DynamicSecretBackendError`
|
|
462
|
+
(`error_code`: `backend_unreachable`, `backend_authentication_failed`, `backend_statement_failed`,
|
|
463
|
+
`backend_invalid_configuration`, `backend_not_supported`; `message` is the API message). It is never retried.
|
|
464
|
+
|
|
465
|
+
```python
|
|
466
|
+
from quantumapi import DynamicSecretBackendError
|
|
467
|
+
from quantumapi.models import CreateDynamicSecretConfigRequest, UpdateDynamicSecretConfigRequest
|
|
468
|
+
|
|
469
|
+
config = await client.dynamic_secrets.create(
|
|
470
|
+
CreateDynamicSecretConfigRequest(
|
|
471
|
+
name="orders-db",
|
|
472
|
+
backend_type="PostgreSql", # or "MySql"
|
|
473
|
+
connection_string="Host=db.internal;Database=orders;Username=admin;Password=...",
|
|
474
|
+
creation_statement="CREATE ROLE {{name}} LOGIN PASSWORD '{{password}}'",
|
|
475
|
+
revocation_statement="DROP ROLE {{name}}",
|
|
476
|
+
max_leases=10,
|
|
477
|
+
)
|
|
478
|
+
)
|
|
479
|
+
|
|
480
|
+
try:
|
|
481
|
+
creds = await client.dynamic_secrets.create_credentials(config.id, ttl_seconds=600)
|
|
482
|
+
print(creds.username, creds.password, creds.expires_at) # the password is shown once
|
|
483
|
+
except DynamicSecretBackendError as e:
|
|
484
|
+
print(e.error_code, e.message)
|
|
485
|
+
|
|
486
|
+
leases = await client.dynamic_secrets.list_leases(config.id, status="Active")
|
|
487
|
+
await client.dynamic_secrets.renew(config.id, leases.leases[0].id, ttl_seconds=300)
|
|
488
|
+
await client.dynamic_secrets.revoke(config.id, leases.leases[0].id)
|
|
489
|
+
result = await client.dynamic_secrets.revoke_all(config.id) # result.failed: leases still active on the target
|
|
490
|
+
|
|
491
|
+
await client.dynamic_secrets.update(config.id, UpdateDynamicSecretConfigRequest(max_ttl_seconds=7200))
|
|
492
|
+
await client.dynamic_secrets.disable(config.id) # and enable(config.id)
|
|
493
|
+
await client.dynamic_secrets.delete(config.id)
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
### External Key Stores Client
|
|
497
|
+
|
|
498
|
+
Let AWS (XKS) or Azure (Managed HSM) use QuantumAPI as their external key store. Reads need scope
|
|
499
|
+
`keys:read`; writes need `keys:write` and a tenant owner or admin.
|
|
500
|
+
|
|
501
|
+
```python
|
|
502
|
+
from quantumapi.models import ExternalKeyStoreType, azure_configuration
|
|
503
|
+
|
|
504
|
+
# AWS: the first access key comes with the connection.
|
|
505
|
+
created = await client.external_key_stores.create(ExternalKeyStoreType.AWS, "prod-aws")
|
|
506
|
+
cred = created.credential
|
|
507
|
+
# The secret access key is shown ONLY ONCE, here. Save it now: it cannot be read again.
|
|
508
|
+
print(cred.access_key_id, cred.secret_access_key)
|
|
509
|
+
open("xks-proxy-config.json", "w").write(cred.aws_proxy_configuration.to_json()) # file AWS expects
|
|
510
|
+
|
|
511
|
+
# Azure: build the configuration string with the helper.
|
|
512
|
+
store = (
|
|
513
|
+
await client.external_key_stores.create(
|
|
514
|
+
"Azure",
|
|
515
|
+
"prod-azure",
|
|
516
|
+
configuration=azure_configuration("hsm-client.example.eu", ["<root CA PEM>"], ["pool-1"]),
|
|
517
|
+
)
|
|
518
|
+
).connection
|
|
519
|
+
|
|
520
|
+
key = await client.external_key_stores.create_key(store.id, "orders-key", key_type="Rsa3072")
|
|
521
|
+
await client.external_key_stores.disable_key(store.id, key.id) # and enable_key(...)
|
|
522
|
+
rows = await client.external_key_stores.activity(store.id, key_id=key.id, limit=20)
|
|
523
|
+
|
|
524
|
+
new = await client.external_key_stores.create_access_key(created.connection.id) # rotation; secret shown once
|
|
525
|
+
await client.external_key_stores.revoke_access_key(created.connection.id, cred.id)
|
|
526
|
+
await client.external_key_stores.disconnect(store.id) # kill switch; reconnect(store.id) undoes it
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
A 409 `credential_limit` (too many access keys) raises `ConflictError`; a 400
|
|
530
|
+
`invalid_configuration` raises `ValidationError` with the reason in `message`.
|
|
531
|
+
|
|
480
532
|
### Usage Client
|
|
481
533
|
|
|
482
534
|
Storage occupied by the tenant this month, in total and per category (`secrets`, `keys`,
|
|
@@ -711,7 +763,7 @@ See [CHANGELOG.md](CHANGELOG.md) for a history of changes to this SDK.
|
|
|
711
763
|
|
|
712
764
|
## Security
|
|
713
765
|
|
|
714
|
-
For security concerns, please email
|
|
766
|
+
For security concerns, please email yo@victorz.cloud. Do not create public issues for security vulnerabilities.
|
|
715
767
|
|
|
716
768
|
## Links
|
|
717
769
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "quantumapi"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.26.0"
|
|
8
8
|
description = "Official Python SDK for QuantumAPI - Quantum-safe encryption and identity platform"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -9,7 +9,7 @@ Example:
|
|
|
9
9
|
>>> secret = await client.secrets.create(name="test", value="secret")
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
|
-
__version__ = "0.
|
|
12
|
+
__version__ = "0.26.0"
|
|
13
13
|
__author__ = "QuantumAPI Team"
|
|
14
14
|
__email__ = "developers@quantumapi.eu"
|
|
15
15
|
|
|
@@ -18,6 +18,7 @@ from quantumapi.client.sync_client import QuantumAPISyncClient
|
|
|
18
18
|
from quantumapi.errors.exceptions import (
|
|
19
19
|
AuthenticationError,
|
|
20
20
|
ConflictError,
|
|
21
|
+
DynamicSecretBackendError,
|
|
21
22
|
InsufficientScopeError,
|
|
22
23
|
KeyRevokedError,
|
|
23
24
|
KeyVersionBelowMinimumError,
|
|
@@ -45,6 +46,7 @@ __all__ = [
|
|
|
45
46
|
"InsufficientScopeError",
|
|
46
47
|
"NotFoundError",
|
|
47
48
|
"ConflictError",
|
|
49
|
+
"DynamicSecretBackendError",
|
|
48
50
|
"RateLimitError",
|
|
49
51
|
"ValidationError",
|
|
50
52
|
"ServerError",
|
|
@@ -5,13 +5,16 @@ from quantumapi.client.async_client import QuantumAPIClient
|
|
|
5
5
|
from quantumapi.client.compliance import ComplianceClient
|
|
6
6
|
from quantumapi.client.encryption import EncryptionClient
|
|
7
7
|
from quantumapi.client.end_users import EndUsersClient
|
|
8
|
+
from quantumapi.client.external_key_stores import ExternalKeyStoresClient
|
|
8
9
|
from quantumapi.client.health import HealthClient
|
|
9
10
|
from quantumapi.client.audit import AuditClient
|
|
10
11
|
from quantumapi.client.keys import KeysClient
|
|
12
|
+
from quantumapi.client.dynamic_secrets import DynamicSecretsClient
|
|
11
13
|
from quantumapi.client.log_streams import LogStreamsClient
|
|
12
14
|
from quantumapi.client.qrng import QrngClient
|
|
13
15
|
from quantumapi.client.secrets import SecretsClient
|
|
14
16
|
from quantumapi.client.sync_client import QuantumAPISyncClient
|
|
17
|
+
from quantumapi.client.team import TeamClient
|
|
15
18
|
from quantumapi.client.usage import UsageClient
|
|
16
19
|
|
|
17
20
|
__all__ = [
|
|
@@ -24,8 +27,11 @@ __all__ = [
|
|
|
24
27
|
"AuditClient",
|
|
25
28
|
"QrngClient",
|
|
26
29
|
"SecretsClient",
|
|
30
|
+
"TeamClient",
|
|
27
31
|
"HealthClient",
|
|
28
32
|
"ComplianceClient",
|
|
33
|
+
"DynamicSecretsClient",
|
|
29
34
|
"LogStreamsClient",
|
|
30
35
|
"UsageClient",
|
|
36
|
+
"ExternalKeyStoresClient",
|
|
31
37
|
]
|