pangea-sdk 4.4.0__py3-none-any.whl → 5.1.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 +1 -1
- pangea/asyncio/request.py +19 -9
- pangea/asyncio/services/__init__.py +1 -0
- pangea/asyncio/services/share.py +621 -0
- pangea/asyncio/services/vault.py +1571 -787
- pangea/crypto/rsa.py +88 -0
- pangea/request.py +46 -41
- pangea/response.py +12 -0
- pangea/services/__init__.py +1 -0
- pangea/services/audit/signing.py +5 -4
- pangea/services/share/file_format.py +170 -0
- pangea/services/share/share.py +1256 -0
- pangea/services/vault/models/asymmetric.py +120 -20
- pangea/services/vault/models/common.py +293 -171
- pangea/services/vault/models/keys.py +94 -0
- pangea/services/vault/models/secret.py +27 -3
- pangea/services/vault/models/symmetric.py +66 -24
- pangea/services/vault/vault.py +1551 -782
- pangea/tools.py +6 -7
- pangea/utils.py +92 -18
- pangea/verify_audit.py +4 -4
- {pangea_sdk-4.4.0.dist-info → pangea_sdk-5.1.0.dist-info}/METADATA +3 -4
- {pangea_sdk-4.4.0.dist-info → pangea_sdk-5.1.0.dist-info}/RECORD +24 -20
- {pangea_sdk-4.4.0.dist-info → pangea_sdk-5.1.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,94 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import Literal, Optional, Union
|
4
|
+
|
5
|
+
from pangea.response import APIRequestModel, PangeaDateTime
|
6
|
+
from pangea.services.vault.models.asymmetric import (
|
7
|
+
AsymmetricKeyEncryptionAlgorithm,
|
8
|
+
AsymmetricKeyJwtAlgorithm,
|
9
|
+
AsymmetricKeyPkiAlgorithm,
|
10
|
+
AsymmetricKeyPurpose,
|
11
|
+
AsymmetricKeySigningAlgorithm,
|
12
|
+
)
|
13
|
+
from pangea.services.vault.models.common import (
|
14
|
+
ItemType,
|
15
|
+
Metadata,
|
16
|
+
RequestManualRotationState,
|
17
|
+
RequestRotationState,
|
18
|
+
Tags,
|
19
|
+
)
|
20
|
+
from pangea.services.vault.models.symmetric import (
|
21
|
+
SymmetricKeyEncryptionAlgorithm,
|
22
|
+
SymmetricKeyFpeAlgorithm,
|
23
|
+
SymmetricKeyJwtAlgorithm,
|
24
|
+
SymmetricKeyPurpose,
|
25
|
+
)
|
26
|
+
|
27
|
+
|
28
|
+
class CommonGenerateRequest(APIRequestModel):
|
29
|
+
type: Literal[ItemType.ASYMMETRIC_KEY, ItemType.SYMMETRIC_KEY]
|
30
|
+
purpose: Union[AsymmetricKeyPurpose, SymmetricKeyPurpose]
|
31
|
+
algorithm: Union[
|
32
|
+
AsymmetricKeySigningAlgorithm,
|
33
|
+
AsymmetricKeyEncryptionAlgorithm,
|
34
|
+
AsymmetricKeyJwtAlgorithm,
|
35
|
+
AsymmetricKeyPkiAlgorithm,
|
36
|
+
SymmetricKeyEncryptionAlgorithm,
|
37
|
+
SymmetricKeyJwtAlgorithm,
|
38
|
+
SymmetricKeyFpeAlgorithm,
|
39
|
+
]
|
40
|
+
name: Optional[str] = None
|
41
|
+
folder: Optional[str] = None
|
42
|
+
metadata: Optional[Metadata] = None
|
43
|
+
tags: Optional[Tags] = None
|
44
|
+
rotation_frequency: Optional[str] = None
|
45
|
+
rotation_state: Optional[RequestRotationState] = RequestRotationState.INHERITED
|
46
|
+
disabled_at: Optional[PangeaDateTime] = None
|
47
|
+
exportable: bool = False
|
48
|
+
|
49
|
+
|
50
|
+
class KeyStoreRequest(APIRequestModel):
|
51
|
+
# Required.
|
52
|
+
type: Literal[ItemType.ASYMMETRIC_KEY, ItemType.SYMMETRIC_KEY]
|
53
|
+
purpose: Union[AsymmetricKeyPurpose, SymmetricKeyPurpose]
|
54
|
+
algorithm: Union[
|
55
|
+
AsymmetricKeySigningAlgorithm,
|
56
|
+
AsymmetricKeyEncryptionAlgorithm,
|
57
|
+
AsymmetricKeyJwtAlgorithm,
|
58
|
+
AsymmetricKeyPkiAlgorithm,
|
59
|
+
SymmetricKeyEncryptionAlgorithm,
|
60
|
+
SymmetricKeyJwtAlgorithm,
|
61
|
+
SymmetricKeyFpeAlgorithm,
|
62
|
+
]
|
63
|
+
|
64
|
+
# Asymmetric.
|
65
|
+
public_key: Optional[str] = None
|
66
|
+
private_key: Optional[str] = None
|
67
|
+
|
68
|
+
# Symmetric.
|
69
|
+
key: Optional[str] = None
|
70
|
+
|
71
|
+
# Optional.
|
72
|
+
name: Optional[str] = None
|
73
|
+
folder: Optional[str] = None
|
74
|
+
metadata: Optional[Metadata] = None
|
75
|
+
tags: Optional[Tags] = None
|
76
|
+
rotation_frequency: Optional[str] = None
|
77
|
+
rotation_state: Optional[RequestRotationState] = RequestRotationState.INHERITED
|
78
|
+
disabled_at: Optional[PangeaDateTime] = None
|
79
|
+
exportable: bool = False
|
80
|
+
|
81
|
+
|
82
|
+
class KeyRotateRequest(APIRequestModel):
|
83
|
+
# Required.
|
84
|
+
id: str
|
85
|
+
|
86
|
+
# Asymmetric.
|
87
|
+
public_key: Optional[str] = None
|
88
|
+
private_key: Optional[str] = None
|
89
|
+
|
90
|
+
# Symmetric.
|
91
|
+
key: Optional[str] = None
|
92
|
+
|
93
|
+
# Optional.
|
94
|
+
rotation_state: RequestManualRotationState = RequestManualRotationState.DEACTIVATED
|
@@ -1,15 +1,39 @@
|
|
1
1
|
# Copyright 2022 Pangea Cyber Corporation
|
2
2
|
# Author: Pangea Cyber Corporation
|
3
|
+
from typing import Optional
|
4
|
+
|
5
|
+
from typing_extensions import Literal
|
6
|
+
|
7
|
+
from pangea.response import APIRequestModel, PangeaDateTime
|
3
8
|
from pangea.services.vault.models.common import (
|
4
9
|
CommonRotateRequest,
|
5
10
|
CommonRotateResult,
|
6
|
-
CommonStoreRequest,
|
7
11
|
CommonStoreResult,
|
12
|
+
Metadata,
|
13
|
+
Tags,
|
8
14
|
)
|
9
15
|
|
10
16
|
|
11
|
-
class SecretStoreRequest(
|
12
|
-
|
17
|
+
class SecretStoreRequest(APIRequestModel):
|
18
|
+
type: Literal["secret", "pangea_token", "pangea_client_secret", "pangea_platform_client_secret"]
|
19
|
+
|
20
|
+
# Secret.
|
21
|
+
secret: Optional[str] = None
|
22
|
+
|
23
|
+
# Pangea token.
|
24
|
+
token: Optional[str] = None
|
25
|
+
|
26
|
+
# Pangea client secret.
|
27
|
+
client_secret: Optional[str] = None
|
28
|
+
client_id: Optional[str] = None
|
29
|
+
client_secret_id: Optional[str] = None
|
30
|
+
|
31
|
+
# Optional.
|
32
|
+
name: Optional[str] = None
|
33
|
+
folder: Optional[str] = None
|
34
|
+
metadata: Optional[Metadata] = None
|
35
|
+
tags: Optional[Tags] = None
|
36
|
+
disabled_at: Optional[PangeaDateTime] = None
|
13
37
|
|
14
38
|
|
15
39
|
class SecretStoreResult(CommonStoreResult):
|
@@ -1,25 +1,14 @@
|
|
1
1
|
# Copyright 2022 Pangea Cyber Corporation
|
2
2
|
# Author: Pangea Cyber Corporation
|
3
|
-
from
|
3
|
+
from __future__ import annotations
|
4
4
|
|
5
|
-
from
|
6
|
-
from
|
7
|
-
CommonGenerateRequest,
|
8
|
-
CommonGenerateResult,
|
9
|
-
CommonStoreRequest,
|
10
|
-
CommonStoreResult,
|
11
|
-
EncodedSymmetricKey,
|
12
|
-
KeyPurpose,
|
13
|
-
SymmetricAlgorithm,
|
14
|
-
)
|
5
|
+
from enum import Enum
|
6
|
+
from typing import List, Optional, Union
|
15
7
|
|
8
|
+
from typing_extensions import Literal
|
16
9
|
|
17
|
-
|
18
|
-
|
19
|
-
algorithm: SymmetricAlgorithm
|
20
|
-
purpose: KeyPurpose
|
21
|
-
exportable: Optional[bool] = None
|
22
|
-
"""Whether the key is exportable or not."""
|
10
|
+
from pangea.response import APIRequestModel, PangeaResponseResult
|
11
|
+
from pangea.services.vault.models.common import CommonGenerateResult, CommonStoreResult, ItemType, ItemVersion, Key
|
23
12
|
|
24
13
|
|
25
14
|
class SymmetricStoreResult(CommonStoreResult):
|
@@ -27,13 +16,6 @@ class SymmetricStoreResult(CommonStoreResult):
|
|
27
16
|
purpose: str
|
28
17
|
|
29
18
|
|
30
|
-
class SymmetricGenerateRequest(CommonGenerateRequest):
|
31
|
-
algorithm: SymmetricAlgorithm
|
32
|
-
purpose: KeyPurpose
|
33
|
-
exportable: Optional[bool] = None
|
34
|
-
"""Whether the key is exportable or not."""
|
35
|
-
|
36
|
-
|
37
19
|
class SymmetricGenerateResult(CommonGenerateResult):
|
38
20
|
algorithm: str
|
39
21
|
purpose: str
|
@@ -48,9 +30,16 @@ class EncryptRequest(APIRequestModel):
|
|
48
30
|
|
49
31
|
class EncryptResult(PangeaResponseResult):
|
50
32
|
id: str
|
33
|
+
"""The ID of the item."""
|
34
|
+
|
51
35
|
version: int
|
36
|
+
"""The item version."""
|
37
|
+
|
52
38
|
algorithm: str
|
39
|
+
"""The algorithm of the key."""
|
40
|
+
|
53
41
|
cipher_text: str
|
42
|
+
"""The encrypted message (Base64 encoded)."""
|
54
43
|
|
55
44
|
|
56
45
|
class DecryptRequest(APIRequestModel):
|
@@ -62,6 +51,59 @@ class DecryptRequest(APIRequestModel):
|
|
62
51
|
|
63
52
|
class DecryptResult(PangeaResponseResult):
|
64
53
|
id: str
|
54
|
+
"""The ID of the item."""
|
55
|
+
|
65
56
|
version: int
|
57
|
+
"""The item version."""
|
58
|
+
|
66
59
|
algorithm: str
|
60
|
+
"""The algorithm of the key."""
|
61
|
+
|
67
62
|
plain_text: str
|
63
|
+
"""The decrypted message."""
|
64
|
+
|
65
|
+
|
66
|
+
class SymmetricKeyPurpose(str, Enum):
|
67
|
+
"""The purpose of a symmetric key."""
|
68
|
+
|
69
|
+
ENCRYPTION = "encryption"
|
70
|
+
JWT = "jwt"
|
71
|
+
FPE = "fpe"
|
72
|
+
"""Format-preserving encryption."""
|
73
|
+
|
74
|
+
|
75
|
+
class SymmetricKeyEncryptionAlgorithm(str, Enum):
|
76
|
+
AES_CFB_128 = "AES-CFB-128"
|
77
|
+
AES_CFB_256 = "AES-CFB-256"
|
78
|
+
AES_GCM_256 = "AES-GCM-256"
|
79
|
+
AES_CBC_128 = "AES-CBC-128"
|
80
|
+
AES_CBC_256 = "AES-CBC-256"
|
81
|
+
|
82
|
+
|
83
|
+
class SymmetricKeyJwtAlgorithm(str, Enum):
|
84
|
+
HS256 = "HS256"
|
85
|
+
HS384 = "HS384"
|
86
|
+
HS512 = "HS512"
|
87
|
+
|
88
|
+
|
89
|
+
class SymmetricKeyFpeAlgorithm(str, Enum):
|
90
|
+
"""The algorithm of the key for purpose=`fpe` (Format Preserving Encryption)."""
|
91
|
+
|
92
|
+
AES_FF3_1_128_BETA = "AES-FF3-1-128-BETA"
|
93
|
+
"""128-bit encryption using the FF3-1 algorithm."""
|
94
|
+
|
95
|
+
AES_FF3_1_256_BETA = "AES-FF3-1-256-BETA"
|
96
|
+
"""256-bit encryption using the FF3-1 algorithm."""
|
97
|
+
|
98
|
+
|
99
|
+
SymmetricKeyAlgorithm = Union[SymmetricKeyEncryptionAlgorithm, SymmetricKeyJwtAlgorithm, SymmetricKeyFpeAlgorithm]
|
100
|
+
"""The algorithm of a symmetric key."""
|
101
|
+
|
102
|
+
|
103
|
+
class SymmetricKeyVersion(ItemVersion):
|
104
|
+
pass
|
105
|
+
|
106
|
+
|
107
|
+
class SymmetricKey(Key):
|
108
|
+
type: Literal[ItemType.SYMMETRIC_KEY] = ItemType.SYMMETRIC_KEY
|
109
|
+
item_versions: List[SymmetricKeyVersion]
|