pangea-sdk 3.8.0__py3-none-any.whl → 5.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.
Files changed (51) hide show
  1. pangea/__init__.py +2 -1
  2. pangea/asyncio/__init__.py +1 -0
  3. pangea/asyncio/file_uploader.py +39 -0
  4. pangea/asyncio/request.py +46 -23
  5. pangea/asyncio/services/__init__.py +2 -0
  6. pangea/asyncio/services/audit.py +46 -20
  7. pangea/asyncio/services/authn.py +123 -61
  8. pangea/asyncio/services/authz.py +57 -31
  9. pangea/asyncio/services/base.py +21 -2
  10. pangea/asyncio/services/embargo.py +2 -2
  11. pangea/asyncio/services/file_scan.py +24 -9
  12. pangea/asyncio/services/intel.py +104 -30
  13. pangea/asyncio/services/redact.py +52 -3
  14. pangea/asyncio/services/sanitize.py +217 -0
  15. pangea/asyncio/services/share.py +733 -0
  16. pangea/asyncio/services/vault.py +1709 -766
  17. pangea/crypto/rsa.py +135 -0
  18. pangea/deep_verify.py +7 -1
  19. pangea/dump_audit.py +9 -8
  20. pangea/file_uploader.py +35 -0
  21. pangea/request.py +70 -49
  22. pangea/response.py +36 -17
  23. pangea/services/__init__.py +2 -0
  24. pangea/services/audit/audit.py +57 -29
  25. pangea/services/audit/models.py +12 -3
  26. pangea/services/audit/signing.py +6 -5
  27. pangea/services/audit/util.py +3 -3
  28. pangea/services/authn/authn.py +120 -66
  29. pangea/services/authn/models.py +167 -11
  30. pangea/services/authz.py +53 -30
  31. pangea/services/base.py +16 -2
  32. pangea/services/embargo.py +2 -2
  33. pangea/services/file_scan.py +32 -15
  34. pangea/services/intel.py +155 -30
  35. pangea/services/redact.py +132 -3
  36. pangea/services/sanitize.py +388 -0
  37. pangea/services/share/file_format.py +170 -0
  38. pangea/services/share/share.py +1440 -0
  39. pangea/services/vault/models/asymmetric.py +120 -18
  40. pangea/services/vault/models/common.py +439 -141
  41. pangea/services/vault/models/keys.py +94 -0
  42. pangea/services/vault/models/secret.py +27 -3
  43. pangea/services/vault/models/symmetric.py +68 -22
  44. pangea/services/vault/vault.py +1690 -766
  45. pangea/tools.py +6 -7
  46. pangea/utils.py +94 -33
  47. pangea/verify_audit.py +270 -83
  48. {pangea_sdk-3.8.0.dist-info → pangea_sdk-5.3.0.dist-info}/METADATA +21 -29
  49. pangea_sdk-5.3.0.dist-info/RECORD +56 -0
  50. {pangea_sdk-3.8.0.dist-info → pangea_sdk-5.3.0.dist-info}/WHEEL +1 -1
  51. pangea_sdk-3.8.0.dist-info/RECORD +0 -46
@@ -1,38 +1,29 @@
1
1
  # Copyright 2022 Pangea Cyber Corporation
2
2
  # Author: Pangea Cyber Corporation
3
- from typing import Optional
3
+ from __future__ import annotations
4
+
5
+ from enum import Enum
6
+ from typing import List, Optional, Union
7
+
8
+ from typing_extensions import Literal
4
9
 
5
10
  from pangea.response import APIRequestModel, PangeaResponseResult
6
11
  from pangea.services.vault.models.common import (
7
- AsymmetricAlgorithm,
8
- CommonGenerateRequest,
9
12
  CommonGenerateResult,
10
- CommonStoreRequest,
11
13
  CommonStoreResult,
12
- EncodedPrivateKey,
13
14
  EncodedPublicKey,
14
- KeyPurpose,
15
+ ItemType,
16
+ ItemVersion,
17
+ Key,
15
18
  )
16
19
 
17
20
 
18
- class AsymmetricGenerateRequest(CommonGenerateRequest):
19
- algorithm: AsymmetricAlgorithm
20
- purpose: KeyPurpose
21
-
22
-
23
21
  class AsymmetricGenerateResult(CommonGenerateResult):
24
22
  algorithm: str
25
23
  purpose: str
26
24
  public_key: EncodedPublicKey
27
25
 
28
26
 
29
- class AsymmetricStoreRequest(CommonStoreRequest):
30
- algorithm: AsymmetricAlgorithm
31
- public_key: EncodedPublicKey
32
- private_key: EncodedPrivateKey
33
- purpose: KeyPurpose
34
-
35
-
36
27
  class AsymmetricStoreResult(CommonStoreResult):
37
28
  algorithm: str
38
29
  purpose: str
@@ -47,10 +38,19 @@ class SignRequest(APIRequestModel):
47
38
 
48
39
  class SignResult(PangeaResponseResult):
49
40
  id: str
41
+ """The ID of the item."""
42
+
50
43
  version: int
44
+ """The item version."""
45
+
51
46
  algorithm: str
47
+ """The algorithm of the key."""
48
+
52
49
  signature: str
50
+ """The signature of the message."""
51
+
53
52
  public_key: Optional[EncodedPublicKey] = None
53
+ """The public key (in PEM format)."""
54
54
 
55
55
 
56
56
  class VerifyRequest(APIRequestModel):
@@ -62,6 +62,108 @@ class VerifyRequest(APIRequestModel):
62
62
 
63
63
  class VerifyResult(PangeaResponseResult):
64
64
  id: str
65
+ """The ID of the item."""
66
+
65
67
  version: int
68
+ """The item version."""
69
+
66
70
  algorithm: str
71
+ """The algorithm of the key."""
72
+
67
73
  valid_signature: bool
74
+ """Indicates if messages have been verified."""
75
+
76
+
77
+ class AsymmetricKeyPurpose(str, Enum):
78
+ """The purpose of an asymmetric key."""
79
+
80
+ SIGNING = "signing"
81
+ ENCRYPTION = "encryption"
82
+ JWT = "jwt"
83
+ PKI = "pki"
84
+
85
+
86
+ class AsymmetricKeySigningAlgorithm(str, Enum):
87
+ """The algorithm of the key for purpose=`signing`."""
88
+
89
+ ED25519 = "ED25519"
90
+ RSA_PKCS1V15_2048_SHA256 = "RSA-PKCS1V15-2048-SHA256"
91
+ ES256 = "ES256"
92
+ ES384 = "ES384"
93
+ ES512 = "ES512"
94
+ ES256K = "ES256K"
95
+ RSA_PSS_2048_SHA256 = "RSA-PSS-2048-SHA256"
96
+ RSA_PSS_3072_SHA256 = "RSA-PSS-3072-SHA256"
97
+ RSA_PSS_4096_SHA256 = "RSA-PSS-4096-SHA256"
98
+ RSA_PSS_4096_SHA512 = "RSA-PSS-4096-SHA512"
99
+ ED25519_DILITHIUM2_BETA = "ED25519-DILITHIUM2-BETA"
100
+ ED448_DILITHIUM3_BETA = "ED448-DILITHIUM3-BETA"
101
+ SPHINCSPLUS_128F_SHAKE256_SIMPLE_BETA = "SPHINCSPLUS-128F-SHAKE256-SIMPLE-BETA"
102
+ SPHINCSPLUS_128F_SHAKE256_ROBUST_BETA = "SPHINCSPLUS-128F-SHAKE256-ROBUST-BETA"
103
+ SPHINCSPLUS_128F_SHA256_SIMPLE_BETA = "SPHINCSPLUS-128F-SHA256-SIMPLE-BETA"
104
+ SPHINCSPLUS_128F_SHA256_ROBUST_BETA = "SPHINCSPLUS-128F-SHA256-ROBUST-BETA"
105
+ SPHINCSPLUS_192F_SHAKE256_SIMPLE_BETA = "SPHINCSPLUS-192F-SHAKE256-SIMPLE-BETA"
106
+ SPHINCSPLUS_192F_SHAKE256_ROBUST_BETA = "SPHINCSPLUS-192F-SHAKE256-ROBUST-BETA"
107
+ SPHINCSPLUS_192F_SHA256_SIMPLE_BETA = "SPHINCSPLUS-192F-SHA256-SIMPLE-BETA"
108
+ SPHINCSPLUS_192F_SHA256_ROBUST_BETA = "SPHINCSPLUS-192F-SHA256-ROBUST-BETA"
109
+ SPHINCSPLUS_256F_SHAKE256_SIMPLE_BETA = "SPHINCSPLUS-256F-SHAKE256-SIMPLE-BETA"
110
+ SPHINCSPLUS_256F_SHAKE256_ROBUST_BETA = "SPHINCSPLUS-256F-SHAKE256-ROBUST-BETA"
111
+ SPHINCSPLUS_256F_SHA256_SIMPLE_BETA = "SPHINCSPLUS-256F-SHA256-SIMPLE-BETA"
112
+ SPHINCSPLUS_256F_SHA256_ROBUST_BETA = "SPHINCSPLUS-256F-SHA256-ROBUST-BETA"
113
+ FALCON_1024_BETA = "FALCON-1024-BETA"
114
+
115
+
116
+ class AsymmetricKeyEncryptionAlgorithm(str, Enum):
117
+ """The algorithm of the key for purpose=`encryption`."""
118
+
119
+ RSA_OAEP_2048_SHA1 = "RSA-OAEP-2048-SHA1"
120
+ RSA_OAEP_2048_SHA256 = "RSA-OAEP-2048-SHA256"
121
+ RSA_OAEP_2048_SHA512 = "RSA-OAEP-2048-SHA512"
122
+ RSA_OAEP_3072_SHA1 = "RSA-OAEP-3072-SHA1"
123
+ RSA_OAEP_3072_SHA256 = "RSA-OAEP-3072-SHA256"
124
+ RSA_OAEP_3072_SHA512 = "RSA-OAEP-3072-SHA512"
125
+ RSA_OAEP_4096_SHA1 = "RSA-OAEP-4096-SHA1"
126
+ RSA_OAEP_4096_SHA256 = "RSA-OAEP-4096-SHA256"
127
+ RSA_OAEP_4096_SHA512 = "RSA-OAEP-4096-SHA512"
128
+
129
+
130
+ class AsymmetricKeyJwtAlgorithm(str, Enum):
131
+ """The algorithm of the key for purpose=`jwt`."""
132
+
133
+ ES256 = "ES256"
134
+ ES384 = "ES384"
135
+ ES512 = "ES512"
136
+
137
+
138
+ class AsymmetricKeyPkiAlgorithm(str, Enum):
139
+ """The algorithm of the key for purpose=`pki`."""
140
+
141
+ ED25519 = "ED25519"
142
+ RSA_2048_SHA256 = "RSA-2048-SHA256"
143
+ RSA_3072_SHA256 = "RSA-3072-SHA256"
144
+ RSA_4096_SHA256 = "RSA-4096-SHA256"
145
+ RSA_PSS_2048_SHA256 = "RSA-PSS-2048-SHA256"
146
+ RSA_PSS_3072_SHA256 = "RSA-PSS-3072-SHA256"
147
+ RSA_PSS_4096_SHA256 = "RSA-PSS-4096-SHA256"
148
+ RSA_PSS_4096_SHA512 = "RSA-PSS-4096-SHA512"
149
+ ECDSA_SHA256 = "ECDSA-SHA256"
150
+ ECDSA_SHA384 = "ECDSA-SHA384"
151
+ ECDSA_SHA512 = "ECDSA-SHA512"
152
+
153
+
154
+ AsymmetricKeyAlgorithm = Union[
155
+ AsymmetricKeySigningAlgorithm,
156
+ AsymmetricKeyEncryptionAlgorithm,
157
+ AsymmetricKeyJwtAlgorithm,
158
+ AsymmetricKeyPkiAlgorithm,
159
+ ]
160
+ """The algorithm of an asymmetric key."""
161
+
162
+
163
+ class AsymmetricKeyVersion(ItemVersion):
164
+ public_key: Optional[EncodedPublicKey] = None
165
+
166
+
167
+ class AsymmetricKey(Key):
168
+ type: Literal[ItemType.ASYMMETRIC_KEY] = ItemType.ASYMMETRIC_KEY
169
+ item_versions: List[AsymmetricKeyVersion]