burnledger 0.1.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.
@@ -0,0 +1,13 @@
1
+ Metadata-Version: 2.4
2
+ Name: burnledger
3
+ Version: 0.1.0
4
+ Summary: Python SDK for the BurnLedger API
5
+ License-Expression: MIT
6
+ Requires-Python: >=3.10
7
+ Requires-Dist: httpx>=0.25.0
8
+ Requires-Dist: cryptography>=41.0.0
9
+ Provides-Extra: dev
10
+ Requires-Dist: pytest>=7.0; extra == "dev"
11
+ Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
12
+ Requires-Dist: respx>=0.21; extra == "dev"
13
+ Requires-Dist: mypy>=1.0; extra == "dev"
@@ -0,0 +1,151 @@
1
+ # BurnLedger Python SDK
2
+
3
+ Python client for the [BurnLedger](https://github.com/fdfretes/deleteme) API — cryptographic deletion certificates for regulatory compliance.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install burnledger
9
+ ```
10
+
11
+ **Requirements:** Python 3.10+
12
+
13
+ ## Quick Start
14
+
15
+ ```python
16
+ from burnledger import BurnLedger
17
+
18
+ with BurnLedger(api_key="dp_...") as dp:
19
+ # 1. Attest — snapshot systems before deletion
20
+ att = dp.attest("user@example.com", system_ids=["sys_abc", "sys_def"])
21
+
22
+ # 2. Delete data (your code, your tools)
23
+
24
+ # 3. Verify — confirm deletion and get certificate
25
+ result = dp.verify(att.id, "user@example.com", timeout=60)
26
+
27
+ # 4. Download certificate PDF
28
+ dp.save_pdf(result.certificate.id, "./deletion-cert.pdf")
29
+ ```
30
+
31
+ ### Async
32
+
33
+ ```python
34
+ from burnledger import AsyncBurnLedger
35
+
36
+ async with AsyncBurnLedger(api_key="dp_...") as dp:
37
+ att = await dp.attest("user@example.com", system_ids=["sys_abc"])
38
+ result = await dp.verify(att.id, "user@example.com", timeout=60)
39
+ ```
40
+
41
+ ## Offline Verification
42
+
43
+ Verify certificates without network access using Ed25519 signatures:
44
+
45
+ ```python
46
+ from burnledger import verify_certificate, verify_transparency, PublicKeyInfo
47
+
48
+ key = PublicKeyInfo.from_hex("abcdef...", revoked=False)
49
+ keys = {key.key_id: key}
50
+
51
+ cert_result = verify_certificate(certificate, keys)
52
+ # VerificationResult.VALID or raises VerificationError
53
+
54
+ log_result = verify_transparency(certificate, keys)
55
+ # TransparencyResult.INCLUDED or raises VerificationError
56
+ ```
57
+
58
+ ## Webhook Verification
59
+
60
+ Verify incoming webhook signatures (HMAC-SHA256):
61
+
62
+ ```python
63
+ from burnledger import verify_webhook_signature
64
+
65
+ valid = verify_webhook_signature(
66
+ secret=webhook_secret, # from dp.register_webhook()
67
+ body=request.body, # raw request body
68
+ signature=request.headers["X-BurnLedger-Signature"],
69
+ )
70
+ ```
71
+
72
+ ## API Reference
73
+
74
+ ### Client
75
+
76
+ ```python
77
+ BurnLedger(
78
+ api_key: str,
79
+ *,
80
+ base_url: str = "https://api.burnledger.com",
81
+ timeout: float = 30.0,
82
+ max_retries: int = 2,
83
+ )
84
+ ```
85
+
86
+ ### Systems
87
+
88
+ | Method | Returns |
89
+ |--------|---------|
90
+ | `register_system(**opts)` | `System` |
91
+ | `get_system(id)` | `System` |
92
+ | `list_systems(limit=25)` | `SyncPaginator[System]` |
93
+ | `deregister_system(id)` | `None` |
94
+ | `health_check(id)` | `System` |
95
+
96
+ ### Attestations
97
+
98
+ | Method | Returns |
99
+ |--------|---------|
100
+ | `attest(subject, **opts)` | `Attestation` |
101
+ | `get_attestation(id)` | `Attestation` |
102
+ | `wait_for(id, **opts)` | `Attestation` |
103
+ | `verify(id, subject, **opts)` | `VerifyResult` |
104
+
105
+ ### Certificates
106
+
107
+ | Method | Returns |
108
+ |--------|---------|
109
+ | `get_certificate(id)` | `CertificateResponse` |
110
+ | `list_certificates(limit=25)` | `SyncPaginator[CertificateResponse]` |
111
+ | `download_pdf(id)` | `bytes` |
112
+ | `save_pdf(id, path)` | `None` |
113
+ | `get_revocation_status(id)` | `RevocationStatus` |
114
+ | `revoke_certificate(id, reason=...)` | `CertificateResponse` |
115
+
116
+ ### Webhooks
117
+
118
+ | Method | Returns |
119
+ |--------|---------|
120
+ | `register_webhook(url=...)` | `Webhook` |
121
+ | `list_webhooks(limit=25)` | `SyncPaginator[Webhook]` |
122
+ | `delete_webhook(id)` | `None` |
123
+
124
+ ### Transparency Log
125
+
126
+ These methods do not require authentication.
127
+
128
+ | Method | Returns |
129
+ |--------|---------|
130
+ | `get_log_head()` | `SignedTreeHead` |
131
+ | `get_log_entry(index)` | `LogEntry` |
132
+ | `get_log_entries(start, end)` | `list[LogEntry]` |
133
+ | `get_inclusion_proof(index, tree_size)` | `InclusionProof` |
134
+ | `get_consistency_proof(old_size, new_size)` | `ConsistencyProof` |
135
+
136
+ ### Pagination
137
+
138
+ All `list_*` methods return a paginator that auto-fetches pages:
139
+
140
+ ```python
141
+ for cert in dp.list_certificates():
142
+ print(cert.id)
143
+
144
+ # async
145
+ async for cert in dp.list_certificates():
146
+ print(cert.id)
147
+ ```
148
+
149
+ ## License
150
+
151
+ MIT
@@ -0,0 +1,32 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "burnledger"
7
+ version = "0.1.0"
8
+ description = "Python SDK for the BurnLedger API"
9
+ license = "MIT"
10
+ requires-python = ">=3.10"
11
+ dependencies = [
12
+ "httpx>=0.25.0",
13
+ "cryptography>=41.0.0",
14
+ ]
15
+
16
+ [project.optional-dependencies]
17
+ dev = [
18
+ "pytest>=7.0",
19
+ "pytest-asyncio>=0.21",
20
+ "respx>=0.21",
21
+ "mypy>=1.0",
22
+ ]
23
+
24
+ [tool.setuptools.packages.find]
25
+ where = ["src"]
26
+
27
+ [tool.setuptools.package-data]
28
+ burnledger = ["py.typed"]
29
+
30
+ [tool.pytest.ini_options]
31
+ asyncio_mode = "auto"
32
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,102 @@
1
+ """BurnLedger Python SDK.
2
+
3
+ Usage::
4
+
5
+ from burnledger import BurnLedger
6
+
7
+ with BurnLedger(api_key="dp_...") as dp:
8
+ att = dp.attest("user@example.com", system_ids=["..."])
9
+ result = dp.verify(att.id, "user@example.com", timeout=60)
10
+ cert = dp.get_certificate(result.certificate.id)
11
+ """
12
+
13
+ from burnledger._client import AsyncBurnLedger, BurnLedger
14
+ from burnledger._errors import (
15
+ APIError,
16
+ AuthenticationError,
17
+ ConflictError,
18
+ BurnLedgerError,
19
+ NotFoundError,
20
+ RateLimitError,
21
+ ServerError,
22
+ TimeoutError,
23
+ ValidationError,
24
+ VerificationError,
25
+ )
26
+ from burnledger._models import (
27
+ Attestation,
28
+ AttestationStatus,
29
+ CertificateResponse,
30
+ CertificateStatus,
31
+ ConnectorType,
32
+ ConsistencyProof,
33
+ HashScope,
34
+ HealthStatus,
35
+ InclusionProof,
36
+ LogEntry,
37
+ LogEntryType,
38
+ ProofMode,
39
+ RevocationStatus,
40
+ SignedTreeHead,
41
+ System,
42
+ SystemAttestation,
43
+ TransparencyResult,
44
+ TransparencyStatus,
45
+ VerificationResult,
46
+ VerificationSystem,
47
+ VerifyResult,
48
+ Webhook,
49
+ )
50
+ from burnledger._pagination import AsyncPaginator, SyncPaginator
51
+ from burnledger._verify import PublicKeyInfo, issuance_bytes, verify_certificate, verify_transparency
52
+ from burnledger._webhooks import verify_webhook_signature
53
+
54
+ __all__ = [
55
+ # Clients
56
+ "BurnLedger",
57
+ "AsyncBurnLedger",
58
+ # Verification
59
+ "verify_certificate",
60
+ "verify_transparency",
61
+ "issuance_bytes",
62
+ "verify_webhook_signature",
63
+ "PublicKeyInfo",
64
+ # Models
65
+ "Attestation",
66
+ "CertificateResponse",
67
+ "ConsistencyProof",
68
+ "InclusionProof",
69
+ "LogEntry",
70
+ "RevocationStatus",
71
+ "SignedTreeHead",
72
+ "System",
73
+ "SystemAttestation",
74
+ "VerificationSystem",
75
+ "VerifyResult",
76
+ "Webhook",
77
+ # Enums
78
+ "AttestationStatus",
79
+ "CertificateStatus",
80
+ "ConnectorType",
81
+ "HashScope",
82
+ "HealthStatus",
83
+ "LogEntryType",
84
+ "ProofMode",
85
+ "TransparencyResult",
86
+ "TransparencyStatus",
87
+ "VerificationResult",
88
+ # Pagination
89
+ "AsyncPaginator",
90
+ "SyncPaginator",
91
+ # Errors
92
+ "APIError",
93
+ "AuthenticationError",
94
+ "ConflictError",
95
+ "BurnLedgerError",
96
+ "NotFoundError",
97
+ "RateLimitError",
98
+ "ServerError",
99
+ "TimeoutError",
100
+ "ValidationError",
101
+ "VerificationError",
102
+ ]