pangea-sdk 6.2.0b1__py3-none-any.whl → 6.3.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.
- pangea/__init__.py +9 -1
- pangea/asyncio/__init__.py +1 -0
- pangea/asyncio/file_uploader.py +4 -2
- pangea/asyncio/request.py +70 -169
- pangea/asyncio/services/__init__.py +2 -1
- pangea/asyncio/services/ai_guard.py +9 -12
- pangea/asyncio/services/audit.py +13 -307
- pangea/asyncio/services/authn.py +40 -32
- pangea/asyncio/services/authz.py +51 -17
- pangea/asyncio/services/base.py +4 -0
- pangea/asyncio/services/file_scan.py +8 -2
- pangea/asyncio/services/intel.py +26 -28
- pangea/asyncio/services/redact.py +11 -268
- pangea/asyncio/services/sanitize.py +5 -1
- pangea/asyncio/services/share.py +5 -1
- pangea/asyncio/services/vault.py +71 -55
- pangea/audit_logger.py +3 -1
- pangea/deep_verify.py +13 -13
- pangea/deprecated.py +1 -1
- pangea/dump_audit.py +2 -3
- pangea/exceptions.py +8 -5
- pangea/file_uploader.py +4 -0
- pangea/request.py +80 -200
- pangea/response.py +21 -18
- pangea/services/__init__.py +2 -1
- pangea/services/ai_guard.py +35 -24
- pangea/services/audit/audit.py +17 -314
- pangea/services/audit/models.py +69 -307
- pangea/services/audit/signing.py +1 -1
- pangea/services/audit/util.py +10 -10
- pangea/services/authn/authn.py +39 -31
- pangea/services/authn/models.py +183 -148
- pangea/services/authz.py +108 -60
- pangea/services/base.py +7 -4
- pangea/services/embargo.py +6 -0
- pangea/services/file_scan.py +8 -2
- pangea/services/intel.py +36 -19
- pangea/services/redact.py +14 -476
- pangea/services/sanitize.py +5 -1
- pangea/services/share/share.py +13 -7
- pangea/services/vault/models/asymmetric.py +4 -0
- pangea/services/vault/models/common.py +15 -12
- pangea/services/vault/models/keys.py +4 -9
- pangea/services/vault/models/secret.py +3 -8
- pangea/services/vault/models/symmetric.py +4 -0
- pangea/services/vault/vault.py +69 -59
- pangea/tools.py +13 -9
- pangea/utils.py +3 -5
- pangea/verify_audit.py +23 -27
- {pangea_sdk-6.2.0b1.dist-info → pangea_sdk-6.3.0.dist-info}/METADATA +36 -17
- pangea_sdk-6.3.0.dist-info/RECORD +60 -0
- {pangea_sdk-6.2.0b1.dist-info → pangea_sdk-6.3.0.dist-info}/WHEEL +1 -1
- pangea/asyncio/services/management.py +0 -576
- pangea/services/management.py +0 -720
- pangea_sdk-6.2.0b1.dist-info/RECORD +0 -62
pangea/services/authn/authn.py
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
# Copyright 2022 Pangea Cyber Corporation
|
2
2
|
# Author: Pangea Cyber Corporation
|
3
|
+
|
4
|
+
# TODO: Modernize.
|
5
|
+
# ruff: noqa: UP006, UP035
|
6
|
+
|
3
7
|
from __future__ import annotations
|
4
8
|
|
9
|
+
from collections.abc import Mapping
|
5
10
|
from typing import Dict, List, Literal, Optional, Union
|
6
11
|
|
7
12
|
import pangea.services.authn.models as m
|
@@ -128,7 +133,7 @@ class AuthN(ServiceBase):
|
|
128
133
|
Returns:
|
129
134
|
A PangeaResponse with a list of sessions in the response.result field.
|
130
135
|
Available response fields can be found in our
|
131
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/session#/v2/session/list).
|
136
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/session#/v2/session/list-post).
|
132
137
|
|
133
138
|
Examples:
|
134
139
|
response = authn.session.list()
|
@@ -192,7 +197,7 @@ class AuthN(ServiceBase):
|
|
192
197
|
Returns:
|
193
198
|
A PangeaResponse with credentials for a login session in the response.result field.
|
194
199
|
Available response fields can be found in our
|
195
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/client/userinfo).
|
200
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/client/userinfo-post).
|
196
201
|
|
197
202
|
Examples:
|
198
203
|
response = authn.client.userinfo(
|
@@ -217,7 +222,7 @@ class AuthN(ServiceBase):
|
|
217
222
|
Returns:
|
218
223
|
A PangeaResponse with jwt verification keys in the response.result field.
|
219
224
|
Available response fields can be found in our
|
220
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/jwt#/v2/client/jwks).
|
225
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/jwt#/v2/client/jwks-post).
|
221
226
|
|
222
227
|
Examples:
|
223
228
|
response = authn.client.jwks()
|
@@ -290,7 +295,7 @@ class AuthN(ServiceBase):
|
|
290
295
|
Returns:
|
291
296
|
A PangeaResponse with a list of sessions in the response.result field.
|
292
297
|
Available response fields can be found in our
|
293
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/session#/v2/client/session/list).
|
298
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/session#/v2/client/session/list-post).
|
294
299
|
|
295
300
|
Examples:
|
296
301
|
response = authn.client.session.list(
|
@@ -349,7 +354,7 @@ class AuthN(ServiceBase):
|
|
349
354
|
Returns:
|
350
355
|
A PangeaResponse with credentials for a login session in the response.result field.
|
351
356
|
Available response fields can be found in our
|
352
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/session#/v2/client/session/refresh).
|
357
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/session#/v2/client/session/refresh-post).
|
353
358
|
|
354
359
|
Examples:
|
355
360
|
response = authn.client.session.refresh(
|
@@ -433,7 +438,7 @@ class AuthN(ServiceBase):
|
|
433
438
|
):
|
434
439
|
super().__init__(token, config, logger_name=logger_name)
|
435
440
|
|
436
|
-
def check(self, token:
|
441
|
+
def check(self, token: m.Token) -> PangeaResponse[m.ClientTokenCheckResult]:
|
437
442
|
"""
|
438
443
|
Check a token
|
439
444
|
|
@@ -442,22 +447,19 @@ class AuthN(ServiceBase):
|
|
442
447
|
OperationId: authn_post_v2_client_token_check
|
443
448
|
|
444
449
|
Args:
|
445
|
-
token
|
450
|
+
token: A token value
|
446
451
|
|
447
452
|
Returns:
|
448
453
|
A PangeaResponse with a token and its information in the response.result field.
|
449
454
|
Available response fields can be found in our
|
450
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/client/token/check).
|
455
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/client/token/check-post).
|
451
456
|
|
452
457
|
Examples:
|
453
458
|
response = authn.client.token_endpoints.check(
|
454
459
|
token="ptu_wuk7tvtpswyjtlsx52b7yyi2l7zotv4a",
|
455
460
|
)
|
456
461
|
"""
|
457
|
-
|
458
|
-
return self.request.post(
|
459
|
-
"v2/client/token/check", m.ClientTokenCheckResult, data=input.model_dump(exclude_none=True)
|
460
|
-
)
|
462
|
+
return self.request.post("v2/client/token/check", m.ClientTokenCheckResult, data={"token": token})
|
461
463
|
|
462
464
|
class User(ServiceBase):
|
463
465
|
service_name = _SERVICE_NAME
|
@@ -477,7 +479,7 @@ class AuthN(ServiceBase):
|
|
477
479
|
def create(
|
478
480
|
self,
|
479
481
|
email: str,
|
480
|
-
profile:
|
482
|
+
profile: Mapping[str, str],
|
481
483
|
*,
|
482
484
|
username: str | None = None,
|
483
485
|
) -> PangeaResponse[m.UserCreateResult]:
|
@@ -496,7 +498,7 @@ class AuthN(ServiceBase):
|
|
496
498
|
Returns:
|
497
499
|
A PangeaResponse with a user and its information in the response.result field.
|
498
500
|
Available response fields can be found in our
|
499
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/create).
|
501
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/create-post).
|
500
502
|
|
501
503
|
Examples:
|
502
504
|
response = authn.user.create(
|
@@ -561,7 +563,7 @@ class AuthN(ServiceBase):
|
|
561
563
|
Returns:
|
562
564
|
A PangeaResponse with a pending user invitation in the response.result field.
|
563
565
|
Available response fields can be found in our
|
564
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/invite#/v2/user/invite).
|
566
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/invite#/v2/user/invite-post).
|
565
567
|
|
566
568
|
Examples:
|
567
569
|
response = authn.user.invite(
|
@@ -606,7 +608,7 @@ class AuthN(ServiceBase):
|
|
606
608
|
Returns:
|
607
609
|
A PangeaResponse with a user and its information in the response.result field.
|
608
610
|
Available response fields can be found in our
|
609
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/update).
|
611
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/update-post).
|
610
612
|
|
611
613
|
Examples:
|
612
614
|
response = authn.user.update(
|
@@ -649,7 +651,7 @@ class AuthN(ServiceBase):
|
|
649
651
|
Returns:
|
650
652
|
A PangeaResponse with a list of users in the response.result field.
|
651
653
|
Available response fields can be found in our
|
652
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/list).
|
654
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/list-post).
|
653
655
|
|
654
656
|
Examples:
|
655
657
|
response = authn.user.list()
|
@@ -703,7 +705,7 @@ class AuthN(ServiceBase):
|
|
703
705
|
Returns:
|
704
706
|
A PangeaResponse with a list of pending user invitations in the response.result field.
|
705
707
|
Available response fields can be found in our
|
706
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/invite#/v2/user/invite/list).
|
708
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/invite#/v2/user/invite/list-post).
|
707
709
|
Examples:
|
708
710
|
response = authn.user.invites.list()
|
709
711
|
"""
|
@@ -807,7 +809,7 @@ class AuthN(ServiceBase):
|
|
807
809
|
Returns:
|
808
810
|
A PangeaResponse with a list of authenticators in the response.result field.
|
809
811
|
Available response fields can be found in our
|
810
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/authenticators/list).
|
812
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/authenticators/list-post).
|
811
813
|
|
812
814
|
Examples:
|
813
815
|
response = authn.user.authenticators.list(
|
@@ -850,7 +852,7 @@ class AuthN(ServiceBase):
|
|
850
852
|
Returns:
|
851
853
|
A PangeaResponse with a user and its information in the response.result field.
|
852
854
|
Available response fields can be found in our
|
853
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/profile/get).
|
855
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/profile/get-post).
|
854
856
|
|
855
857
|
Examples:
|
856
858
|
response = authn.user.profile.get(
|
@@ -864,7 +866,7 @@ class AuthN(ServiceBase):
|
|
864
866
|
|
865
867
|
def update(
|
866
868
|
self,
|
867
|
-
profile:
|
869
|
+
profile: Mapping[str, str],
|
868
870
|
id: str | None = None,
|
869
871
|
email: str | None = None,
|
870
872
|
*,
|
@@ -886,7 +888,7 @@ class AuthN(ServiceBase):
|
|
886
888
|
Returns:
|
887
889
|
A PangeaResponse with a user and its information in the response.result field.
|
888
890
|
Available response fields can be found in our
|
889
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/profile/update).
|
891
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/user#/v2/user/profile/update-post).
|
890
892
|
|
891
893
|
Examples:
|
892
894
|
response = authn.user.profile.update(
|
@@ -980,7 +982,7 @@ class AuthN(ServiceBase):
|
|
980
982
|
Returns:
|
981
983
|
A PangeaResponse with credentials for a login session in the response.result field.
|
982
984
|
Available response fields can be found in our
|
983
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/complete).
|
985
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/complete-post).
|
984
986
|
|
985
987
|
Examples:
|
986
988
|
response = authn.flow.complete(
|
@@ -991,7 +993,10 @@ class AuthN(ServiceBase):
|
|
991
993
|
return self.request.post("v2/flow/complete", m.FlowCompleteResult, data=input.model_dump(exclude_none=True))
|
992
994
|
|
993
995
|
def restart(
|
994
|
-
self,
|
996
|
+
self,
|
997
|
+
flow_id: str,
|
998
|
+
choice: m.FlowChoice,
|
999
|
+
data: m.FlowRestartData = {}, # noqa: B006
|
995
1000
|
) -> PangeaResponse[m.FlowRestartResult]:
|
996
1001
|
"""
|
997
1002
|
Restart a sign-up/sign-in flow
|
@@ -1009,7 +1014,7 @@ class AuthN(ServiceBase):
|
|
1009
1014
|
A PangeaResponse with information about next steps needed
|
1010
1015
|
to complete a flow in the response.result field.
|
1011
1016
|
Available response fields can be found in our
|
1012
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/restart).
|
1017
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/restart-post).
|
1013
1018
|
|
1014
1019
|
Examples:
|
1015
1020
|
response = authn.flow.restart(
|
@@ -1046,7 +1051,7 @@ class AuthN(ServiceBase):
|
|
1046
1051
|
A PangeaResponse with information about next steps needed
|
1047
1052
|
to complete a flow in the response.result field.
|
1048
1053
|
Available response fields can be found in our
|
1049
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/start).
|
1054
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/start-post).
|
1050
1055
|
|
1051
1056
|
Examples:
|
1052
1057
|
response = authn.flow.start(
|
@@ -1062,7 +1067,10 @@ class AuthN(ServiceBase):
|
|
1062
1067
|
return self.request.post("v2/flow/start", m.FlowStartResult, data=input.model_dump(exclude_none=True))
|
1063
1068
|
|
1064
1069
|
def update(
|
1065
|
-
self,
|
1070
|
+
self,
|
1071
|
+
flow_id: str,
|
1072
|
+
choice: m.FlowChoice,
|
1073
|
+
data: m.FlowUpdateData = {}, # noqa: B006
|
1066
1074
|
) -> PangeaResponse[m.FlowUpdateResult]:
|
1067
1075
|
"""
|
1068
1076
|
Update a sign-up/sign-in flow
|
@@ -1080,7 +1088,7 @@ class AuthN(ServiceBase):
|
|
1080
1088
|
A PangeaResponse with information about next steps needed
|
1081
1089
|
to complete a flow in the response.result field.
|
1082
1090
|
Available response fields can be found in our
|
1083
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/update).
|
1091
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/flow#/v2/flow/update-post).
|
1084
1092
|
|
1085
1093
|
Examples:
|
1086
1094
|
response = authn.flow.update(
|
@@ -1125,7 +1133,7 @@ class AuthN(ServiceBase):
|
|
1125
1133
|
Returns:
|
1126
1134
|
A PangeaResponse with a EULA object in the response.result field.
|
1127
1135
|
Available response fields can be found in our
|
1128
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/agreements#/v2/agreements/create).
|
1136
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/agreements#/v2/agreements/create-post).
|
1129
1137
|
|
1130
1138
|
Examples:
|
1131
1139
|
response = authn.agreements.create(
|
@@ -1192,7 +1200,7 @@ class AuthN(ServiceBase):
|
|
1192
1200
|
Returns:
|
1193
1201
|
A PangeaResponse with a list of EULA objects in the response.result field.
|
1194
1202
|
Available response fields can be found in our
|
1195
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/agreements#/v2/agreements/list).
|
1203
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/agreements#/v2/agreements/list-post).
|
1196
1204
|
|
1197
1205
|
Examples:
|
1198
1206
|
response = authn.agreements.list()
|
@@ -1231,7 +1239,7 @@ class AuthN(ServiceBase):
|
|
1231
1239
|
Returns:
|
1232
1240
|
A PangeaResponse with the updated EULA object in the response.result field.
|
1233
1241
|
Available response fields can be found in our
|
1234
|
-
[API Documentation](https://pangea.cloud/docs/api/authn/agreements#/v2/agreements/update).
|
1242
|
+
[API Documentation](https://pangea.cloud/docs/api/authn/agreements#/v2/agreements/update-post).
|
1235
1243
|
|
1236
1244
|
Examples:
|
1237
1245
|
response = authn.agreements.update(
|