pangea-sdk 3.6.1__py3-none-any.whl → 3.8.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,11 @@
1
1
  # Copyright 2022 Pangea Cyber Corporation
2
2
  # Author: Pangea Cyber Corporation
3
+ from __future__ import annotations
4
+
3
5
  import datetime
4
6
  from typing import Dict, Optional, Union
5
7
 
8
+ from pangea.config import PangeaConfig
6
9
  from pangea.response import PangeaResponse
7
10
  from pangea.services.base import ServiceBase
8
11
  from pangea.services.vault.models.asymmetric import (
@@ -48,8 +51,8 @@ from pangea.services.vault.models.common import (
48
51
  StateChangeRequest,
49
52
  StateChangeResult,
50
53
  SymmetricAlgorithm,
51
- TDict,
52
54
  Tags,
55
+ TDict,
53
56
  UpdateRequest,
54
57
  UpdateResult,
55
58
  )
@@ -91,17 +94,31 @@ class Vault(ServiceBase):
91
94
  vault_config = PangeaConfig(domain="pangea.cloud")
92
95
 
93
96
  # Setup Pangea Vault service
94
- vault = Vault(token=PANGEA_VAULT_TOKEN, config=audit_config)
97
+ vault = Vault(token=PANGEA_VAULT_TOKEN, config=vault_config)
95
98
  """
96
99
 
97
100
  service_name = "vault"
98
101
 
99
102
  def __init__(
100
103
  self,
101
- token,
102
- config=None,
103
- logger_name="pangea",
104
- ):
104
+ token: str,
105
+ config: PangeaConfig | None = None,
106
+ logger_name: str = "pangea",
107
+ ) -> None:
108
+ """
109
+ Vault client
110
+
111
+ Initializes a new Vault client.
112
+
113
+ Args:
114
+ token: Pangea API token.
115
+ config: Configuration.
116
+ logger_name: Logger name.
117
+
118
+ Examples:
119
+ config = PangeaConfig(domain="pangea_domain")
120
+ vault = Vault(token="pangea_token", config=config)
121
+ """
105
122
  super().__init__(token, config, logger_name)
106
123
 
107
124
  # Delete endpoint
@@ -866,8 +883,8 @@ class Vault(ServiceBase):
866
883
 
867
884
  Default is `deactivated`.
868
885
  public_key (EncodedPublicKey, optional): The public key (in PEM format)
869
- private_key: (EncodedPrivateKey, optional): The private key (in PEM format)
870
- key: (EncodedSymmetricKey, optional): The key material (in base64)
886
+ private_key (EncodedPrivateKey, optional): The private key (in PEM format)
887
+ key (EncodedSymmetricKey, optional): The key material (in base64)
871
888
 
872
889
  Raises:
873
890
  PangeaAPIException: If an API Error happens
@@ -1216,7 +1233,7 @@ class Vault(ServiceBase):
1216
1233
  Args:
1217
1234
  id (str): The item ID.
1218
1235
  structured_data (dict): Structured data for applying bulk operations.
1219
- filter (str, optional): A filter expression for applying bulk operations to the data field.
1236
+ filter (str): A filter expression for applying bulk operations to the data field.
1220
1237
  version (int, optional): The item version. Defaults to the current version.
1221
1238
  additional_data (str, optional): User provided authentication data.
1222
1239
 
@@ -1237,7 +1254,7 @@ class Vault(ServiceBase):
1237
1254
  )
1238
1255
  """
1239
1256
 
1240
- input = EncryptStructuredRequest(
1257
+ input: EncryptStructuredRequest[TDict] = EncryptStructuredRequest(
1241
1258
  id=id, structured_data=structured_data, filter=filter, version=version, additional_data=additional_data
1242
1259
  )
1243
1260
  return self.request.post(
@@ -1265,7 +1282,7 @@ class Vault(ServiceBase):
1265
1282
  Args:
1266
1283
  id (str): The item ID.
1267
1284
  structured_data (dict): Structured data to decrypt.
1268
- filter (str, optional): A filter expression for applying bulk operations to the data field.
1285
+ filter (str): A filter expression for applying bulk operations to the data field.
1269
1286
  version (int, optional): The item version. Defaults to the current version.
1270
1287
  additional_data (str, optional): User provided authentication data.
1271
1288
 
@@ -1286,7 +1303,7 @@ class Vault(ServiceBase):
1286
1303
  )
1287
1304
  """
1288
1305
 
1289
- input = EncryptStructuredRequest(
1306
+ input: EncryptStructuredRequest[TDict] = EncryptStructuredRequest(
1290
1307
  id=id, structured_data=structured_data, filter=filter, version=version, additional_data=additional_data
1291
1308
  )
1292
1309
  return self.request.post(
pangea/utils.py CHANGED
@@ -3,7 +3,6 @@ import copy
3
3
  import datetime
4
4
  import io
5
5
  import json
6
- from binascii import hexlify
7
6
  from collections import OrderedDict
8
7
  from hashlib import new, sha1, sha256, sha512
9
8
 
@@ -31,8 +30,8 @@ def default_encoder(obj) -> str:
31
30
  return str(obj)
32
31
 
33
32
 
34
- def str2str_b64(data: str):
35
- return base64.b64encode(data.encode("ascii")).decode("ascii")
33
+ def str2str_b64(data: str, encoding: str = "utf-8") -> str:
34
+ return base64.b64encode(data.encode(encoding)).decode("ascii")
36
35
 
37
36
 
38
37
  def dict_order_keys(data: dict) -> OrderedDict:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pangea-sdk
3
- Version: 3.6.1
3
+ Version: 3.8.0
4
4
  Summary: Pangea API SDK
5
5
  Home-page: https://pangea.cloud/docs/sdk/python/
6
6
  License: MIT
@@ -17,15 +17,15 @@ Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Topic :: Software Development
18
18
  Classifier: Topic :: Software Development :: Libraries
19
19
  Requires-Dist: aiohttp (>=3.8.6,<4.0.0)
20
- Requires-Dist: alive-progress (>=2.4.1,<3.0.0)
21
20
  Requires-Dist: asyncio (>=3.4.3,<4.0.0)
22
- Requires-Dist: cryptography (>=41.0.6,<42.0.0)
23
- Requires-Dist: deprecated (>=1.2.13,<2.0.0)
21
+ Requires-Dist: cryptography (>=42.0.7,<43.0.0)
22
+ Requires-Dist: deprecated (>=1.2.14,<2.0.0)
24
23
  Requires-Dist: google-crc32c (>=1.5.0,<2.0.0)
25
- Requires-Dist: pydantic (>=1.10.2,<2.0.0)
26
- Requires-Dist: python-dateutil (>=2.8.2,<3.0.0)
24
+ Requires-Dist: pydantic (>=1.10.15,<2.0.0)
25
+ Requires-Dist: python-dateutil (>=2.9.0,<3.0.0)
27
26
  Requires-Dist: requests (>=2.31.0,<3.0.0)
28
- Requires-Dist: schema (>=0.7.5,<0.8.0)
27
+ Requires-Dist: requests-toolbelt (>=1.0.0,<2.0.0)
28
+ Requires-Dist: typing-extensions (>=4.7.1,<5.0.0)
29
29
  Project-URL: Repository, https://github.com/pangeacyber/pangea-python/tree/main/packages/pangea-sdk
30
30
  Description-Content-Type: text/markdown
31
31
 
@@ -40,10 +40,13 @@ Description-Content-Type: text/markdown
40
40
 
41
41
  # Pangea Python SDK
42
42
 
43
- A Python SDK for integrating with Pangea services.
43
+ A Python SDK for integrating with Pangea services. Supports Python v3.7 and
44
+ above.
44
45
 
45
46
  ## Installation
46
47
 
48
+ #### GA releases
49
+
47
50
  Via pip:
48
51
 
49
52
  ```bash
@@ -56,10 +59,32 @@ Via poetry:
56
59
  $ poetry add pangea-sdk
57
60
  ```
58
61
 
62
+ <a name="beta-releases"></a>
63
+
64
+ #### Beta releases
65
+
66
+ Pre-release versions may be available with the `b` (beta) denotation in the
67
+ version number. These releases serve to preview beta services and APIs. Per
68
+ Semantic Versioning, they are considered unstable and do not carry the same
69
+ compatibility guarantees as stable releases. [Beta changelog](https://github.com/pangeacyber/pangea-python/blob/beta/CHANGELOG.md).
70
+
71
+ Via pip:
72
+
73
+ ```bash
74
+ $ pip3 install pangea-sdk==3.8.0b2
75
+ ```
76
+
77
+ Via poetry:
78
+
79
+ ```bash
80
+ $ poetry add pangea-sdk==3.8.0b2
81
+ ```
82
+
59
83
  ## Usage
60
84
 
61
85
  - [Documentation][]
62
- - [Examples][]
86
+ - [GA Examples][]
87
+ - [Beta Examples][]
63
88
 
64
89
  General usage would be to create a token for a service through the
65
90
  [Pangea Console][] and then construct an API client for that respective service.
@@ -203,7 +228,8 @@ It accepts multiple file formats:
203
228
 
204
229
 
205
230
  [Documentation]: https://pangea.cloud/docs/sdk/python/
206
- [Examples]: https://github.com/pangeacyber/pangea-python/tree/main/examples
231
+ [GA Examples]: https://github.com/pangeacyber/pangea-python/tree/main/examples
232
+ [Beta Examples]: https://github.com/pangeacyber/pangea-python/tree/beta/examples
207
233
  [Pangea Console]: https://console.pangea.cloud/
208
234
  [Slack]: https://pangea.cloud/join-slack/
209
235
  [Secure Audit Log]: https://pangea.cloud/docs/audit
@@ -0,0 +1,46 @@
1
+ pangea/__init__.py,sha256=Nq9RV-L96OLvLWJH-nk0U5j6zZHQQSfqGSn6nkvmzWM,200
2
+ pangea/asyncio/request.py,sha256=uvx9d1hmYhGKvbI4ecj6kIagGhPn_4bKmHN062Zz35c,17089
3
+ pangea/asyncio/services/__init__.py,sha256=hmySN2LoXYpHzSKLVSdVjMbpGXi5Z5iNx-fJ2Fc8W6I,320
4
+ pangea/asyncio/services/audit.py,sha256=laWnkT9WHBmwiaoGhNxJcdDBuqZ6Ce3wz8ujdavZgfM,24866
5
+ pangea/asyncio/services/authn.py,sha256=ubxpxCwv6ON9JWYVPCX3FYp-YzHqIuLvE9IsYPQS3-8,44760
6
+ pangea/asyncio/services/authz.py,sha256=z4HrcxjPGZ1X5akXo-nUQ3MWge6reirwdi7d8HHAMyQ,9745
7
+ pangea/asyncio/services/base.py,sha256=4FtKtlq74NmE9myrgIt9HMA6JDnP4mPZ6krafWr286o,2663
8
+ pangea/asyncio/services/embargo.py,sha256=8WguyWZUaGVwGpNzic5h8QzLueirA9WpBBik4mpCTeA,3056
9
+ pangea/asyncio/services/file_scan.py,sha256=WIKYjUNCIx6jF0vQ-KnsKYBcZh53Q5rmccTlsTPP_rY,6301
10
+ pangea/asyncio/services/intel.py,sha256=-0xAfnlAgNH774XRHX1-zIv2nr1Xra7X8tLhuCArQhE,37647
11
+ pangea/asyncio/services/redact.py,sha256=3yuLD-TBiaqDa3OA0PRjvG3kXAifLyrENw8j2Na64-c,5665
12
+ pangea/asyncio/services/vault.py,sha256=m851lZLN9DHp3_r_-1onmecZoFxNHCRCi4N_j288HUY,47836
13
+ pangea/audit_logger.py,sha256=gRkCfUUT5LDNaycwxkhZUySgY47jDfn1ZeKOul4XCQI,3842
14
+ pangea/config.py,sha256=mQUu8GX_6weIuv3vjNdG5plppXskXYASmxMWtFQh-hc,1662
15
+ pangea/deep_verify.py,sha256=mocaGbC6XLbMTVWxTpMv4oJtXGPWpT-SbFqT3obpiZs,8443
16
+ pangea/deprecated.py,sha256=IjFYEVvY1E0ld0SMkEYC1o62MAleX3nnT1If2dFVbHo,608
17
+ pangea/dump_audit.py,sha256=8KrTOP64D28RFv1mvOOxe0fxlRZi8PtwnEZfvabglNA,7019
18
+ pangea/exceptions.py,sha256=OBtzUECpNa6vNp8ySkHC-tm4QjFRCOAHBkMHqzAlOu8,5656
19
+ pangea/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
+ pangea/request.py,sha256=ZcK49SgCPvGwPGrY63UmiTo-xELu2ryPvALmPxPXkGI,24298
21
+ pangea/response.py,sha256=egyLcl0FxEDmTrbRjHuB_DvxipfTXG0ExUS1yLBss-M,6828
22
+ pangea/services/__init__.py,sha256=iAIa1kk_C0EHBsSn2XP3QT-bOZNGwMBPUcO2JoI-9cE,278
23
+ pangea/services/audit/audit.py,sha256=TLGs4ALMEFpQSxC49SMVwRGRxUCslstHMBmSiDpC6mY,38006
24
+ pangea/services/audit/exceptions.py,sha256=bhVuYe4ammacOVxwg98CChxvwZf5FKgR2DcgqILOcwc,471
25
+ pangea/services/audit/models.py,sha256=IViO_WsDz_N8YjPD8pcAcPHWpf2aatd0-VJVl_o_8G4,13953
26
+ pangea/services/audit/signing.py,sha256=pOjw60BIYDcg3_5YKDCMWZUaapsEZpCHaFhyFu7TEgc,5567
27
+ pangea/services/audit/util.py,sha256=C6KAdu6qhValmNrIMUPLdAW0SCiLwcDd5euXti_63Og,7596
28
+ pangea/services/authn/authn.py,sha256=C_u34ASbi3Ul3C6D6f4fqdajcGNPX2CfxKmcLjE016w,43750
29
+ pangea/services/authn/models.py,sha256=FZ5kRBZQ-Pr2YD3jFZ4HvJI22ObbXaBb6HStjcN7-D0,18104
30
+ pangea/services/authz.py,sha256=7bhTJFI4A2mnogLgBPETRabywPolgk1vI0qZJuIxoTw,12424
31
+ pangea/services/base.py,sha256=lwhHoe5Juy28Ir3Mfj2lHdM58gxZRaxa2SRFi4_DBRw,3453
32
+ pangea/services/embargo.py,sha256=WFqBreGU1FPgOSabIIkWCrXBvquYN958Un7h9P1aHSI,3885
33
+ pangea/services/file_scan.py,sha256=tWR4D672Lxk_btSA1NcuUFkajbEhiCGMoTMm2bGtCj4,6942
34
+ pangea/services/intel.py,sha256=t8SksNsh-r1JjLN3if4yNmx711hNjQ_1YzCX-96_xv0,51645
35
+ pangea/services/redact.py,sha256=y_jZxUY4wmEQL2AbCOZLiV14GIweSJ1TUBnyHust80M,8298
36
+ pangea/services/vault/models/asymmetric.py,sha256=ac2Exc66elXxO-HxBqtvLPQWNI7y_00kb6SVqBPKecA,1450
37
+ pangea/services/vault/models/common.py,sha256=Ks6reIlWx3PU1lD0UlorcAlZV8U9T3j711iOsb6qp3o,11120
38
+ pangea/services/vault/models/secret.py,sha256=cLgEj-_BeGkB4-pmSeTkWVyasFbaJwcEltIEcOyf1U8,481
39
+ pangea/services/vault/models/symmetric.py,sha256=5N2n6FDStB1CLPfpd4p-6Ig__Nt-EyurhjCWfEyws2k,1330
40
+ pangea/services/vault/vault.py,sha256=s_qGLDlk-LOSsODpnvo_VPtH_4HGgwCOprSCKCNaCfY,47619
41
+ pangea/tools.py,sha256=sa2pSz-L8tB6GcZg6lghsmm8w0qMQAIkzqcv7dilU6Q,6429
42
+ pangea/utils.py,sha256=nTrw0lcw4s0R2m_LFIoypFU4ilsBfjV1eCf_bTjJ-Lo,3489
43
+ pangea/verify_audit.py,sha256=QthhKzFlIQwoEyjBLojcX4uHGaN3EEGomx-IC5e3L0E,10756
44
+ pangea_sdk-3.8.0.dist-info/METADATA,sha256=Lc1OJgV2dQvDx9HmppMIjctCA4b2aKmFzFQ2r-pPPKQ,7464
45
+ pangea_sdk-3.8.0.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
46
+ pangea_sdk-3.8.0.dist-info/RECORD,,
@@ -1,44 +0,0 @@
1
- pangea/__init__.py,sha256=BJZKp3TRjFRK2FejbgZkPIXoKJ2bJY9tDn_L9tZOpPw,200
2
- pangea/asyncio/request.py,sha256=iu9B9TUd2Cs1Jo7OqhtkXjcizXXx6zsLYdqlWea0QtU,13319
3
- pangea/asyncio/services/__init__.py,sha256=_CEDza6E9VmEs6d_vubWetfeqTogH7UxT7XrTVRw4Mo,290
4
- pangea/asyncio/services/audit.py,sha256=mGkNNLpE6IIKOdvTEp2GTgtoTteP0NxU8lFZKtDXw9U,16549
5
- pangea/asyncio/services/authn.py,sha256=HssvrZ3fr2oP5sgYBj1Rr5Yf-fKiHhrWTue5LOAeyOk,43288
6
- pangea/asyncio/services/base.py,sha256=we0iDbtkjP6lX-qSEFdqaNHxc2sgZ9-U2519sxsbgt8,2358
7
- pangea/asyncio/services/embargo.py,sha256=8WguyWZUaGVwGpNzic5h8QzLueirA9WpBBik4mpCTeA,3056
8
- pangea/asyncio/services/file_scan.py,sha256=741p2GW6jWX5nEOrBOdr9sozHrd3AtfXlUqM5zlYZtg,6253
9
- pangea/asyncio/services/intel.py,sha256=NyJPzDsBejpzItZ2C89olTbOae-paaPdzYG_U2ti42o,37643
10
- pangea/asyncio/services/redact.py,sha256=W9eKMw1XyY6tgRudRrtuCpyQYhgttvmsYngoiMld0C4,5152
11
- pangea/asyncio/services/vault.py,sha256=_kPQJWJTwKYXhPnEfxhnjOgFaC78rb0f385X6R6ksjA,47274
12
- pangea/audit_logger.py,sha256=gRkCfUUT5LDNaycwxkhZUySgY47jDfn1ZeKOul4XCQI,3842
13
- pangea/config.py,sha256=kFu9mLMkFpkM7wdT8Ymvskx6DGLfRZKeKfQRVZTgbyA,1670
14
- pangea/deep_verify.py,sha256=mocaGbC6XLbMTVWxTpMv4oJtXGPWpT-SbFqT3obpiZs,8443
15
- pangea/deprecated.py,sha256=IjFYEVvY1E0ld0SMkEYC1o62MAleX3nnT1If2dFVbHo,608
16
- pangea/dump_audit.py,sha256=WI5T9cUAxb_EfoPHxFYgDDW56w_HuycTMvv_OTG_7CU,7018
17
- pangea/exceptions.py,sha256=auw_zXkNCUBE0fWABoWXCErI378cnShIHTbkpUlmgQ0,5489
18
- pangea/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
- pangea/request.py,sha256=y7OTGROZlnlaq1rQDd8dIiJYm_vl6xGqwASXq5w_EFw,21227
20
- pangea/response.py,sha256=wyClAgow0s_plDE352mad0yF1TKB3wT4D8nRHfyiqLU,5669
21
- pangea/services/__init__.py,sha256=auqKaEAOLiazHCzOQVwrUwd2ABFw_bF-ptoOq1bpa68,253
22
- pangea/services/audit/audit.py,sha256=CmndP2eSPj5XZaC8oF0EdqNFihq2CodhSJOT9XMyixk,31013
23
- pangea/services/audit/exceptions.py,sha256=CVdaQZCvQKx1n-iIjWz5wnStUGU6cXDwKqe7MoijAXk,451
24
- pangea/services/audit/models.py,sha256=Q9DyLl9wywisPFveQwtO_OKB-eVD0jUySscEbPW9I5Y,12263
25
- pangea/services/audit/signing.py,sha256=_28Es7gAOqhp2ebRtRZ7ZnZUoGY5mCTccWtz-LYOddk,5566
26
- pangea/services/audit/util.py,sha256=9alRcJbWhrrj_4phjrKd-lm4_Z48lmZ1mfjkhpFTDWw,7595
27
- pangea/services/authn/authn.py,sha256=sGQUPQ8VLEMtu8AkEhWPyY6Q6AxCsfrX-XNUzkC-o1M,42774
28
- pangea/services/authn/models.py,sha256=DuOqlwWaliyZOH5rt8c-_tvBY9NDzkHFD5fSU_3mm0U,18154
29
- pangea/services/base.py,sha256=Y6tzk5FkDK9bswafoxvLk5KO2bH-xdjzBo8A3d3ZmFA,2846
30
- pangea/services/embargo.py,sha256=F3jx7SbElnjhbDEUR3oHfWsQ8G8zf_kfp6_q1_vmOIc,3871
31
- pangea/services/file_scan.py,sha256=alIL4PdQXpfnC69HJyHeFT0-nPizpRVpgvZKs0q1GlU,6908
32
- pangea/services/intel.py,sha256=3L8WZhxCvMSLF0Oa2CRyavxruiHD84BHkEOUSutPZh4,51623
33
- pangea/services/redact.py,sha256=LHnFUhivLIZ5O2Ss8tYOfYxqQVY4rgdw4WUSxgFyAB0,7758
34
- pangea/services/vault/models/asymmetric.py,sha256=ac2Exc66elXxO-HxBqtvLPQWNI7y_00kb6SVqBPKecA,1450
35
- pangea/services/vault/models/common.py,sha256=-GleGqN3O4SFuPDXVeJG_Yh6axQMboIqZfKxqYDGtv0,9986
36
- pangea/services/vault/models/secret.py,sha256=cLgEj-_BeGkB4-pmSeTkWVyasFbaJwcEltIEcOyf1U8,481
37
- pangea/services/vault/models/symmetric.py,sha256=5N2n6FDStB1CLPfpd4p-6Ig__Nt-EyurhjCWfEyws2k,1330
38
- pangea/services/vault/vault.py,sha256=wjXPAJDRgQy3dfPBWv3tMo2XGXiMxP411lLZuajDrxs,47104
39
- pangea/tools.py,sha256=sa2pSz-L8tB6GcZg6lghsmm8w0qMQAIkzqcv7dilU6Q,6429
40
- pangea/utils.py,sha256=VUHCt2qxhobn4PsvrsqhOhOGVWR6N8sYjPZBpKxFbrI,3485
41
- pangea/verify_audit.py,sha256=QthhKzFlIQwoEyjBLojcX4uHGaN3EEGomx-IC5e3L0E,10756
42
- pangea_sdk-3.6.1.dist-info/METADATA,sha256=byKg3_B0dCPXbTsjvDupGdC5N1nft4qN7cfmd7Afi9Q,6761
43
- pangea_sdk-3.6.1.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
44
- pangea_sdk-3.6.1.dist-info/RECORD,,