quantumapi 0.24.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.
Files changed (69) hide show
  1. {quantumapi-0.24.0/quantumapi.egg-info → quantumapi-0.26.0}/PKG-INFO +181 -36
  2. {quantumapi-0.24.0 → quantumapi-0.26.0}/README.md +180 -35
  3. {quantumapi-0.24.0 → quantumapi-0.26.0}/pyproject.toml +1 -1
  4. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/__init__.py +3 -1
  5. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/client/__init__.py +12 -0
  6. quantumapi-0.26.0/quantumapi/client/applications.py +368 -0
  7. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/client/async_client.py +12 -0
  8. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/client/base.py +81 -5
  9. quantumapi-0.26.0/quantumapi/client/compliance.py +105 -0
  10. quantumapi-0.26.0/quantumapi/client/dynamic_secrets.py +113 -0
  11. quantumapi-0.26.0/quantumapi/client/external_key_stores.py +163 -0
  12. quantumapi-0.26.0/quantumapi/client/log_streams.py +185 -0
  13. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/client/sync_client.py +8 -1
  14. quantumapi-0.26.0/quantumapi/client/team.py +85 -0
  15. quantumapi-0.26.0/quantumapi/client/usage.py +37 -0
  16. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/errors/__init__.py +4 -0
  17. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/errors/exceptions.py +20 -0
  18. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/models/__init__.py +135 -0
  19. quantumapi-0.26.0/quantumapi/models/applications.py +256 -0
  20. quantumapi-0.26.0/quantumapi/models/compliance.py +144 -0
  21. quantumapi-0.26.0/quantumapi/models/dynamic_secrets.py +135 -0
  22. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/models/end_users.py +5 -0
  23. quantumapi-0.26.0/quantumapi/models/external_key_stores.py +216 -0
  24. quantumapi-0.26.0/quantumapi/models/log_streams.py +171 -0
  25. quantumapi-0.26.0/quantumapi/models/team.py +76 -0
  26. quantumapi-0.26.0/quantumapi/models/usage.py +90 -0
  27. {quantumapi-0.24.0 → quantumapi-0.26.0/quantumapi.egg-info}/PKG-INFO +181 -36
  28. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi.egg-info/SOURCES.txt +17 -0
  29. quantumapi-0.26.0/tests/test_applications.py +238 -0
  30. quantumapi-0.26.0/tests/test_compliance_logstreams_usage.py +726 -0
  31. quantumapi-0.26.0/tests/test_dynamic_secrets.py +232 -0
  32. {quantumapi-0.24.0 → quantumapi-0.26.0}/tests/test_end_users.py +22 -1
  33. quantumapi-0.26.0/tests/test_external_key_stores.py +315 -0
  34. quantumapi-0.26.0/tests/test_team.py +143 -0
  35. quantumapi-0.24.0/quantumapi/client/applications.py +0 -180
  36. quantumapi-0.24.0/quantumapi/models/applications.py +0 -120
  37. {quantumapi-0.24.0 → quantumapi-0.26.0}/LICENSE +0 -0
  38. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/client/audit.py +0 -0
  39. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/client/encryption.py +0 -0
  40. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/client/end_users.py +0 -0
  41. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/client/health.py +0 -0
  42. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/client/keys.py +0 -0
  43. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/client/qrng.py +0 -0
  44. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/client/resource_groups.py +0 -0
  45. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/client/roles.py +0 -0
  46. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/client/secrets.py +0 -0
  47. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/client/transit.py +0 -0
  48. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/models/audit.py +0 -0
  49. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/models/encryption.py +0 -0
  50. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/models/health.py +0 -0
  51. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/models/keys.py +0 -0
  52. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/models/qrng.py +0 -0
  53. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/models/resource_groups.py +0 -0
  54. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/models/roles.py +0 -0
  55. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/models/secrets.py +0 -0
  56. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/models/transit.py +0 -0
  57. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi/py.typed +0 -0
  58. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi.egg-info/dependency_links.txt +0 -0
  59. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi.egg-info/requires.txt +0 -0
  60. {quantumapi-0.24.0 → quantumapi-0.26.0}/quantumapi.egg-info/top_level.txt +0 -0
  61. {quantumapi-0.24.0 → quantumapi-0.26.0}/setup.cfg +0 -0
  62. {quantumapi-0.24.0 → quantumapi-0.26.0}/tests/test_audit.py +0 -0
  63. {quantumapi-0.24.0 → quantumapi-0.26.0}/tests/test_data_keys.py +0 -0
  64. {quantumapi-0.24.0 → quantumapi-0.26.0}/tests/test_exceptions.py +0 -0
  65. {quantumapi-0.24.0 → quantumapi-0.26.0}/tests/test_models.py +0 -0
  66. {quantumapi-0.24.0 → quantumapi-0.26.0}/tests/test_parity.py +0 -0
  67. {quantumapi-0.24.0 → quantumapi-0.26.0}/tests/test_qrng.py +0 -0
  68. {quantumapi-0.24.0 → quantumapi-0.26.0}/tests/test_secret_history_share.py +0 -0
  69. {quantumapi-0.24.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.24.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
- - 💳 **Billing Integration** - Access subscription and usage metrics
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
- ### Users Client
304
+ ### Team Client
305
+
306
+ The people who work in your tenant.
305
307
 
306
308
  ```python
307
- # Create user
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
- # List users
315
- users = await client.users.list(active_only=True)
311
+ team = await client.team.list_members()
312
+ print(team.total_count, team.mfa_enabled_count)
316
313
 
317
- # Update user
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
- # Deactivate user
325
- await client.users.deactivate(user_id="user-id")
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
@@ -441,6 +418,174 @@ batch = await client.transit.batch_encrypt("orders", [b"a", b"b"]) # up to 10
441
418
  Errors: `KeyRevokedError` (403 `key_revoked`) and `InsufficientScopeError` (403 `insufficient_scope`),
442
419
  both subclasses of `PermissionError`.
443
420
 
421
+ ### Compliance Client
422
+
423
+ Scores for GDPR, NIS2, DORA and eIDAS 2 (`gdpr`, `nis2`, `dora`, `eidas2`), plus risk
424
+ acceptances of failing or warning checks. Tenant owner/admin only. Risk acceptances need
425
+ platform 0.27.0 or later.
426
+
427
+ ```python
428
+ from datetime import datetime, timezone
429
+ from quantumapi.models import ComplianceCheckStatus
430
+
431
+ overview = await client.compliance.get_overview()
432
+ for fw in overview.frameworks:
433
+ print(fw.framework, fw.score, fw.fail_count, fw.risk_accepted_count)
434
+
435
+ report = await client.compliance.get_report("dora")
436
+ for check in report.checks:
437
+ # status: Pass, Warning, Fail, NotApplicable or RiskAccepted (unknown future values stay strings).
438
+ # evaluated_status is the status before applying a risk acceptance.
439
+ print(check.id, check.status, check.evaluated_status)
440
+
441
+ # Accept the risk of a failing/warning check (justification 10-2000 chars, review_date in the future).
442
+ # Accepting again replaces the earlier acceptance. ConflictError (409) if the check is passing,
443
+ # NotFoundError (404) for an unknown check.
444
+ acceptance = await client.compliance.accept_risk(
445
+ "dora",
446
+ "operational-monitoring",
447
+ "Logs are shipped by our on-prem collector; SIEM integration planned for Q1.",
448
+ review_date=datetime(2027, 1, 31, tzinfo=timezone.utc),
449
+ )
450
+
451
+ # Revoke it (204 No Content: returns None; NotFoundError if none is open)
452
+ await client.compliance.revoke_risk_acceptance("dora", "operational-monitoring")
453
+
454
+ # Full history, newest first, including revoked and expired acceptances
455
+ history = await client.compliance.list_risk_acceptances()
456
+ for a in history.items:
457
+ print(a.check_id, a.accepted_by, a.is_active, a.is_expired)
458
+ ```
459
+
460
+ ### Log Streams Client
461
+
462
+ Streams authentication logs to a Webhook, Datadog, Splunk or the built-in File destination
463
+ (daily gzip NDJSON archives you download). Tenant owner/admin only. The File destination needs
464
+ platform 0.27.0 or later. `config_json` is a JSON-encoded string on the wire.
465
+
466
+ ```python
467
+ from datetime import date
468
+ from quantumapi.models import LogStreamType, file_stream_config
469
+
470
+ # File destination: retention 7, 30 (default) or 365 days. file_stream_config raises ValueError otherwise.
471
+ stream = await client.log_streams.create("SIEM archive", LogStreamType.FILE, file_stream_config(365))
472
+ print(stream.retention_days) # 365
473
+
474
+ # Other destinations take their own config string
475
+ await client.log_streams.create("SIEM", "Webhook", '{"url": "https://siem.example.com/ingest"}')
476
+
477
+ streams = await client.log_streams.list()
478
+ await client.log_streams.update(stream.id, "SIEM archive", "File", file_stream_config(30))
479
+ result = await client.log_streams.test(stream.id) # File: checks the destination is writable
480
+ await client.log_streams.deactivate(stream.id)
481
+ await client.log_streams.activate(stream.id)
482
+
483
+ # Daily archives (UTC days), newest first
484
+ files = await client.log_streams.list_files(stream.id)
485
+ for d in files.days:
486
+ print(d.day, d.line_count, d.size_bytes)
487
+
488
+ # Download one day as raw gzip bytes (not decompressed; may hold several gzip members,
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.
491
+ data = await client.log_streams.download_file(stream.id, date(2026, 10, 24))
492
+
493
+ # Or write it to disk. A directory gets the default name auth-logs-<day>.ndjson.gz.
494
+ path = await client.log_streams.download_file_to(stream.id, "2026-10-24", "./archives")
495
+
496
+ await client.log_streams.delete(stream.id)
497
+ ```
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
+
573
+ ### Usage Client
574
+
575
+ Storage occupied by the tenant this month, in total and per category (`secrets`, `keys`,
576
+ `certificates`, `attachments`, `log_archives`). Any tenant role. Informative only: not invoiced
577
+ or enforced yet. Usage is priced by space occupied, never per user, key or secret. Needs platform
578
+ 0.27.0 or later.
579
+
580
+ ```python
581
+ storage = await client.usage.get_storage()
582
+ print(storage.period_start, storage.period_end, storage.as_of)
583
+ print(storage.total_bytes, storage.month_average_bytes, storage.gb_months_accrued) # 1 GB = 2^30 bytes
584
+ for c in storage.categories:
585
+ print(c.id, c.bytes, c.items, c.gb_months_accrued)
586
+ print(storage.category("log_archives"))
587
+ ```
588
+
444
589
  ## Error Handling
445
590
 
446
591
  The SDK provides typed exceptions for all error scenarios:
@@ -659,7 +804,7 @@ See [CHANGELOG.md](CHANGELOG.md) for a history of changes to this SDK.
659
804
 
660
805
  ## Security
661
806
 
662
- For security concerns, please email victorxata@icloud.com. Do not create public issues for security vulnerabilities.
807
+ For security concerns, please email yo@victorz.cloud. Do not create public issues for security vulnerabilities.
663
808
 
664
809
  ## Links
665
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
- - 💳 **Billing Integration** - Access subscription and usage metrics
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
- ### Users Client
263
+ ### Team Client
264
+
265
+ The people who work in your tenant.
264
266
 
265
267
  ```python
266
- # Create user
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
- # List users
274
- users = await client.users.list(active_only=True)
270
+ team = await client.team.list_members()
271
+ print(team.total_count, team.mfa_enabled_count)
275
272
 
276
- # Update user
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
- # Deactivate user
284
- await client.users.deactivate(user_id="user-id")
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
@@ -400,6 +377,174 @@ batch = await client.transit.batch_encrypt("orders", [b"a", b"b"]) # up to 10
400
377
  Errors: `KeyRevokedError` (403 `key_revoked`) and `InsufficientScopeError` (403 `insufficient_scope`),
401
378
  both subclasses of `PermissionError`.
402
379
 
380
+ ### Compliance Client
381
+
382
+ Scores for GDPR, NIS2, DORA and eIDAS 2 (`gdpr`, `nis2`, `dora`, `eidas2`), plus risk
383
+ acceptances of failing or warning checks. Tenant owner/admin only. Risk acceptances need
384
+ platform 0.27.0 or later.
385
+
386
+ ```python
387
+ from datetime import datetime, timezone
388
+ from quantumapi.models import ComplianceCheckStatus
389
+
390
+ overview = await client.compliance.get_overview()
391
+ for fw in overview.frameworks:
392
+ print(fw.framework, fw.score, fw.fail_count, fw.risk_accepted_count)
393
+
394
+ report = await client.compliance.get_report("dora")
395
+ for check in report.checks:
396
+ # status: Pass, Warning, Fail, NotApplicable or RiskAccepted (unknown future values stay strings).
397
+ # evaluated_status is the status before applying a risk acceptance.
398
+ print(check.id, check.status, check.evaluated_status)
399
+
400
+ # Accept the risk of a failing/warning check (justification 10-2000 chars, review_date in the future).
401
+ # Accepting again replaces the earlier acceptance. ConflictError (409) if the check is passing,
402
+ # NotFoundError (404) for an unknown check.
403
+ acceptance = await client.compliance.accept_risk(
404
+ "dora",
405
+ "operational-monitoring",
406
+ "Logs are shipped by our on-prem collector; SIEM integration planned for Q1.",
407
+ review_date=datetime(2027, 1, 31, tzinfo=timezone.utc),
408
+ )
409
+
410
+ # Revoke it (204 No Content: returns None; NotFoundError if none is open)
411
+ await client.compliance.revoke_risk_acceptance("dora", "operational-monitoring")
412
+
413
+ # Full history, newest first, including revoked and expired acceptances
414
+ history = await client.compliance.list_risk_acceptances()
415
+ for a in history.items:
416
+ print(a.check_id, a.accepted_by, a.is_active, a.is_expired)
417
+ ```
418
+
419
+ ### Log Streams Client
420
+
421
+ Streams authentication logs to a Webhook, Datadog, Splunk or the built-in File destination
422
+ (daily gzip NDJSON archives you download). Tenant owner/admin only. The File destination needs
423
+ platform 0.27.0 or later. `config_json` is a JSON-encoded string on the wire.
424
+
425
+ ```python
426
+ from datetime import date
427
+ from quantumapi.models import LogStreamType, file_stream_config
428
+
429
+ # File destination: retention 7, 30 (default) or 365 days. file_stream_config raises ValueError otherwise.
430
+ stream = await client.log_streams.create("SIEM archive", LogStreamType.FILE, file_stream_config(365))
431
+ print(stream.retention_days) # 365
432
+
433
+ # Other destinations take their own config string
434
+ await client.log_streams.create("SIEM", "Webhook", '{"url": "https://siem.example.com/ingest"}')
435
+
436
+ streams = await client.log_streams.list()
437
+ await client.log_streams.update(stream.id, "SIEM archive", "File", file_stream_config(30))
438
+ result = await client.log_streams.test(stream.id) # File: checks the destination is writable
439
+ await client.log_streams.deactivate(stream.id)
440
+ await client.log_streams.activate(stream.id)
441
+
442
+ # Daily archives (UTC days), newest first
443
+ files = await client.log_streams.list_files(stream.id)
444
+ for d in files.days:
445
+ print(d.day, d.line_count, d.size_bytes)
446
+
447
+ # Download one day as raw gzip bytes (not decompressed; may hold several gzip members,
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.
450
+ data = await client.log_streams.download_file(stream.id, date(2026, 10, 24))
451
+
452
+ # Or write it to disk. A directory gets the default name auth-logs-<day>.ndjson.gz.
453
+ path = await client.log_streams.download_file_to(stream.id, "2026-10-24", "./archives")
454
+
455
+ await client.log_streams.delete(stream.id)
456
+ ```
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
+
532
+ ### Usage Client
533
+
534
+ Storage occupied by the tenant this month, in total and per category (`secrets`, `keys`,
535
+ `certificates`, `attachments`, `log_archives`). Any tenant role. Informative only: not invoiced
536
+ or enforced yet. Usage is priced by space occupied, never per user, key or secret. Needs platform
537
+ 0.27.0 or later.
538
+
539
+ ```python
540
+ storage = await client.usage.get_storage()
541
+ print(storage.period_start, storage.period_end, storage.as_of)
542
+ print(storage.total_bytes, storage.month_average_bytes, storage.gb_months_accrued) # 1 GB = 2^30 bytes
543
+ for c in storage.categories:
544
+ print(c.id, c.bytes, c.items, c.gb_months_accrued)
545
+ print(storage.category("log_archives"))
546
+ ```
547
+
403
548
  ## Error Handling
404
549
 
405
550
  The SDK provides typed exceptions for all error scenarios:
@@ -618,7 +763,7 @@ See [CHANGELOG.md](CHANGELOG.md) for a history of changes to this SDK.
618
763
 
619
764
  ## Security
620
765
 
621
- For security concerns, please email victorxata@icloud.com. Do not create public issues for security vulnerabilities.
766
+ For security concerns, please email yo@victorz.cloud. Do not create public issues for security vulnerabilities.
622
767
 
623
768
  ## Links
624
769
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "quantumapi"
7
- version = "0.24.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.1.0-beta"
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",
@@ -2,14 +2,20 @@
2
2
 
3
3
  from quantumapi.client.applications import ApplicationsClient
4
4
  from quantumapi.client.async_client import QuantumAPIClient
5
+ from quantumapi.client.compliance import ComplianceClient
5
6
  from quantumapi.client.encryption import EncryptionClient
6
7
  from quantumapi.client.end_users import EndUsersClient
8
+ from quantumapi.client.external_key_stores import ExternalKeyStoresClient
7
9
  from quantumapi.client.health import HealthClient
8
10
  from quantumapi.client.audit import AuditClient
9
11
  from quantumapi.client.keys import KeysClient
12
+ from quantumapi.client.dynamic_secrets import DynamicSecretsClient
13
+ from quantumapi.client.log_streams import LogStreamsClient
10
14
  from quantumapi.client.qrng import QrngClient
11
15
  from quantumapi.client.secrets import SecretsClient
12
16
  from quantumapi.client.sync_client import QuantumAPISyncClient
17
+ from quantumapi.client.team import TeamClient
18
+ from quantumapi.client.usage import UsageClient
13
19
 
14
20
  __all__ = [
15
21
  "QuantumAPIClient",
@@ -21,5 +27,11 @@ __all__ = [
21
27
  "AuditClient",
22
28
  "QrngClient",
23
29
  "SecretsClient",
30
+ "TeamClient",
24
31
  "HealthClient",
32
+ "ComplianceClient",
33
+ "DynamicSecretsClient",
34
+ "LogStreamsClient",
35
+ "UsageClient",
36
+ "ExternalKeyStoresClient",
25
37
  ]