sudomimus-native 5.0.0__py3-none-any.whl
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/__init__.py +79 -0
- sudomimus_native/_generated/__init__.py +1 -0
- sudomimus_native/_generated/models.py +344 -0
- sudomimus_native/async_client.py +118 -0
- sudomimus_native/client.py +154 -0
- sudomimus_native/constants.py +11 -0
- sudomimus_native/errors.py +30 -0
- sudomimus_native/public_key_assertion.py +80 -0
- sudomimus_native-5.0.0.dist-info/METADATA +115 -0
- sudomimus_native-5.0.0.dist-info/RECORD +11 -0
- sudomimus_native-5.0.0.dist-info/WHEEL +4 -0
|
@@ -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."""
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
# generated by datamodel-codegen:
|
|
2
|
+
# filename: native.yaml
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from enum import StrEnum
|
|
7
|
+
from typing import Literal
|
|
8
|
+
|
|
9
|
+
from pydantic import AnyUrl, AwareDatetime, BaseModel, ConfigDict, Field
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Status(StrEnum):
|
|
13
|
+
"""
|
|
14
|
+
The API invocation path completed successfully.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
ok = "ok"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class HealthResponse(BaseModel):
|
|
21
|
+
model_config = ConfigDict(
|
|
22
|
+
extra="forbid",
|
|
23
|
+
)
|
|
24
|
+
status: Status = Field(
|
|
25
|
+
..., description="The API invocation path completed successfully."
|
|
26
|
+
)
|
|
27
|
+
service: str = Field(..., description="Stable runtime service identity.")
|
|
28
|
+
version: str = Field(
|
|
29
|
+
..., description="Version from the deployed service's version manifest."
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class DirectIssueAccessKeyRequest(BaseModel):
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
extra="forbid",
|
|
36
|
+
)
|
|
37
|
+
applicationAnchor: str = Field(
|
|
38
|
+
..., description="Public anchor identifying the integrating application."
|
|
39
|
+
)
|
|
40
|
+
accessKeyIdentifier: str = Field(
|
|
41
|
+
...,
|
|
42
|
+
description="Canonical access-key identifier, including the mandatory\n`acs_k_` prefix followed by its UUID.\n",
|
|
43
|
+
pattern="^acs_k_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$",
|
|
44
|
+
)
|
|
45
|
+
accessKeySecret: str = Field(
|
|
46
|
+
...,
|
|
47
|
+
description="Canonical access-key secret, including the mandatory `acs_t_`\nprefix followed by 64 lowercase hexadecimal characters (32\nrandom bytes). Returned only when the access key is issued.\n",
|
|
48
|
+
pattern="^acs_t_[0-9a-f]{64}$",
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class DirectIssuePublicKeyRequest(BaseModel):
|
|
53
|
+
model_config = ConfigDict(
|
|
54
|
+
extra="forbid",
|
|
55
|
+
)
|
|
56
|
+
applicationAnchor: str = Field(
|
|
57
|
+
..., description="Public anchor identifying the integrating application."
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class Locale(StrEnum):
|
|
62
|
+
en_US = "en-US"
|
|
63
|
+
zh_CN = "zh-CN"
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class AgreementAcceptance(BaseModel):
|
|
67
|
+
"""
|
|
68
|
+
Present only after the native client displayed the complete
|
|
69
|
+
versioned basic terms and received an affirmative confirmation.
|
|
70
|
+
A prior `LegalAgreementRequired` response supplies the text and
|
|
71
|
+
digest. Use a new Steam ticket for this retry.
|
|
72
|
+
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
model_config = ConfigDict(
|
|
76
|
+
extra="forbid",
|
|
77
|
+
)
|
|
78
|
+
revision: int = Field(..., ge=1)
|
|
79
|
+
locale: Locale
|
|
80
|
+
contentSha256: str = Field(..., pattern="^[a-f0-9]{64}$")
|
|
81
|
+
confirmed: Literal[True]
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class DirectIssueSteamTicketRequest(BaseModel):
|
|
85
|
+
model_config = ConfigDict(
|
|
86
|
+
extra="forbid",
|
|
87
|
+
)
|
|
88
|
+
applicationAnchor: str = Field(
|
|
89
|
+
..., description="Public anchor identifying the integrating application."
|
|
90
|
+
)
|
|
91
|
+
steamTicketHex: str = Field(
|
|
92
|
+
...,
|
|
93
|
+
description='Hex-encoded Steam Web API auth ticket bytes returned from\n`ISteamUser::GetAuthTicketForWebApi("sudomimus")`. Hexadecimal\ncharacters are case-insensitive.\n',
|
|
94
|
+
max_length=5120,
|
|
95
|
+
min_length=2,
|
|
96
|
+
pattern="^(?:[0-9a-fA-F]{2}){1,2560}$",
|
|
97
|
+
)
|
|
98
|
+
steamAppId: int = Field(
|
|
99
|
+
...,
|
|
100
|
+
description="Steam App ID under which the ticket was generated. Must be\nallow-listed by the application's `STEAM_TICKET` authentication\nrule. Steam binds tickets to their issuing App ID; passing a\ndifferent value fails verification.\n",
|
|
101
|
+
ge=1,
|
|
102
|
+
)
|
|
103
|
+
agreementAcceptance: AgreementAcceptance | None = Field(
|
|
104
|
+
None,
|
|
105
|
+
description="Present only after the native client displayed the complete\nversioned basic terms and received an affirmative confirmation.\nA prior `LegalAgreementRequired` response supplies the text and\ndigest. Use a new Steam ticket for this retry.\n",
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class Requirement(StrEnum):
|
|
110
|
+
"""
|
|
111
|
+
The developer's policy for the claim. `SYNTHETIC_ONLY` always
|
|
112
|
+
emits the generated placeholder and never asks for real data.
|
|
113
|
+
`SYNTHETIC_FALLBACK` guarantees the claim is present but uses a
|
|
114
|
+
generated placeholder (a stand-in name, a proxy email, or a
|
|
115
|
+
generated avatar) when the user has not shared real data. Unlike `REQUIRED`, neither
|
|
116
|
+
synthetic mode blocks issuance or raises an errand.
|
|
117
|
+
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
SYNTHETIC_ONLY = "SYNTHETIC_ONLY"
|
|
121
|
+
OFF = "OFF"
|
|
122
|
+
OPTIONAL = "OPTIONAL"
|
|
123
|
+
REQUIRED = "REQUIRED"
|
|
124
|
+
SYNTHETIC_FALLBACK = "SYNTHETIC_FALLBACK"
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class State(StrEnum):
|
|
128
|
+
UNKNOWN = "UNKNOWN"
|
|
129
|
+
GRANTED = "GRANTED"
|
|
130
|
+
DENIED = "DENIED"
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
class ClaimRequirementStateView(BaseModel):
|
|
134
|
+
"""
|
|
135
|
+
One shareable claim: what the application requests (`requirement`)
|
|
136
|
+
joined with the user's standing decision (`state`). `UNKNOWN` means
|
|
137
|
+
the user was never asked; `DENIED` means the user explicitly
|
|
138
|
+
declined.
|
|
139
|
+
|
|
140
|
+
"""
|
|
141
|
+
|
|
142
|
+
requirement: Requirement = Field(
|
|
143
|
+
...,
|
|
144
|
+
description="The developer's policy for the claim. `SYNTHETIC_ONLY` always\nemits the generated placeholder and never asks for real data.\n`SYNTHETIC_FALLBACK` guarantees the claim is present but uses a\ngenerated placeholder (a stand-in name, a proxy email, or a\ngenerated avatar) when the user has not shared real data. Unlike `REQUIRED`, neither\nsynthetic mode blocks issuance or raises an errand.\n",
|
|
145
|
+
)
|
|
146
|
+
state: State
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
class ClaimsStateView(BaseModel):
|
|
150
|
+
"""
|
|
151
|
+
Policy and consent view for UserInfo disclosure, carried on both
|
|
152
|
+
the 200 response and claim-gate 403 (what is still owed). Avatar
|
|
153
|
+
animation is subordinate and never blocks admission.
|
|
154
|
+
|
|
155
|
+
"""
|
|
156
|
+
|
|
157
|
+
email: ClaimRequirementStateView
|
|
158
|
+
firstName: ClaimRequirementStateView
|
|
159
|
+
lastName: ClaimRequirementStateView
|
|
160
|
+
avatar: ClaimRequirementStateView
|
|
161
|
+
avatarAnimation: ClaimRequirementStateView = Field(
|
|
162
|
+
...,
|
|
163
|
+
description="Derived animation request (OFF, OPTIONAL, or SYNTHETIC_ONLY) and subordinate account-animation consent. Animation never blocks admission.",
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
class ErrandHandoff(BaseModel):
|
|
168
|
+
"""
|
|
169
|
+
The browser side-trip that unblocks a claim-gated direct-issue:
|
|
170
|
+
a short-lived, single-use bearer URL where the user authenticates when
|
|
171
|
+
required, completes missing data, and manages consent. Open the URL and
|
|
172
|
+
let the browser page guide the user.
|
|
173
|
+
|
|
174
|
+
"""
|
|
175
|
+
|
|
176
|
+
errandKey: str = Field(
|
|
177
|
+
..., description="Bearer key (`ernd_…`); also the status-poll path key."
|
|
178
|
+
)
|
|
179
|
+
url: AnyUrl = Field(..., description="Open this in the user's system browser.")
|
|
180
|
+
expiresAt: AwareDatetime
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
class DirectIssueSteamTicketConflictError(BaseModel):
|
|
184
|
+
reason: str = Field(..., description="Stable machine-readable reason code.")
|
|
185
|
+
requiredRevision: int | None = Field(
|
|
186
|
+
None,
|
|
187
|
+
description="Current basic terms revision when the submitted acceptance does not match it.",
|
|
188
|
+
ge=1,
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
class Row(BaseModel):
|
|
193
|
+
model_config = ConfigDict(
|
|
194
|
+
extra="forbid",
|
|
195
|
+
)
|
|
196
|
+
text: str
|
|
197
|
+
url: AnyUrl | None = None
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
class Table(BaseModel):
|
|
201
|
+
"""
|
|
202
|
+
Render the complete reference table and its footer alongside the section paragraphs.
|
|
203
|
+
"""
|
|
204
|
+
|
|
205
|
+
model_config = ConfigDict(
|
|
206
|
+
extra="forbid",
|
|
207
|
+
)
|
|
208
|
+
caption: str
|
|
209
|
+
columns: list[str] = Field(..., min_length=1)
|
|
210
|
+
rows: list[list[Row]]
|
|
211
|
+
footer: str
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
class Link(BaseModel):
|
|
215
|
+
model_config = ConfigDict(
|
|
216
|
+
extra="forbid",
|
|
217
|
+
)
|
|
218
|
+
label: str
|
|
219
|
+
url: AnyUrl
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
class Section(BaseModel):
|
|
223
|
+
model_config = ConfigDict(
|
|
224
|
+
extra="forbid",
|
|
225
|
+
)
|
|
226
|
+
heading: str
|
|
227
|
+
paragraphs: list[str] = Field(..., min_length=1)
|
|
228
|
+
table: Table | None = Field(
|
|
229
|
+
None,
|
|
230
|
+
description="Render the complete reference table and its footer alongside the section paragraphs.",
|
|
231
|
+
)
|
|
232
|
+
link: Link | None = None
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
class NativeLegalAgreementDocumentV1(BaseModel):
|
|
236
|
+
model_config = ConfigDict(
|
|
237
|
+
extra="forbid",
|
|
238
|
+
)
|
|
239
|
+
schemaVersion: Literal[1]
|
|
240
|
+
title: str
|
|
241
|
+
sections: list[Section]
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
class CreateErrandRequest(BaseModel):
|
|
245
|
+
model_config = ConfigDict(
|
|
246
|
+
extra="forbid",
|
|
247
|
+
)
|
|
248
|
+
accessToken: str = Field(
|
|
249
|
+
...,
|
|
250
|
+
description="A current application access token (JWT) for the user. The token\nmust be unexpired and its session must remain active.\n",
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
class CreateErrandResponse(BaseModel):
|
|
255
|
+
errand: ErrandHandoff | None = Field(
|
|
256
|
+
...,
|
|
257
|
+
description="The browser side-trip to open, or `null` when the account already\nsatisfies the application's claim policy (nothing to consent to or\ncomplete) — in that case just direct-issue.\n",
|
|
258
|
+
)
|
|
259
|
+
claims: ClaimsStateView
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
class Status1(StrEnum):
|
|
263
|
+
PENDING = "PENDING"
|
|
264
|
+
COMPLETED = "COMPLETED"
|
|
265
|
+
EXPIRED = "EXPIRED"
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
class ErrandStatusResponse(BaseModel):
|
|
269
|
+
status: Status1
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
class Error(BaseModel):
|
|
273
|
+
"""
|
|
274
|
+
Error response body. Known failures may include a stable `reason`.
|
|
275
|
+
Some failures are status-only and have an empty body. A missing,
|
|
276
|
+
malformed, or structurally invalid JSON body returns `InvalidBody`.
|
|
277
|
+
|
|
278
|
+
"""
|
|
279
|
+
|
|
280
|
+
reason: str | None = Field(None, description="Stable machine-readable reason code.")
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
class DirectIssueAccessKeyResponse(BaseModel):
|
|
284
|
+
claims: ClaimsStateView
|
|
285
|
+
applicationAnchor: str
|
|
286
|
+
accessToken: str = Field(
|
|
287
|
+
...,
|
|
288
|
+
description="Account credentials use media type\n`vnd.sudomimus.application-access+jwt`. Workload credentials use\n`vnd.sudomimus.workload-access+jwt` and add exact\n`act: {sub: <pairwise-workload-subject>}`. In both cases payload\n`sub` is the owner Account's pairwise sector subject, `sid`\nidentifies the session, and `jti` identifies this token instance.\nThe token contains no profile claims or raw Account/Workload\nidentifier; use Session API `/userinfo` for current shared data.\n",
|
|
289
|
+
)
|
|
290
|
+
refreshToken: str = Field(
|
|
291
|
+
...,
|
|
292
|
+
description="Long-lived refresh token JWT with stable payload `sid`, version identifier `jti`, and positive `rotationVersion`. It contains no user identifier. Use Session API `/refresh` for renewal without re-presenting the access key.",
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
class DirectIssueSteamTicketResponse(BaseModel):
|
|
297
|
+
claims: ClaimsStateView
|
|
298
|
+
applicationAnchor: str
|
|
299
|
+
accessToken: str = Field(
|
|
300
|
+
...,
|
|
301
|
+
description="Short-lived access token (JWT). Payload `sub` is the pairwise\nsector subject, `sid` identifies the session, and\n`jti` identifies this token instance. It contains no profile claims\nor raw account identifier; use Session API `/userinfo` for current\nshared identity data.\n",
|
|
302
|
+
)
|
|
303
|
+
refreshToken: str = Field(
|
|
304
|
+
...,
|
|
305
|
+
description="Long-lived refresh token JWT with stable payload `sid`, version identifier `jti`, and positive `rotationVersion`. It contains no user identifier. Use Session API `/refresh` to obtain a new access token without re-acquiring a Steam ticket.",
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
class NativeLegalAgreementLocale(BaseModel):
|
|
310
|
+
contentSha256: str = Field(..., pattern="^[a-f0-9]{64}$")
|
|
311
|
+
versionUrl: AnyUrl
|
|
312
|
+
document: NativeLegalAgreementDocumentV1
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
class Locales(BaseModel):
|
|
316
|
+
en_US: NativeLegalAgreementLocale = Field(..., alias="en-US")
|
|
317
|
+
zh_CN: NativeLegalAgreementLocale = Field(..., alias="zh-CN")
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
class NativeLegalAgreementChallenge(BaseModel):
|
|
321
|
+
documentType: Literal["BASIC_TERMS"]
|
|
322
|
+
requiredRevision: int = Field(..., ge=1)
|
|
323
|
+
requiredAcceptanceEpoch: int = Field(..., ge=1)
|
|
324
|
+
locales: Locales
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
class DirectIssueDeniedError(BaseModel):
|
|
328
|
+
"""
|
|
329
|
+
403 body. For the claim-gate reasons (`ClaimConsentRequired`,
|
|
330
|
+
`RequiredClaimDataMissing`) the `claims` view and the `errand`
|
|
331
|
+
handoff are present. For `LegalAgreementRequired`, `agreement` contains
|
|
332
|
+
the complete versioned basic terms for Steam native presentation, or
|
|
333
|
+
`termsUrl` identifies the version to accept during browser sign-in for
|
|
334
|
+
provisioned AccessKey and PublicKey credentials.
|
|
335
|
+
|
|
336
|
+
"""
|
|
337
|
+
|
|
338
|
+
reason: str = Field(..., description="Stable machine-readable reason code.")
|
|
339
|
+
requiredRevision: int | None = Field(None, ge=1)
|
|
340
|
+
termsUrl: AnyUrl | None = None
|
|
341
|
+
confirmation: str | None = None
|
|
342
|
+
claims: ClaimsStateView | None = None
|
|
343
|
+
errand: ErrandHandoff | None = None
|
|
344
|
+
agreement: NativeLegalAgreementChallenge | None = None
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"""Asynchronous Native API HTTP client."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from types import TracebackType
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
from pydantic import BaseModel
|
|
9
|
+
|
|
10
|
+
from ._generated.models import (
|
|
11
|
+
CreateErrandRequest,
|
|
12
|
+
CreateErrandResponse,
|
|
13
|
+
DirectIssueAccessKeyRequest,
|
|
14
|
+
DirectIssueAccessKeyResponse,
|
|
15
|
+
DirectIssuePublicKeyRequest,
|
|
16
|
+
DirectIssueSteamTicketRequest,
|
|
17
|
+
DirectIssueSteamTicketResponse,
|
|
18
|
+
ErrandStatusResponse,
|
|
19
|
+
)
|
|
20
|
+
from .client import _JSON_HEADERS, _handle, _ResponseT
|
|
21
|
+
from .constants import PRODUCTION_BASE_URL
|
|
22
|
+
from .public_key_assertion import PublicKeyCredential, sign_public_key_request
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class AsyncNativeClient:
|
|
26
|
+
"""Async client for the Sudomimus Native API."""
|
|
27
|
+
|
|
28
|
+
def __init__(
|
|
29
|
+
self,
|
|
30
|
+
base_url: str = PRODUCTION_BASE_URL,
|
|
31
|
+
*,
|
|
32
|
+
http_client: httpx.AsyncClient | None = None,
|
|
33
|
+
) -> None:
|
|
34
|
+
self._base_url = base_url.rstrip("/")
|
|
35
|
+
self._client = http_client if http_client is not None else httpx.AsyncClient()
|
|
36
|
+
self._owns_client = http_client is None
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def base_url(self) -> str:
|
|
40
|
+
return self._base_url
|
|
41
|
+
|
|
42
|
+
async def __aenter__(self) -> AsyncNativeClient:
|
|
43
|
+
return self
|
|
44
|
+
|
|
45
|
+
async def __aexit__(
|
|
46
|
+
self,
|
|
47
|
+
exc_type: type[BaseException] | None,
|
|
48
|
+
exc: BaseException | None,
|
|
49
|
+
tb: TracebackType | None,
|
|
50
|
+
) -> None:
|
|
51
|
+
await self.aclose()
|
|
52
|
+
|
|
53
|
+
async def aclose(self) -> None:
|
|
54
|
+
"""Close the underlying HTTP client if this instance created it."""
|
|
55
|
+
if self._owns_client:
|
|
56
|
+
await self._client.aclose()
|
|
57
|
+
|
|
58
|
+
async def direct_issue_steam_ticket(
|
|
59
|
+
self,
|
|
60
|
+
request: DirectIssueSteamTicketRequest,
|
|
61
|
+
) -> DirectIssueSteamTicketResponse:
|
|
62
|
+
"""Exchange a Steam Web API auth ticket for application tokens."""
|
|
63
|
+
return await self._post(
|
|
64
|
+
"/direct-issue/steam-ticket", request, DirectIssueSteamTicketResponse
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
async def direct_issue_access_key(
|
|
68
|
+
self,
|
|
69
|
+
request: DirectIssueAccessKeyRequest,
|
|
70
|
+
) -> DirectIssueAccessKeyResponse:
|
|
71
|
+
"""Exchange an access-key credential for application tokens."""
|
|
72
|
+
return await self._post("/direct-issue/access-key", request, DirectIssueAccessKeyResponse)
|
|
73
|
+
|
|
74
|
+
async def direct_issue_public_key(
|
|
75
|
+
self,
|
|
76
|
+
request: DirectIssuePublicKeyRequest,
|
|
77
|
+
credential: PublicKeyCredential,
|
|
78
|
+
) -> DirectIssueAccessKeyResponse:
|
|
79
|
+
"""Exchange a fresh signed Ed25519 assertion for application tokens."""
|
|
80
|
+
signed = sign_public_key_request(request, credential)
|
|
81
|
+
response = await self._client.post(
|
|
82
|
+
f"{self._base_url}/direct-issue/public-key",
|
|
83
|
+
content=signed.body,
|
|
84
|
+
headers={**_JSON_HEADERS, "Authorization": signed.authorization},
|
|
85
|
+
)
|
|
86
|
+
return _handle(response, DirectIssueAccessKeyResponse)
|
|
87
|
+
|
|
88
|
+
async def create_errand(
|
|
89
|
+
self,
|
|
90
|
+
request: CreateErrandRequest,
|
|
91
|
+
) -> CreateErrandResponse:
|
|
92
|
+
"""Proactively mint an errand for a user you already authenticated."""
|
|
93
|
+
return await self._post("/errand", request, CreateErrandResponse)
|
|
94
|
+
|
|
95
|
+
async def errand_status(
|
|
96
|
+
self,
|
|
97
|
+
errand_key: str,
|
|
98
|
+
) -> ErrandStatusResponse:
|
|
99
|
+
"""Poll the status of an errand."""
|
|
100
|
+
response = await self._client.get(
|
|
101
|
+
f"{self._base_url}/errand/{errand_key}/status",
|
|
102
|
+
headers={"Accept": "application/json"},
|
|
103
|
+
)
|
|
104
|
+
return _handle(response, ErrandStatusResponse)
|
|
105
|
+
|
|
106
|
+
async def _post(
|
|
107
|
+
self,
|
|
108
|
+
path: str,
|
|
109
|
+
request: BaseModel,
|
|
110
|
+
response_model: type[_ResponseT],
|
|
111
|
+
) -> _ResponseT:
|
|
112
|
+
raw = request.model_dump_json(exclude_none=True)
|
|
113
|
+
response = await self._client.post(
|
|
114
|
+
f"{self._base_url}{path}",
|
|
115
|
+
content=raw,
|
|
116
|
+
headers=_JSON_HEADERS,
|
|
117
|
+
)
|
|
118
|
+
return _handle(response, response_model)
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"""Synchronous Native API HTTP client."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from types import TracebackType
|
|
6
|
+
from typing import TypeVar
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
from pydantic import BaseModel, ValidationError
|
|
10
|
+
|
|
11
|
+
from ._generated.models import (
|
|
12
|
+
CreateErrandRequest,
|
|
13
|
+
CreateErrandResponse,
|
|
14
|
+
DirectIssueAccessKeyRequest,
|
|
15
|
+
DirectIssueAccessKeyResponse,
|
|
16
|
+
DirectIssueDeniedError,
|
|
17
|
+
DirectIssuePublicKeyRequest,
|
|
18
|
+
DirectIssueSteamTicketConflictError,
|
|
19
|
+
DirectIssueSteamTicketRequest,
|
|
20
|
+
DirectIssueSteamTicketResponse,
|
|
21
|
+
ErrandStatusResponse,
|
|
22
|
+
Error,
|
|
23
|
+
)
|
|
24
|
+
from .constants import PRODUCTION_BASE_URL
|
|
25
|
+
from .errors import NativeApiError, NativeErrorBody
|
|
26
|
+
from .public_key_assertion import PublicKeyCredential, sign_public_key_request
|
|
27
|
+
|
|
28
|
+
_ResponseT = TypeVar("_ResponseT", bound=BaseModel)
|
|
29
|
+
|
|
30
|
+
_JSON_HEADERS = {"Content-Type": "application/json", "Accept": "application/json"}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class NativeClient:
|
|
34
|
+
"""Client for the Sudomimus Native API.
|
|
35
|
+
|
|
36
|
+
The Native API is unauthenticated at the transport layer — the Steam
|
|
37
|
+
ticket or access-key credential in the request body is the credential.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
def __init__(
|
|
41
|
+
self,
|
|
42
|
+
base_url: str = PRODUCTION_BASE_URL,
|
|
43
|
+
*,
|
|
44
|
+
http_client: httpx.Client | None = None,
|
|
45
|
+
) -> None:
|
|
46
|
+
self._base_url = base_url.rstrip("/")
|
|
47
|
+
self._client = http_client if http_client is not None else httpx.Client()
|
|
48
|
+
self._owns_client = http_client is None
|
|
49
|
+
|
|
50
|
+
@property
|
|
51
|
+
def base_url(self) -> str:
|
|
52
|
+
return self._base_url
|
|
53
|
+
|
|
54
|
+
def __enter__(self) -> NativeClient:
|
|
55
|
+
return self
|
|
56
|
+
|
|
57
|
+
def __exit__(
|
|
58
|
+
self,
|
|
59
|
+
exc_type: type[BaseException] | None,
|
|
60
|
+
exc: BaseException | None,
|
|
61
|
+
tb: TracebackType | None,
|
|
62
|
+
) -> None:
|
|
63
|
+
self.close()
|
|
64
|
+
|
|
65
|
+
def close(self) -> None:
|
|
66
|
+
"""Close the underlying HTTP client if this instance created it."""
|
|
67
|
+
if self._owns_client:
|
|
68
|
+
self._client.close()
|
|
69
|
+
|
|
70
|
+
def direct_issue_steam_ticket(
|
|
71
|
+
self,
|
|
72
|
+
request: DirectIssueSteamTicketRequest,
|
|
73
|
+
) -> DirectIssueSteamTicketResponse:
|
|
74
|
+
"""Exchange a Steam Web API auth ticket for application tokens."""
|
|
75
|
+
return self._post("/direct-issue/steam-ticket", request, DirectIssueSteamTicketResponse)
|
|
76
|
+
|
|
77
|
+
def direct_issue_access_key(
|
|
78
|
+
self,
|
|
79
|
+
request: DirectIssueAccessKeyRequest,
|
|
80
|
+
) -> DirectIssueAccessKeyResponse:
|
|
81
|
+
"""Exchange an access-key credential for application tokens."""
|
|
82
|
+
return self._post("/direct-issue/access-key", request, DirectIssueAccessKeyResponse)
|
|
83
|
+
|
|
84
|
+
def direct_issue_public_key(
|
|
85
|
+
self,
|
|
86
|
+
request: DirectIssuePublicKeyRequest,
|
|
87
|
+
credential: PublicKeyCredential,
|
|
88
|
+
) -> DirectIssueAccessKeyResponse:
|
|
89
|
+
"""Exchange a fresh signed Ed25519 assertion for application tokens."""
|
|
90
|
+
signed = sign_public_key_request(request, credential)
|
|
91
|
+
response = self._client.post(
|
|
92
|
+
f"{self._base_url}/direct-issue/public-key",
|
|
93
|
+
content=signed.body,
|
|
94
|
+
headers={**_JSON_HEADERS, "Authorization": signed.authorization},
|
|
95
|
+
)
|
|
96
|
+
return _handle(response, DirectIssueAccessKeyResponse)
|
|
97
|
+
|
|
98
|
+
def create_errand(
|
|
99
|
+
self,
|
|
100
|
+
request: CreateErrandRequest,
|
|
101
|
+
) -> CreateErrandResponse:
|
|
102
|
+
"""Proactively mint an errand for a user you already authenticated."""
|
|
103
|
+
return self._post("/errand", request, CreateErrandResponse)
|
|
104
|
+
|
|
105
|
+
def errand_status(
|
|
106
|
+
self,
|
|
107
|
+
errand_key: str,
|
|
108
|
+
) -> ErrandStatusResponse:
|
|
109
|
+
"""Poll the status of an errand."""
|
|
110
|
+
response = self._client.get(
|
|
111
|
+
f"{self._base_url}/errand/{errand_key}/status",
|
|
112
|
+
headers={"Accept": "application/json"},
|
|
113
|
+
)
|
|
114
|
+
return _handle(response, ErrandStatusResponse)
|
|
115
|
+
|
|
116
|
+
def _post(
|
|
117
|
+
self,
|
|
118
|
+
path: str,
|
|
119
|
+
request: BaseModel,
|
|
120
|
+
response_model: type[_ResponseT],
|
|
121
|
+
) -> _ResponseT:
|
|
122
|
+
raw = request.model_dump_json(exclude_none=True)
|
|
123
|
+
response = self._client.post(
|
|
124
|
+
f"{self._base_url}{path}",
|
|
125
|
+
content=raw,
|
|
126
|
+
headers=_JSON_HEADERS,
|
|
127
|
+
)
|
|
128
|
+
return _handle(response, response_model)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def _handle(response: httpx.Response, response_model: type[_ResponseT]) -> _ResponseT:
|
|
132
|
+
if response.is_success:
|
|
133
|
+
return response_model.model_validate_json(response.content)
|
|
134
|
+
error = _try_read_error(
|
|
135
|
+
response, steam_exchange=response_model is DirectIssueSteamTicketResponse
|
|
136
|
+
)
|
|
137
|
+
raise NativeApiError(response.status_code, error.reason if error else None, error)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def _try_read_error(response: httpx.Response, *, steam_exchange: bool) -> NativeErrorBody | None:
|
|
141
|
+
if not response.content:
|
|
142
|
+
return None
|
|
143
|
+
try:
|
|
144
|
+
if response.status_code == 409:
|
|
145
|
+
error = Error.model_validate_json(response.content)
|
|
146
|
+
if steam_exchange and error.reason == "LegalAgreementRevisionMismatch":
|
|
147
|
+
return DirectIssueSteamTicketConflictError.model_validate_json(response.content)
|
|
148
|
+
return error
|
|
149
|
+
return DirectIssueDeniedError.model_validate_json(response.content)
|
|
150
|
+
except ValidationError:
|
|
151
|
+
try:
|
|
152
|
+
return Error.model_validate_json(response.content)
|
|
153
|
+
except ValidationError:
|
|
154
|
+
return None
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""Native client constants."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
PRODUCTION_BASE_URL = "https://native-api.sudomimus.com"
|
|
6
|
+
|
|
7
|
+
# Identity string the client SDK MUST pass to
|
|
8
|
+
# ``ISteamUser::GetAuthTicketForWebApi(identity)``. Steam binds the issued
|
|
9
|
+
# ticket to this identity and the Native API verifier hardcodes the same
|
|
10
|
+
# value, so tickets generated with any other identity are rejected.
|
|
11
|
+
STEAM_TICKET_IDENTITY = "sudomimus"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""Native API error type."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from ._generated.models import DirectIssueDeniedError, DirectIssueSteamTicketConflictError, Error
|
|
6
|
+
|
|
7
|
+
NativeErrorBody = DirectIssueDeniedError | DirectIssueSteamTicketConflictError | Error
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class NativeApiError(Exception):
|
|
11
|
+
"""Raised for any non-2xx response from the Native API.
|
|
12
|
+
|
|
13
|
+
Distinguish failure modes by :attr:`status` and :attr:`reason`. All
|
|
14
|
+
access-key credential failures collapse into a single opaque
|
|
15
|
+
``AccessKeyDirectDenied`` 401 reason; Steam-ticket replays surface as 409.
|
|
16
|
+
For ``PRIVATE`` reasons and admission failures (429/503), the body is
|
|
17
|
+
empty and :attr:`reason` is ``None``.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
def __init__(
|
|
21
|
+
self,
|
|
22
|
+
status: int,
|
|
23
|
+
reason: str | None,
|
|
24
|
+
body: NativeErrorBody | None,
|
|
25
|
+
) -> None:
|
|
26
|
+
message = f"Native API error {status}: {reason}" if reason else f"Native API error {status}"
|
|
27
|
+
super().__init__(message)
|
|
28
|
+
self.status = status
|
|
29
|
+
self.reason = reason
|
|
30
|
+
self.body = body
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"""Signed assertion helpers for Native public-key direct issue."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import base64
|
|
6
|
+
import hashlib
|
|
7
|
+
import json
|
|
8
|
+
import secrets
|
|
9
|
+
import time
|
|
10
|
+
from collections.abc import Callable
|
|
11
|
+
from dataclasses import dataclass
|
|
12
|
+
|
|
13
|
+
from ._generated.models import DirectIssuePublicKeyRequest
|
|
14
|
+
|
|
15
|
+
PUBLIC_KEY_ASSERTION_AUDIENCE = "sudomimus-native-public-key"
|
|
16
|
+
PUBLIC_KEY_ASSERTION_TYPE = "vnd.sudomimus.public-key-assertion+jwt"
|
|
17
|
+
PUBLIC_KEY_AUTHORIZATION_SCHEME = "SudomimusPublicKeyJWT"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _base64url(value: bytes) -> str:
|
|
21
|
+
return base64.urlsafe_b64encode(value).rstrip(b"=").decode("ascii")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@dataclass(frozen=True, slots=True)
|
|
25
|
+
class PublicKeyCredential:
|
|
26
|
+
"""Registered Ed25519 key ID and raw-signature callback."""
|
|
27
|
+
|
|
28
|
+
key_id: str
|
|
29
|
+
sign: Callable[[bytes], bytes]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass(frozen=True, slots=True)
|
|
33
|
+
class SignedPublicKeyRequest:
|
|
34
|
+
"""Exact request bytes and matching Authorization value."""
|
|
35
|
+
|
|
36
|
+
body: bytes
|
|
37
|
+
authorization: str
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def sign_public_key_request(
|
|
41
|
+
request: DirectIssuePublicKeyRequest,
|
|
42
|
+
credential: PublicKeyCredential,
|
|
43
|
+
*,
|
|
44
|
+
now: int | None = None,
|
|
45
|
+
jti_bytes: bytes | None = None,
|
|
46
|
+
) -> SignedPublicKeyRequest:
|
|
47
|
+
"""Serialize once and bind those exact bytes into a compact EdDSA JWT."""
|
|
48
|
+
body = request.model_dump_json(exclude_none=True).encode("utf-8")
|
|
49
|
+
issued_at = int(time.time()) if now is None else now
|
|
50
|
+
nonce = secrets.token_bytes(16) if jti_bytes is None else jti_bytes
|
|
51
|
+
if len(nonce) != 16:
|
|
52
|
+
raise ValueError("jti_bytes must contain exactly 16 random bytes")
|
|
53
|
+
|
|
54
|
+
header = {
|
|
55
|
+
"alg": "EdDSA",
|
|
56
|
+
"typ": PUBLIC_KEY_ASSERTION_TYPE,
|
|
57
|
+
"kid": credential.key_id,
|
|
58
|
+
}
|
|
59
|
+
claims = {
|
|
60
|
+
"iss": credential.key_id,
|
|
61
|
+
"aud": PUBLIC_KEY_ASSERTION_AUDIENCE,
|
|
62
|
+
"iat": issued_at,
|
|
63
|
+
"exp": issued_at + 60,
|
|
64
|
+
"jti": _base64url(nonce),
|
|
65
|
+
"requestHash": _base64url(hashlib.sha256(body).digest()),
|
|
66
|
+
}
|
|
67
|
+
encode_json = lambda value: json.dumps( # noqa: E731
|
|
68
|
+
value, separators=(",", ":"), ensure_ascii=False
|
|
69
|
+
).encode("utf-8")
|
|
70
|
+
signing_input = (
|
|
71
|
+
_base64url(encode_json(header)) + "." + _base64url(encode_json(claims))
|
|
72
|
+
).encode("ascii")
|
|
73
|
+
signature = credential.sign(signing_input)
|
|
74
|
+
if len(signature) != 64:
|
|
75
|
+
raise ValueError("Ed25519 signatures must contain exactly 64 bytes")
|
|
76
|
+
assertion = signing_input.decode("ascii") + "." + _base64url(signature)
|
|
77
|
+
return SignedPublicKeyRequest(
|
|
78
|
+
body=body,
|
|
79
|
+
authorization=f"{PUBLIC_KEY_AUTHORIZATION_SCHEME} {assertion}",
|
|
80
|
+
)
|
|
@@ -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,11 @@
|
|
|
1
|
+
sudomimus_native/__init__.py,sha256=0qBcEioljrFJayzOahil371uXyvHnfS9ccylCDmSKM0,2202
|
|
2
|
+
sudomimus_native/async_client.py,sha256=O-Y7jRiQ95zbeGQNcQAffYzw8RQ4En29PpeqMZbqemk,3865
|
|
3
|
+
sudomimus_native/client.py,sha256=U2vNDkBrauoEtmoj77BmAlM1eclfLDwn_9f1ain-xLY,5216
|
|
4
|
+
sudomimus_native/constants.py,sha256=yh3Q4tJcX-NiT0wQDw4JTdJlMFL-hIHdoVXzYwZNL1A,424
|
|
5
|
+
sudomimus_native/errors.py,sha256=RB34d2TWPT4yvltVOTj4fla9CnhQFhY9ubR8UhSN_GE,1041
|
|
6
|
+
sudomimus_native/public_key_assertion.py,sha256=7vDn4RY7wQjlt211AV6WI9VM0CA95Xf1Y8XLNN5aa_A,2546
|
|
7
|
+
sudomimus_native/_generated/__init__.py,sha256=x7_YTnIyxb0ELoctfYZwhgC58LMZaZnK3uAmQSaO4uk,45
|
|
8
|
+
sudomimus_native/_generated/models.py,sha256=tBeA3eP4KWMTzIbr8ZrWK-Skq7ros7FOX9EyuFLuGaM,11856
|
|
9
|
+
sudomimus_native-5.0.0.dist-info/METADATA,sha256=AnyfBr-JFVGNzVhIvJPOvZwsdyRe6jWCcOYrf61IxEw,3978
|
|
10
|
+
sudomimus_native-5.0.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
11
|
+
sudomimus_native-5.0.0.dist-info/RECORD,,
|