sudomimus-native 5.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.
- sudomimus_native-5.0.0/.gitignore +47 -0
- sudomimus_native-5.0.0/PKG-INFO +115 -0
- sudomimus_native-5.0.0/README.md +101 -0
- sudomimus_native-5.0.0/pyproject.toml +26 -0
- sudomimus_native-5.0.0/src/sudomimus_native/__init__.py +79 -0
- sudomimus_native-5.0.0/src/sudomimus_native/_generated/__init__.py +1 -0
- sudomimus_native-5.0.0/src/sudomimus_native/_generated/models.py +344 -0
- sudomimus_native-5.0.0/src/sudomimus_native/async_client.py +118 -0
- sudomimus_native-5.0.0/src/sudomimus_native/client.py +154 -0
- sudomimus_native-5.0.0/src/sudomimus_native/constants.py +11 -0
- sudomimus_native-5.0.0/src/sudomimus_native/errors.py +30 -0
- sudomimus_native-5.0.0/src/sudomimus_native/public_key_assertion.py +80 -0
- sudomimus_native-5.0.0/tests/test_smoke.py +408 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Node / pnpm
|
|
2
|
+
node_modules/
|
|
3
|
+
.pnpm-store/
|
|
4
|
+
.pnp.*
|
|
5
|
+
*.tgz
|
|
6
|
+
|
|
7
|
+
# Build output
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
.turbo/
|
|
11
|
+
*.tsbuildinfo
|
|
12
|
+
|
|
13
|
+
# Python
|
|
14
|
+
__pycache__/
|
|
15
|
+
*.py[cod]
|
|
16
|
+
*$py.class
|
|
17
|
+
*.egg-info/
|
|
18
|
+
.venv/
|
|
19
|
+
venv/
|
|
20
|
+
.uv/
|
|
21
|
+
|
|
22
|
+
# Test / coverage
|
|
23
|
+
coverage/
|
|
24
|
+
.nyc_output/
|
|
25
|
+
.pytest_cache/
|
|
26
|
+
.coverage
|
|
27
|
+
htmlcov/
|
|
28
|
+
|
|
29
|
+
# IDE / editor
|
|
30
|
+
.idea/
|
|
31
|
+
*.swp
|
|
32
|
+
*.swo
|
|
33
|
+
|
|
34
|
+
# OS
|
|
35
|
+
.DS_Store
|
|
36
|
+
Thumbs.db
|
|
37
|
+
|
|
38
|
+
# Environment
|
|
39
|
+
.env
|
|
40
|
+
.env.local
|
|
41
|
+
.env.*.local
|
|
42
|
+
|
|
43
|
+
# CSharp
|
|
44
|
+
bin/
|
|
45
|
+
obj/
|
|
46
|
+
*.dll
|
|
47
|
+
*.pdb
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: sudomimus-native
|
|
3
|
+
Version: 5.0.0
|
|
4
|
+
Summary: Sudomimus Native SDK — native client entry point.
|
|
5
|
+
Project-URL: Homepage, https://sudomimus.com
|
|
6
|
+
Project-URL: Repository, https://github.com/Sudomimus/Sudomimus
|
|
7
|
+
Author: Sudomimus Contributors
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Keywords: authentication,sdk,sudomimus
|
|
10
|
+
Requires-Python: >=3.11
|
|
11
|
+
Requires-Dist: httpx>=0.27
|
|
12
|
+
Requires-Dist: pydantic>=2.7
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# sudomimus-native
|
|
16
|
+
|
|
17
|
+
Python SDK for the Sudomimus Native API — the direct-issue gateway for
|
|
18
|
+
native callers (desktop applications, games, headless processes). Exchange a
|
|
19
|
+
Steam Web API auth ticket, access-key credential, or signed Ed25519 key for application access
|
|
20
|
+
and refresh tokens in a single round trip.
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install sudomimus-native
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from sudomimus_native import NativeClient, DirectIssueSteamTicketRequest
|
|
32
|
+
|
|
33
|
+
with NativeClient() as client:
|
|
34
|
+
tokens = client.direct_issue_steam_ticket(
|
|
35
|
+
DirectIssueSteamTicketRequest(
|
|
36
|
+
applicationAnchor="my-app",
|
|
37
|
+
steamTicketHex="...", # from GetAuthTicketForWebApi("sudomimus")
|
|
38
|
+
steamAppId=480,
|
|
39
|
+
)
|
|
40
|
+
)
|
|
41
|
+
print(tokens.accessToken, tokens.refreshToken)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Access-key credentials (issued in the admin console for headless callers):
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from sudomimus_native import DirectIssueAccessKeyRequest
|
|
48
|
+
|
|
49
|
+
tokens = client.direct_issue_access_key(
|
|
50
|
+
DirectIssueAccessKeyRequest(
|
|
51
|
+
applicationAnchor="my-app",
|
|
52
|
+
accessKeyIdentifier="acs_k_01890c5e-1234-4abc-9def-0123456789ab",
|
|
53
|
+
accessKeySecret="acs_t_<64 lowercase hex chars>",
|
|
54
|
+
)
|
|
55
|
+
)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Registered public-key credentials accept a raw Ed25519 signing callback; the
|
|
59
|
+
SDK creates the short-lived assertion and binds it to the exact request bytes:
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from sudomimus_native import DirectIssuePublicKeyRequest, PublicKeyCredential
|
|
63
|
+
|
|
64
|
+
tokens = client.direct_issue_public_key(
|
|
65
|
+
DirectIssuePublicKeyRequest(applicationAnchor="my-app"),
|
|
66
|
+
PublicKeyCredential("pky_...", private_key.sign),
|
|
67
|
+
)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
An `AsyncNativeClient` with the same methods is available for `asyncio`
|
|
71
|
+
callers. Non-2xx responses raise `NativeApiError` (inspect `.status` and
|
|
72
|
+
`.reason`). Steam and access-key admission failures return `429`, or `503`
|
|
73
|
+
when their counters are unavailable, with no reason body. Back off before
|
|
74
|
+
retrying. Issued tokens are opaque to this SDK; verify them with
|
|
75
|
+
[`sudomimus-token`](../sudomimus-token).
|
|
76
|
+
|
|
77
|
+
## Models
|
|
78
|
+
|
|
79
|
+
Pydantic v2 models are generated from [`specs/native.yaml`](../../../../specs/native.yaml)
|
|
80
|
+
and re-exported from the package root:
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from sudomimus_native import (
|
|
84
|
+
DirectIssueAccessKeyRequest,
|
|
85
|
+
DirectIssueAccessKeyResponse,
|
|
86
|
+
DirectIssuePublicKeyRequest,
|
|
87
|
+
PublicKeyCredential,
|
|
88
|
+
DirectIssueSteamTicketRequest,
|
|
89
|
+
DirectIssueSteamTicketResponse,
|
|
90
|
+
NativeError,
|
|
91
|
+
)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
[MIT](../../../../LICENSE)
|
|
97
|
+
|
|
98
|
+
## Basic Terms confirmation
|
|
99
|
+
|
|
100
|
+
If Steam direct issue returns `403 LegalAgreementRequired`, use `agreement`
|
|
101
|
+
from the error body. Render the complete `document` from one locale, including
|
|
102
|
+
its table and links, and obtain explicit confirmation. Request a fresh Steam
|
|
103
|
+
ticket and send `agreementAcceptance` with the displayed `requiredRevision`,
|
|
104
|
+
the selected `locale`, its `contentSha256`, and `confirmed: true`.
|
|
105
|
+
|
|
106
|
+
A `409 LegalAgreementRevisionMismatch` carries the current `requiredRevision`.
|
|
107
|
+
Start a fresh attempt to retrieve the current challenge and ask the player to
|
|
108
|
+
confirm that version. For AccessKey or PublicKey, display `termsUrl` and ask the
|
|
109
|
+
account holder to accept the terms during a browser sign-in before retrying.
|
|
110
|
+
|
|
111
|
+
The `DirectIssueDeniedError` body exposes the typed `agreement` and
|
|
112
|
+
`termsUrl`. Its locale snapshots are available at `agreement.locales.en_US`
|
|
113
|
+
and `agreement.locales.zh_CN`. Pass an `AgreementAcceptance` to the new
|
|
114
|
+
`DirectIssueSteamTicketRequest`. The `DirectIssueSteamTicketConflictError` body
|
|
115
|
+
exposes `requiredRevision` on a revision conflict.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# sudomimus-native
|
|
2
|
+
|
|
3
|
+
Python SDK for the Sudomimus Native API — the direct-issue gateway for
|
|
4
|
+
native callers (desktop applications, games, headless processes). Exchange a
|
|
5
|
+
Steam Web API auth ticket, access-key credential, or signed Ed25519 key for application access
|
|
6
|
+
and refresh tokens in a single round trip.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install sudomimus-native
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
from sudomimus_native import NativeClient, DirectIssueSteamTicketRequest
|
|
18
|
+
|
|
19
|
+
with NativeClient() as client:
|
|
20
|
+
tokens = client.direct_issue_steam_ticket(
|
|
21
|
+
DirectIssueSteamTicketRequest(
|
|
22
|
+
applicationAnchor="my-app",
|
|
23
|
+
steamTicketHex="...", # from GetAuthTicketForWebApi("sudomimus")
|
|
24
|
+
steamAppId=480,
|
|
25
|
+
)
|
|
26
|
+
)
|
|
27
|
+
print(tokens.accessToken, tokens.refreshToken)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Access-key credentials (issued in the admin console for headless callers):
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from sudomimus_native import DirectIssueAccessKeyRequest
|
|
34
|
+
|
|
35
|
+
tokens = client.direct_issue_access_key(
|
|
36
|
+
DirectIssueAccessKeyRequest(
|
|
37
|
+
applicationAnchor="my-app",
|
|
38
|
+
accessKeyIdentifier="acs_k_01890c5e-1234-4abc-9def-0123456789ab",
|
|
39
|
+
accessKeySecret="acs_t_<64 lowercase hex chars>",
|
|
40
|
+
)
|
|
41
|
+
)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Registered public-key credentials accept a raw Ed25519 signing callback; the
|
|
45
|
+
SDK creates the short-lived assertion and binds it to the exact request bytes:
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from sudomimus_native import DirectIssuePublicKeyRequest, PublicKeyCredential
|
|
49
|
+
|
|
50
|
+
tokens = client.direct_issue_public_key(
|
|
51
|
+
DirectIssuePublicKeyRequest(applicationAnchor="my-app"),
|
|
52
|
+
PublicKeyCredential("pky_...", private_key.sign),
|
|
53
|
+
)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
An `AsyncNativeClient` with the same methods is available for `asyncio`
|
|
57
|
+
callers. Non-2xx responses raise `NativeApiError` (inspect `.status` and
|
|
58
|
+
`.reason`). Steam and access-key admission failures return `429`, or `503`
|
|
59
|
+
when their counters are unavailable, with no reason body. Back off before
|
|
60
|
+
retrying. Issued tokens are opaque to this SDK; verify them with
|
|
61
|
+
[`sudomimus-token`](../sudomimus-token).
|
|
62
|
+
|
|
63
|
+
## Models
|
|
64
|
+
|
|
65
|
+
Pydantic v2 models are generated from [`specs/native.yaml`](../../../../specs/native.yaml)
|
|
66
|
+
and re-exported from the package root:
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from sudomimus_native import (
|
|
70
|
+
DirectIssueAccessKeyRequest,
|
|
71
|
+
DirectIssueAccessKeyResponse,
|
|
72
|
+
DirectIssuePublicKeyRequest,
|
|
73
|
+
PublicKeyCredential,
|
|
74
|
+
DirectIssueSteamTicketRequest,
|
|
75
|
+
DirectIssueSteamTicketResponse,
|
|
76
|
+
NativeError,
|
|
77
|
+
)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
[MIT](../../../../LICENSE)
|
|
83
|
+
|
|
84
|
+
## Basic Terms confirmation
|
|
85
|
+
|
|
86
|
+
If Steam direct issue returns `403 LegalAgreementRequired`, use `agreement`
|
|
87
|
+
from the error body. Render the complete `document` from one locale, including
|
|
88
|
+
its table and links, and obtain explicit confirmation. Request a fresh Steam
|
|
89
|
+
ticket and send `agreementAcceptance` with the displayed `requiredRevision`,
|
|
90
|
+
the selected `locale`, its `contentSha256`, and `confirmed: true`.
|
|
91
|
+
|
|
92
|
+
A `409 LegalAgreementRevisionMismatch` carries the current `requiredRevision`.
|
|
93
|
+
Start a fresh attempt to retrieve the current challenge and ask the player to
|
|
94
|
+
confirm that version. For AccessKey or PublicKey, display `termsUrl` and ask the
|
|
95
|
+
account holder to accept the terms during a browser sign-in before retrying.
|
|
96
|
+
|
|
97
|
+
The `DirectIssueDeniedError` body exposes the typed `agreement` and
|
|
98
|
+
`termsUrl`. Its locale snapshots are available at `agreement.locales.en_US`
|
|
99
|
+
and `agreement.locales.zh_CN`. Pass an `AgreementAcceptance` to the new
|
|
100
|
+
`DirectIssueSteamTicketRequest`. The `DirectIssueSteamTicketConflictError` body
|
|
101
|
+
exposes `requiredRevision` on a revision conflict.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "sudomimus-native"
|
|
3
|
+
version = "5.0.0"
|
|
4
|
+
description = "Sudomimus Native SDK — native client entry point."
|
|
5
|
+
keywords = ["sudomimus", "authentication", "sdk"]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
requires-python = ">=3.11"
|
|
8
|
+
license = "MIT"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "Sudomimus Contributors" },
|
|
11
|
+
]
|
|
12
|
+
dependencies = [
|
|
13
|
+
"httpx>=0.27",
|
|
14
|
+
"pydantic>=2.7",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[project.urls]
|
|
18
|
+
Homepage = "https://sudomimus.com"
|
|
19
|
+
Repository = "https://github.com/Sudomimus/Sudomimus"
|
|
20
|
+
|
|
21
|
+
[build-system]
|
|
22
|
+
requires = ["hatchling"]
|
|
23
|
+
build-backend = "hatchling.build"
|
|
24
|
+
|
|
25
|
+
[tool.hatch.build.targets.wheel]
|
|
26
|
+
packages = ["src/sudomimus_native"]
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""Sudomimus Native SDK.
|
|
2
|
+
|
|
3
|
+
Direct-issue client for native callers: exchange a Steam Web API auth ticket
|
|
4
|
+
or an access-key credential for application access and refresh tokens in a
|
|
5
|
+
single round trip.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from ._generated.models import (
|
|
11
|
+
AgreementAcceptance,
|
|
12
|
+
ClaimRequirementStateView,
|
|
13
|
+
ClaimsStateView,
|
|
14
|
+
CreateErrandRequest,
|
|
15
|
+
CreateErrandResponse,
|
|
16
|
+
DirectIssueAccessKeyRequest,
|
|
17
|
+
DirectIssueAccessKeyResponse,
|
|
18
|
+
DirectIssueDeniedError,
|
|
19
|
+
DirectIssuePublicKeyRequest,
|
|
20
|
+
DirectIssueSteamTicketConflictError,
|
|
21
|
+
DirectIssueSteamTicketRequest,
|
|
22
|
+
DirectIssueSteamTicketResponse,
|
|
23
|
+
ErrandHandoff,
|
|
24
|
+
ErrandStatusResponse,
|
|
25
|
+
NativeLegalAgreementChallenge,
|
|
26
|
+
NativeLegalAgreementDocumentV1,
|
|
27
|
+
NativeLegalAgreementLocale,
|
|
28
|
+
Requirement,
|
|
29
|
+
State,
|
|
30
|
+
)
|
|
31
|
+
from ._generated.models import Error as NativeError
|
|
32
|
+
from ._generated.models import (
|
|
33
|
+
Status1 as Status,
|
|
34
|
+
)
|
|
35
|
+
from .async_client import AsyncNativeClient
|
|
36
|
+
from .client import NativeClient
|
|
37
|
+
from .constants import PRODUCTION_BASE_URL, STEAM_TICKET_IDENTITY
|
|
38
|
+
from .errors import NativeApiError
|
|
39
|
+
from .public_key_assertion import (
|
|
40
|
+
PUBLIC_KEY_ASSERTION_AUDIENCE,
|
|
41
|
+
PUBLIC_KEY_ASSERTION_TYPE,
|
|
42
|
+
PublicKeyCredential,
|
|
43
|
+
SignedPublicKeyRequest,
|
|
44
|
+
sign_public_key_request,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
__all__ = [
|
|
48
|
+
"PRODUCTION_BASE_URL",
|
|
49
|
+
"STEAM_TICKET_IDENTITY",
|
|
50
|
+
"AgreementAcceptance",
|
|
51
|
+
"AsyncNativeClient",
|
|
52
|
+
"ClaimsStateView",
|
|
53
|
+
"ClaimRequirementStateView",
|
|
54
|
+
"CreateErrandRequest",
|
|
55
|
+
"CreateErrandResponse",
|
|
56
|
+
"DirectIssueAccessKeyRequest",
|
|
57
|
+
"DirectIssueAccessKeyResponse",
|
|
58
|
+
"DirectIssuePublicKeyRequest",
|
|
59
|
+
"DirectIssueDeniedError",
|
|
60
|
+
"DirectIssueSteamTicketConflictError",
|
|
61
|
+
"DirectIssueSteamTicketRequest",
|
|
62
|
+
"DirectIssueSteamTicketResponse",
|
|
63
|
+
"ErrandHandoff",
|
|
64
|
+
"ErrandStatusResponse",
|
|
65
|
+
"NativeApiError",
|
|
66
|
+
"NativeClient",
|
|
67
|
+
"NativeError",
|
|
68
|
+
"NativeLegalAgreementChallenge",
|
|
69
|
+
"NativeLegalAgreementDocumentV1",
|
|
70
|
+
"NativeLegalAgreementLocale",
|
|
71
|
+
"PUBLIC_KEY_ASSERTION_AUDIENCE",
|
|
72
|
+
"PUBLIC_KEY_ASSERTION_TYPE",
|
|
73
|
+
"PublicKeyCredential",
|
|
74
|
+
"Requirement",
|
|
75
|
+
"State",
|
|
76
|
+
"Status",
|
|
77
|
+
"SignedPublicKeyRequest",
|
|
78
|
+
"sign_public_key_request",
|
|
79
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Generated models. Do not edit by hand."""
|