dpdpguard-sdk 1.0.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,30 @@
1
+ name: CI
2
+ on: [push, pull_request]
3
+ jobs:
4
+ test:
5
+ runs-on: ubuntu-latest
6
+ strategy:
7
+ fail-fast: false
8
+ matrix:
9
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: actions/setup-python@v5
13
+ with:
14
+ python-version: ${{ matrix.python-version }}
15
+ - run: pip install --upgrade pip
16
+ - run: pip install -e ".[dev]"
17
+ - run: ruff check .
18
+ - run: mypy src
19
+ - run: pytest --cov=src --cov-report=term-missing
20
+
21
+ build:
22
+ runs-on: ubuntu-latest
23
+ needs: test
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ - uses: actions/setup-python@v5
27
+ with: { python-version: "3.12" }
28
+ - run: pip install --upgrade build twine
29
+ - run: python -m build
30
+ - run: twine check dist/*
@@ -0,0 +1,36 @@
1
+ # Publishes to PyPI using Trusted Publishing (OIDC) - no API token stored as
2
+ # a secret. Configure this repo/workflow as a trusted publisher under the
3
+ # project's PyPI settings (pypi.org > your project > Publishing) before the
4
+ # first run: https://docs.pypi.org/trusted-publishers/
5
+ name: Publish
6
+ on:
7
+ release:
8
+ types: [published]
9
+ workflow_dispatch: {}
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with: { python-version: "3.12" }
18
+ - run: pip install --upgrade build
19
+ - run: python -m build
20
+ - uses: actions/upload-artifact@v4
21
+ with:
22
+ name: dist
23
+ path: dist/
24
+
25
+ publish:
26
+ runs-on: ubuntu-latest
27
+ needs: build
28
+ environment: pypi
29
+ permissions:
30
+ id-token: write
31
+ steps:
32
+ - uses: actions/download-artifact@v4
33
+ with:
34
+ name: dist
35
+ path: dist/
36
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,220 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ *.lcov
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ # Pipfile.lock
97
+
98
+ # UV
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ # poetry.lock
110
+ # poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ # pdm.lock
117
+ # pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ # pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi/*
127
+ !.pixi/config.toml
128
+
129
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
130
+ __pypackages__/
131
+
132
+ # Celery stuff
133
+ celerybeat-schedule*
134
+ celerybeat.pid
135
+
136
+ # Redis
137
+ *.rdb
138
+ *.aof
139
+ *.pid
140
+
141
+ # RabbitMQ
142
+ mnesia/
143
+ rabbitmq/
144
+ rabbitmq-data/
145
+
146
+ # ActiveMQ
147
+ activemq-data/
148
+
149
+ # SageMath parsed files
150
+ *.sage.py
151
+
152
+ # Environments
153
+ .env
154
+ .envrc
155
+ .venv
156
+ env/
157
+ venv/
158
+ ENV/
159
+ env.bak/
160
+ venv.bak/
161
+
162
+ # Spyder project settings
163
+ .spyderproject
164
+ .spyproject
165
+
166
+ # Rope project settings
167
+ .ropeproject
168
+
169
+ # mkdocs documentation
170
+ /site
171
+
172
+ # mypy
173
+ .mypy_cache/
174
+ .dmypy.json
175
+ dmypy.json
176
+
177
+ # Pyre type checker
178
+ .pyre/
179
+
180
+ # pytype static type analyzer
181
+ .pytype/
182
+
183
+ # Cython debug symbols
184
+ cython_debug/
185
+
186
+ # PyCharm
187
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
188
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
189
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
190
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
191
+ # .idea/
192
+
193
+ # Abstra
194
+ # Abstra is an AI-powered process automation framework.
195
+ # Ignore directories containing user credentials, local state, and settings.
196
+ # Learn more at https://abstra.io/docs
197
+ .abstra/
198
+
199
+ # Visual Studio Code
200
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
201
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
202
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
203
+ # you could uncomment the following to ignore the entire vscode folder
204
+ # .vscode/
205
+ # Temporary file for partial code execution
206
+ tempCodeRunnerFile.py
207
+
208
+ # Ruff stuff:
209
+ .ruff_cache/
210
+
211
+ # PyPI configuration file
212
+ .pypirc
213
+
214
+ # Marimo
215
+ marimo/_static/
216
+ marimo/_lsp/
217
+ __marimo__/
218
+
219
+ # Streamlit
220
+ .streamlit/secrets.toml
@@ -0,0 +1,30 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2026-07-30
9
+
10
+ ### Added
11
+
12
+ - `DpdpGuardClient` — typed client over `/api/v1` (spec §4.2): public reads
13
+ (`get_organization`, `get_notices`, `get_notice`, `get_banner_config`),
14
+ token brokering (`broker_token`, `link_anonymous_consent`), DSR
15
+ (`list_dsr_requests`, `create_dsr_request` with `Idempotency-Key` support),
16
+ grievances (`list_grievances`, `create_grievance`), and nomination
17
+ (`get_nomination`, `upsert_nomination`, `revoke_nomination`). Mirrors
18
+ `@dpdpguard/server` (Node/TypeScript) method for method.
19
+ - `DpdpGuardApiError` and the ADR-002 error catalog (`ERROR_CATALOG`,
20
+ `ApiErrorCode`), vendored from `@dpdpguard/contract/conformance/error-catalog.json`.
21
+ - `has_consent` / `ConsentRecord` — pure consent-gate helper.
22
+ - `verify_webhook_signature` — HMAC-SHA256 verification of the
23
+ `X-DPDP-Signature` header, constant-time comparison.
24
+ - `canonicalize_audit_event` / `compute_audit_hash` / `AuditHashInput` — audit-hash
25
+ canonicalization matching `convex/lib/auditHash.ts`, verified against the
26
+ vendored golden vectors in `_data/audit-hash-vectors.json`.
27
+ - Every request sends `X-DPDP-SDK: python/<version>` for SDK-version
28
+ identification (spec §6.1 / ADR-002 D6).
29
+ - Typed wire models (`OrgSummary`, `Notice`, `DsrRequest`, `Grievance`,
30
+ `Nomination`, etc.) hand-kept in sync with `openapi/v1.yaml`.
@@ -0,0 +1,21 @@
1
+ MIT License Copyright (c) 2026 Chintan Shah
2
+
3
+ Permission is hereby granted, free
4
+ of charge, to any person obtaining a copy of this software and associated
5
+ documentation files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use, copy, modify, merge,
7
+ publish, distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to the
9
+ following conditions:
10
+
11
+ The above copyright notice and this permission notice
12
+ (including the next paragraph) shall be included in all copies or substantial
13
+ portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
16
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
18
+ EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,139 @@
1
+ Metadata-Version: 2.4
2
+ Name: dpdpguard-sdk
3
+ Version: 1.0.0
4
+ Summary: DPDP Guard Server SDK (Python) - typed API client, consent gate, token broker, webhook verifier
5
+ Project-URL: Homepage, https://github.com/dpdp-guard-ai/dpdpguard-python-sdk
6
+ Project-URL: Spec, https://github.com/chintans/dpdpbot/blob/main/docs/specs/mobile-server-sdk.md
7
+ Author: DPDP Guard
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.9
21
+ Requires-Dist: httpx>=0.27
22
+ Provides-Extra: dev
23
+ Requires-Dist: mypy>=1.10; extra == 'dev'
24
+ Requires-Dist: pytest-cov>=5; extra == 'dev'
25
+ Requires-Dist: pytest>=8; extra == 'dev'
26
+ Requires-Dist: ruff>=0.5; extra == 'dev'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # dpdpguard-python-sdk
30
+
31
+ DPDP Guard Server SDK (Python) — typed API client, consent gate, token broker
32
+ helper, audit-hash verifier, and webhook signature verifier over DPDP Guard's
33
+ public `/api/v1` (spec §4.2).
34
+
35
+ PyPI distribution: `dpdpguard-sdk` · Import as: `dpdpguard`
36
+
37
+ Part of the DPDP Guard SDK family. See the design spec:
38
+ https://github.com/chintans/dpdpbot/blob/main/docs/specs/mobile-server-sdk.md
39
+
40
+ This SDK mirrors [`@dpdpguard/server`](https://www.npmjs.com/package/@dpdpguard/server)
41
+ (the Node/TypeScript reference implementation) method for method, so behavior —
42
+ auth modes, idempotency headers, error codes, audit-hash canonicalization — stays
43
+ identical across ecosystems (ADR-001's audit-uniformity goal).
44
+
45
+ ## Install
46
+
47
+ ```bash
48
+ pip install dpdpguard-sdk
49
+ ```
50
+
51
+ ## Usage
52
+
53
+ ```python
54
+ import os
55
+ from dpdpguard import DpdpGuardClient, has_consent, verify_webhook_signature
56
+
57
+ client = DpdpGuardClient(
58
+ "https://<your-deployment>.convex.site",
59
+ api_key=os.environ["DPDP_SERVICE_API_KEY"], # convex/apiKeys.ts, for broker_token() only
60
+ )
61
+
62
+ # Mint a brokered principal access token (ADR-004 D1/D2) for a known user.
63
+ client.broker_token(external_id)
64
+
65
+ # Now authenticated calls use that token automatically.
66
+ result = client.list_dsr_requests()
67
+ client.create_dsr_request(organization_id=org_id, type="erasure")
68
+
69
+ # Public reads need no auth at all.
70
+ org = client.get_organization("acme")
71
+ notices = client.get_notices(org["orgId"])
72
+
73
+ # Verify an inbound webhook (convex/webhooks.ts's X-DPDP-Signature header).
74
+ ok = verify_webhook_signature(webhook_secret, raw_body, request.headers.get("x-dpdp-signature"))
75
+ ```
76
+
77
+ Use it as a context manager to close the underlying `httpx.Client` automatically:
78
+
79
+ ```python
80
+ with DpdpGuardClient(base_url) as client:
81
+ org = client.get_organization("acme")
82
+ ```
83
+
84
+ Every non-2xx response raises a `DpdpGuardApiError` with a `code` from the
85
+ ADR-002 error catalog (`err.code`, e.g. `"NOT_FOUND"`) and the HTTP `status`.
86
+
87
+ ### Consent gate
88
+
89
+ ```python
90
+ from dpdpguard import has_consent
91
+
92
+ if not has_consent(consents, "Marketing"):
93
+ return # don't send the campaign
94
+ ```
95
+
96
+ ### Audit-hash verification
97
+
98
+ A holder of the platform's `DPDP_AUDIT_HASH_HMAC_SECRET` can independently
99
+ verify a `consentAuditTrail` row's `auditHash`:
100
+
101
+ ```python
102
+ from dpdpguard import AuditHashInput, compute_audit_hash
103
+
104
+ input = AuditHashInput(
105
+ organization_id="org_abc123",
106
+ notice_id="notice_v1",
107
+ notice_version=1,
108
+ purpose="Newsletter",
109
+ data_types=["email"],
110
+ given_at=1700000000000,
111
+ source="direct",
112
+ )
113
+ assert compute_audit_hash(input, secret) == stored_audit_hash
114
+ ```
115
+
116
+ ## Contract
117
+
118
+ This package vendors its wire contract from `dpdpbot`'s single source of
119
+ truth (ADR-001/002) rather than depending on a published `@dpdpguard/contract`
120
+ Python package (none exists yet):
121
+
122
+ - `src/dpdpguard/models.py` is hand-kept in sync with `openapi/v1.yaml`'s
123
+ `components.schemas`.
124
+ - `src/dpdpguard/errors.py` loads `_data/error-catalog.json`, vendored
125
+ verbatim from `@dpdpguard/contract/conformance/error-catalog.json`
126
+ (ADR-002 D2).
127
+ - `tests/test_audit_hash.py` runs `_data/audit-hash-vectors.json` (vendored
128
+ from `@dpdpguard/contract/conformance/audit-hash-vectors.json`) as a
129
+ required CI gate (ADR-002 D5) — a failure means this SDK's `audit_hash.py`
130
+ has drifted from `convex/lib/auditHash.ts`.
131
+
132
+ ## Development
133
+
134
+ ```bash
135
+ pip install -e ".[dev]"
136
+ ruff check .
137
+ mypy src
138
+ pytest --cov=src --cov-report=term-missing
139
+ ```
@@ -0,0 +1,111 @@
1
+ # dpdpguard-python-sdk
2
+
3
+ DPDP Guard Server SDK (Python) — typed API client, consent gate, token broker
4
+ helper, audit-hash verifier, and webhook signature verifier over DPDP Guard's
5
+ public `/api/v1` (spec §4.2).
6
+
7
+ PyPI distribution: `dpdpguard-sdk` · Import as: `dpdpguard`
8
+
9
+ Part of the DPDP Guard SDK family. See the design spec:
10
+ https://github.com/chintans/dpdpbot/blob/main/docs/specs/mobile-server-sdk.md
11
+
12
+ This SDK mirrors [`@dpdpguard/server`](https://www.npmjs.com/package/@dpdpguard/server)
13
+ (the Node/TypeScript reference implementation) method for method, so behavior —
14
+ auth modes, idempotency headers, error codes, audit-hash canonicalization — stays
15
+ identical across ecosystems (ADR-001's audit-uniformity goal).
16
+
17
+ ## Install
18
+
19
+ ```bash
20
+ pip install dpdpguard-sdk
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ```python
26
+ import os
27
+ from dpdpguard import DpdpGuardClient, has_consent, verify_webhook_signature
28
+
29
+ client = DpdpGuardClient(
30
+ "https://<your-deployment>.convex.site",
31
+ api_key=os.environ["DPDP_SERVICE_API_KEY"], # convex/apiKeys.ts, for broker_token() only
32
+ )
33
+
34
+ # Mint a brokered principal access token (ADR-004 D1/D2) for a known user.
35
+ client.broker_token(external_id)
36
+
37
+ # Now authenticated calls use that token automatically.
38
+ result = client.list_dsr_requests()
39
+ client.create_dsr_request(organization_id=org_id, type="erasure")
40
+
41
+ # Public reads need no auth at all.
42
+ org = client.get_organization("acme")
43
+ notices = client.get_notices(org["orgId"])
44
+
45
+ # Verify an inbound webhook (convex/webhooks.ts's X-DPDP-Signature header).
46
+ ok = verify_webhook_signature(webhook_secret, raw_body, request.headers.get("x-dpdp-signature"))
47
+ ```
48
+
49
+ Use it as a context manager to close the underlying `httpx.Client` automatically:
50
+
51
+ ```python
52
+ with DpdpGuardClient(base_url) as client:
53
+ org = client.get_organization("acme")
54
+ ```
55
+
56
+ Every non-2xx response raises a `DpdpGuardApiError` with a `code` from the
57
+ ADR-002 error catalog (`err.code`, e.g. `"NOT_FOUND"`) and the HTTP `status`.
58
+
59
+ ### Consent gate
60
+
61
+ ```python
62
+ from dpdpguard import has_consent
63
+
64
+ if not has_consent(consents, "Marketing"):
65
+ return # don't send the campaign
66
+ ```
67
+
68
+ ### Audit-hash verification
69
+
70
+ A holder of the platform's `DPDP_AUDIT_HASH_HMAC_SECRET` can independently
71
+ verify a `consentAuditTrail` row's `auditHash`:
72
+
73
+ ```python
74
+ from dpdpguard import AuditHashInput, compute_audit_hash
75
+
76
+ input = AuditHashInput(
77
+ organization_id="org_abc123",
78
+ notice_id="notice_v1",
79
+ notice_version=1,
80
+ purpose="Newsletter",
81
+ data_types=["email"],
82
+ given_at=1700000000000,
83
+ source="direct",
84
+ )
85
+ assert compute_audit_hash(input, secret) == stored_audit_hash
86
+ ```
87
+
88
+ ## Contract
89
+
90
+ This package vendors its wire contract from `dpdpbot`'s single source of
91
+ truth (ADR-001/002) rather than depending on a published `@dpdpguard/contract`
92
+ Python package (none exists yet):
93
+
94
+ - `src/dpdpguard/models.py` is hand-kept in sync with `openapi/v1.yaml`'s
95
+ `components.schemas`.
96
+ - `src/dpdpguard/errors.py` loads `_data/error-catalog.json`, vendored
97
+ verbatim from `@dpdpguard/contract/conformance/error-catalog.json`
98
+ (ADR-002 D2).
99
+ - `tests/test_audit_hash.py` runs `_data/audit-hash-vectors.json` (vendored
100
+ from `@dpdpguard/contract/conformance/audit-hash-vectors.json`) as a
101
+ required CI gate (ADR-002 D5) — a failure means this SDK's `audit_hash.py`
102
+ has drifted from `convex/lib/auditHash.ts`.
103
+
104
+ ## Development
105
+
106
+ ```bash
107
+ pip install -e ".[dev]"
108
+ ruff check .
109
+ mypy src
110
+ pytest --cov=src --cov-report=term-missing
111
+ ```
@@ -0,0 +1,54 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "dpdpguard-sdk"
7
+ version = "1.0.0"
8
+ description = "DPDP Guard Server SDK (Python) - typed API client, consent gate, token broker, webhook verifier"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.9"
12
+ authors = [{ name = "DPDP Guard" }]
13
+ classifiers = [
14
+ "Development Status :: 5 - Production/Stable",
15
+ "Intended Audience :: Developers",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.9",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Typing :: Typed",
24
+ ]
25
+ dependencies = [
26
+ "httpx>=0.27",
27
+ ]
28
+
29
+ [project.optional-dependencies]
30
+ dev = [
31
+ "pytest>=8",
32
+ "pytest-cov>=5",
33
+ "ruff>=0.5",
34
+ "mypy>=1.10",
35
+ ]
36
+
37
+ [project.urls]
38
+ Homepage = "https://github.com/dpdp-guard-ai/dpdpguard-python-sdk"
39
+ Spec = "https://github.com/chintans/dpdpbot/blob/main/docs/specs/mobile-server-sdk.md"
40
+
41
+ [tool.hatch.build.targets.wheel]
42
+ packages = ["src/dpdpguard"]
43
+
44
+ [tool.hatch.build.targets.wheel.force-include]
45
+ "src/dpdpguard/_data/error-catalog.json" = "dpdpguard/_data/error-catalog.json"
46
+ "src/dpdpguard/_data/audit-hash-vectors.json" = "dpdpguard/_data/audit-hash-vectors.json"
47
+
48
+ [tool.ruff]
49
+ line-length = 100
50
+ src = ["src", "tests"]
51
+
52
+ [tool.mypy]
53
+ strict = true
54
+ packages = ["dpdpguard"]
@@ -0,0 +1,24 @@
1
+ """DPDP Guard Server SDK (Python) - typed API client, consent gate, token broker, webhook verifier"""
2
+
3
+ from .audit_hash import AuditHashInput, canonicalize_audit_event, compute_audit_hash
4
+ from .client import DpdpGuardClient
5
+ from .consent_gate import ConsentRecord, has_consent
6
+ from .errors import ERROR_CATALOG, ApiErrorCode, DpdpGuardApiError, ErrorCatalogEntry
7
+ from .webhook_verifier import verify_webhook_signature
8
+
9
+ __version__ = "1.0.0"
10
+
11
+ __all__ = [
12
+ "ERROR_CATALOG",
13
+ "ApiErrorCode",
14
+ "AuditHashInput",
15
+ "ConsentRecord",
16
+ "DpdpGuardApiError",
17
+ "DpdpGuardClient",
18
+ "ErrorCatalogEntry",
19
+ "__version__",
20
+ "canonicalize_audit_event",
21
+ "compute_audit_hash",
22
+ "has_consent",
23
+ "verify_webhook_signature",
24
+ ]
File without changes