infisicalsdk 1.0.11__tar.gz → 1.0.12__tar.gz
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.
Potentially problematic release.
This version of infisicalsdk might be problematic. Click here for more details.
- infisicalsdk-1.0.12/LICENSE +11 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/PKG-INFO +3 -1
- infisicalsdk-1.0.12/README.md +40 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisical_sdk/api_types.py +99 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisical_sdk/client.py +2 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisical_sdk/resources/__init__.py +2 -1
- infisicalsdk-1.0.12/infisical_sdk/resources/folders.py +75 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisicalsdk.egg-info/PKG-INFO +3 -1
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisicalsdk.egg-info/SOURCES.txt +2 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/setup.py +1 -1
- infisicalsdk-1.0.11/README.md +0 -399
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisical_sdk/__init__.py +0 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisical_sdk/infisical_requests.py +0 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisical_sdk/resources/auth.py +0 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisical_sdk/resources/auth_methods/__init__.py +0 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisical_sdk/resources/auth_methods/aws_auth.py +0 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisical_sdk/resources/auth_methods/oidc_auth.py +0 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisical_sdk/resources/auth_methods/universal_auth.py +0 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisical_sdk/resources/kms.py +0 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisical_sdk/resources/secrets.py +0 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisical_sdk/util/__init__.py +0 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisical_sdk/util/secrets_cache.py +0 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisicalsdk.egg-info/dependency_links.txt +0 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisicalsdk.egg-info/requires.txt +0 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisicalsdk.egg-info/top_level.txt +0 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/pyproject.toml +0 -0
- {infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/setup.cfg +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Infisical
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
10
|
+
|
|
11
|
+
NOTE: This license pertains specifically to components of the codebase that do not possess an explicit license. Each distinct SDK incorporated within this software is governed by its individual licensing terms and conditions. The provisions outlined in this MIT license are applicable to those segments of the codebase not explicitly covered by their respective licenses.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: infisicalsdk
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.12
|
|
4
4
|
Summary: Official Infisical SDK for Python (Latest)
|
|
5
5
|
Home-page: https://github.com/Infisical/python-sdk-official
|
|
6
6
|
Author: Infisical
|
|
7
7
|
Author-email: support@infisical.com
|
|
8
8
|
Keywords: Infisical,Infisical API,Infisical SDK,SDK,Secrets Management
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
10
11
|
Requires-Dist: python-dateutil
|
|
11
12
|
Requires-Dist: aenum
|
|
12
13
|
Requires-Dist: requests~=2.32
|
|
@@ -18,6 +19,7 @@ Dynamic: description
|
|
|
18
19
|
Dynamic: description-content-type
|
|
19
20
|
Dynamic: home-page
|
|
20
21
|
Dynamic: keywords
|
|
22
|
+
Dynamic: license-file
|
|
21
23
|
Dynamic: requires-dist
|
|
22
24
|
Dynamic: summary
|
|
23
25
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<img width="300" src="/img/logoname-white.svg#gh-dark-mode-only" alt="infisical">
|
|
3
|
+
</h1>
|
|
4
|
+
<p align="center">
|
|
5
|
+
<p align="center"><b>Infisical Python SDK</b></p>
|
|
6
|
+
<h4 align="center">
|
|
7
|
+
|
|
|
8
|
+
<a href="https://infisical.com/docs/sdks/languages/python">Documentation</a> |
|
|
9
|
+
<a href="https://www.infisical.com">Website</a> |
|
|
10
|
+
<a href="https://infisical.com/slack">Slack</a> |
|
|
11
|
+
</h4>
|
|
12
|
+
|
|
13
|
+
<h4 align="center">
|
|
14
|
+
<a href="https://github.com/Infisical/python-sdk-official/blob/main/LICENSE">
|
|
15
|
+
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="Infisical SDK's are released under the MIT license." />
|
|
16
|
+
</a>
|
|
17
|
+
<a href="https://infisical.com/slack">
|
|
18
|
+
<img src="https://img.shields.io/badge/chat-on%20Slack-blueviolet" alt="Slack community channel" />
|
|
19
|
+
</a>
|
|
20
|
+
<a href="https://twitter.com/infisical">
|
|
21
|
+
<img src="https://img.shields.io/twitter/follow/infisical?label=Follow" alt="Infisical Twitter" />
|
|
22
|
+
</a>
|
|
23
|
+
</h4>
|
|
24
|
+
|
|
25
|
+
## Introduction
|
|
26
|
+
|
|
27
|
+
**[Infisical](https://infisical.com)** is the open source secret management platform that teams use to centralize their secrets like API keys, database credentials, and configurations.
|
|
28
|
+
|
|
29
|
+
If you’re working with Python, the official Infisical Python SDK package is the easiest way to fetch and work with secrets for your application. You can read the documentation [here](https://infisical.com/docs/sdks/languages/python).
|
|
30
|
+
|
|
31
|
+
## Documentation
|
|
32
|
+
You can find the documentation for the Python SDK on our [SDK documentation page](https://infisical.com/docs/sdks/languages/python).
|
|
33
|
+
|
|
34
|
+
## Security
|
|
35
|
+
|
|
36
|
+
Please do not file GitHub issues or post on our public forum for security vulnerabilities, as they are public!
|
|
37
|
+
|
|
38
|
+
Infisical takes security issues very seriously. If you have any concerns about Infisical or believe you have uncovered a vulnerability, please get in touch via the e-mail address security@infisical.com. In the message, try to provide a description of the issue and ideally a way of reproducing it. The security team will get back to you as soon as possible.
|
|
39
|
+
|
|
40
|
+
Note that this security address should be used only for undisclosed vulnerabilities. Please report any security problems to us before disclosing it publicly.
|
|
@@ -194,3 +194,102 @@ class KmsKeyEncryptDataResponse(BaseModel):
|
|
|
194
194
|
class KmsKeyDecryptDataResponse(BaseModel):
|
|
195
195
|
"""Response model for decrypt data API"""
|
|
196
196
|
plaintext: str
|
|
197
|
+
|
|
198
|
+
@dataclass
|
|
199
|
+
class CreateFolderResponseItem(BaseModel):
|
|
200
|
+
"""Folder model with path for create response"""
|
|
201
|
+
id: str
|
|
202
|
+
name: str
|
|
203
|
+
createdAt: str
|
|
204
|
+
updatedAt: str
|
|
205
|
+
envId: str
|
|
206
|
+
path: str
|
|
207
|
+
version: Optional[int] = 1
|
|
208
|
+
parentId: Optional[str] = None
|
|
209
|
+
isReserved: Optional[bool] = False
|
|
210
|
+
description: Optional[str] = None
|
|
211
|
+
lastSecretModified: Optional[str] = None
|
|
212
|
+
|
|
213
|
+
@dataclass
|
|
214
|
+
class CreateFolderResponse(BaseModel):
|
|
215
|
+
"""Response model for create folder API"""
|
|
216
|
+
folder: CreateFolderResponseItem
|
|
217
|
+
|
|
218
|
+
@classmethod
|
|
219
|
+
def from_dict(cls, data: Dict) -> 'CreateFolderResponse':
|
|
220
|
+
return cls(
|
|
221
|
+
folder=CreateFolderResponseItem.from_dict(data['folder']),
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
@dataclass
|
|
226
|
+
class ListFoldersResponseItem(BaseModel):
|
|
227
|
+
"""Response model for list folders API"""
|
|
228
|
+
id: str
|
|
229
|
+
name: str
|
|
230
|
+
createdAt: str
|
|
231
|
+
updatedAt: str
|
|
232
|
+
envId: str
|
|
233
|
+
version: Optional[int] = 1
|
|
234
|
+
parentId: Optional[str] = None
|
|
235
|
+
isReserved: Optional[bool] = False
|
|
236
|
+
description: Optional[str] = None
|
|
237
|
+
lastSecretModified: Optional[str] = None
|
|
238
|
+
relativePath: Optional[str] = None
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
@dataclass
|
|
242
|
+
class ListFoldersResponse(BaseModel):
|
|
243
|
+
"""Complete response model for folders API"""
|
|
244
|
+
folders: List[ListFoldersResponseItem]
|
|
245
|
+
|
|
246
|
+
@classmethod
|
|
247
|
+
def from_dict(cls, data: Dict) -> 'ListFoldersResponse':
|
|
248
|
+
"""Create model from dictionary with camelCase keys, handling nested objects"""
|
|
249
|
+
return cls(
|
|
250
|
+
folders=[ListFoldersResponseItem.from_dict(folder) for folder in data['folders']]
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
@dataclass
|
|
255
|
+
class Environment(BaseModel):
|
|
256
|
+
"""Environment model"""
|
|
257
|
+
envId: str
|
|
258
|
+
envName: str
|
|
259
|
+
envSlug: str
|
|
260
|
+
|
|
261
|
+
@dataclass
|
|
262
|
+
class SingleFolderResponseItem(BaseModel):
|
|
263
|
+
"""Response model for get folder API"""
|
|
264
|
+
id: str
|
|
265
|
+
name: str
|
|
266
|
+
createdAt: str
|
|
267
|
+
updatedAt: str
|
|
268
|
+
envId: str
|
|
269
|
+
path: str
|
|
270
|
+
projectId: str
|
|
271
|
+
environment: Environment
|
|
272
|
+
version: Optional[int] = 1
|
|
273
|
+
parentId: Optional[str] = None
|
|
274
|
+
isReserved: Optional[bool] = False
|
|
275
|
+
description: Optional[str] = None
|
|
276
|
+
lastSecretModified: Optional[str] = None
|
|
277
|
+
|
|
278
|
+
@classmethod
|
|
279
|
+
def from_dict(cls, data: Dict) -> 'SingleFolderResponseItem':
|
|
280
|
+
"""Create model from dictionary with nested Environment"""
|
|
281
|
+
folder_data = data.copy()
|
|
282
|
+
folder_data['environment'] = Environment.from_dict(data['environment'])
|
|
283
|
+
|
|
284
|
+
return super().from_dict(folder_data)
|
|
285
|
+
|
|
286
|
+
@dataclass
|
|
287
|
+
class SingleFolderResponse(BaseModel):
|
|
288
|
+
"""Response model for get/create folder API"""
|
|
289
|
+
folder: SingleFolderResponseItem
|
|
290
|
+
|
|
291
|
+
@classmethod
|
|
292
|
+
def from_dict(cls, data: Dict) -> 'SingleFolderResponse':
|
|
293
|
+
return cls(
|
|
294
|
+
folder=SingleFolderResponseItem.from_dict(data['folder']),
|
|
295
|
+
)
|
|
@@ -3,6 +3,7 @@ from .infisical_requests import InfisicalRequests
|
|
|
3
3
|
from infisical_sdk.resources import Auth
|
|
4
4
|
from infisical_sdk.resources import V3RawSecrets
|
|
5
5
|
from infisical_sdk.resources import KMS
|
|
6
|
+
from infisical_sdk.resources import V2Folders
|
|
6
7
|
|
|
7
8
|
from infisical_sdk.util import SecretsCache
|
|
8
9
|
|
|
@@ -24,6 +25,7 @@ class InfisicalSDKClient:
|
|
|
24
25
|
self.auth = Auth(self.api, self.set_token)
|
|
25
26
|
self.secrets = V3RawSecrets(self.api, self.cache)
|
|
26
27
|
self.kms = KMS(self.api)
|
|
28
|
+
self.folders = V2Folders(self.api)
|
|
27
29
|
|
|
28
30
|
def set_token(self, token: str):
|
|
29
31
|
"""
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
from datetime import datetime, timezone
|
|
3
|
+
|
|
4
|
+
from infisical_sdk.infisical_requests import InfisicalRequests
|
|
5
|
+
from infisical_sdk.api_types import ListFoldersResponse, SingleFolderResponse, SingleFolderResponseItem, CreateFolderResponse, CreateFolderResponseItem
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class V2Folders:
|
|
9
|
+
def __init__(self, requests: InfisicalRequests) -> None:
|
|
10
|
+
self.requests = requests
|
|
11
|
+
|
|
12
|
+
def create_folder(
|
|
13
|
+
self,
|
|
14
|
+
name: str,
|
|
15
|
+
environment_slug: str,
|
|
16
|
+
project_id: str,
|
|
17
|
+
path: str = "/",
|
|
18
|
+
description: Optional[str] = None) -> CreateFolderResponseItem:
|
|
19
|
+
|
|
20
|
+
request_body = {
|
|
21
|
+
"projectId": project_id,
|
|
22
|
+
"environment": environment_slug,
|
|
23
|
+
"name": name,
|
|
24
|
+
"path": path,
|
|
25
|
+
"description": description,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
result = self.requests.post(
|
|
29
|
+
path="/api/v2/folders",
|
|
30
|
+
json=request_body,
|
|
31
|
+
model=CreateFolderResponse
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
return result.data.folder
|
|
35
|
+
|
|
36
|
+
def list_folders(
|
|
37
|
+
self,
|
|
38
|
+
project_id: str,
|
|
39
|
+
environment_slug: str,
|
|
40
|
+
path: str,
|
|
41
|
+
last_secret_modified: Optional[datetime] = None,
|
|
42
|
+
recursive: bool = False) -> ListFoldersResponse:
|
|
43
|
+
|
|
44
|
+
params = {
|
|
45
|
+
"projectId": project_id,
|
|
46
|
+
"environment": environment_slug,
|
|
47
|
+
"path": path,
|
|
48
|
+
"recursive": recursive,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if last_secret_modified is not None:
|
|
52
|
+
# Convert to UTC and format as RFC 3339 with 'Z' suffix
|
|
53
|
+
# The API expects UTC times in 'Z' format (e.g., 2023-11-07T05:31:56Z)
|
|
54
|
+
utc_datetime = last_secret_modified.astimezone(timezone.utc) if last_secret_modified.tzinfo else last_secret_modified.replace(tzinfo=timezone.utc)
|
|
55
|
+
params["lastSecretModified"] = utc_datetime.strftime('%Y-%m-%dT%H:%M:%SZ')
|
|
56
|
+
|
|
57
|
+
result = self.requests.get(
|
|
58
|
+
path="/api/v2/folders",
|
|
59
|
+
params=params,
|
|
60
|
+
model=ListFoldersResponse
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
return result.data
|
|
64
|
+
|
|
65
|
+
def get_folder_by_id(
|
|
66
|
+
self,
|
|
67
|
+
id: str) -> SingleFolderResponseItem:
|
|
68
|
+
|
|
69
|
+
result = self.requests.get(
|
|
70
|
+
path=f"/api/v2/folders/{id}",
|
|
71
|
+
model=SingleFolderResponse
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
return result.data.folder
|
|
75
|
+
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: infisicalsdk
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.12
|
|
4
4
|
Summary: Official Infisical SDK for Python (Latest)
|
|
5
5
|
Home-page: https://github.com/Infisical/python-sdk-official
|
|
6
6
|
Author: Infisical
|
|
7
7
|
Author-email: support@infisical.com
|
|
8
8
|
Keywords: Infisical,Infisical API,Infisical SDK,SDK,Secrets Management
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
10
11
|
Requires-Dist: python-dateutil
|
|
11
12
|
Requires-Dist: aenum
|
|
12
13
|
Requires-Dist: requests~=2.32
|
|
@@ -18,6 +19,7 @@ Dynamic: description
|
|
|
18
19
|
Dynamic: description-content-type
|
|
19
20
|
Dynamic: home-page
|
|
20
21
|
Dynamic: keywords
|
|
22
|
+
Dynamic: license-file
|
|
21
23
|
Dynamic: requires-dist
|
|
22
24
|
Dynamic: summary
|
|
23
25
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
LICENSE
|
|
1
2
|
README.md
|
|
2
3
|
pyproject.toml
|
|
3
4
|
setup.cfg
|
|
@@ -8,6 +9,7 @@ infisical_sdk/client.py
|
|
|
8
9
|
infisical_sdk/infisical_requests.py
|
|
9
10
|
infisical_sdk/resources/__init__.py
|
|
10
11
|
infisical_sdk/resources/auth.py
|
|
12
|
+
infisical_sdk/resources/folders.py
|
|
11
13
|
infisical_sdk/resources/kms.py
|
|
12
14
|
infisical_sdk/resources/secrets.py
|
|
13
15
|
infisical_sdk/resources/auth_methods/__init__.py
|
|
@@ -15,7 +15,7 @@ from setuptools import setup, find_packages # noqa: H301
|
|
|
15
15
|
# prerequisite: setuptools
|
|
16
16
|
# http://pypi.python.org/pypi/setuptools
|
|
17
17
|
NAME = "infisicalsdk"
|
|
18
|
-
VERSION = "1.0.
|
|
18
|
+
VERSION = "1.0.12"
|
|
19
19
|
PYTHON_REQUIRES = ">=3.8"
|
|
20
20
|
REQUIRES = [
|
|
21
21
|
"python-dateutil",
|
infisicalsdk-1.0.11/README.md
DELETED
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
# Infisical Python SDK
|
|
2
|
-
|
|
3
|
-
The Infisical SDK provides a convenient way to interact with the Infisical API.
|
|
4
|
-
|
|
5
|
-
### Migrating to version 1.0.3 or above
|
|
6
|
-
|
|
7
|
-
We have recently rolled out our first stable version of the SDK, version `1.0.3` and above.
|
|
8
|
-
|
|
9
|
-
The 1.0.3 version comes with a few key changes that may change how you're using the SDK.
|
|
10
|
-
1. **Removal of `rest`**: The SDK no longer exposes the entire Infisical API. This was nessecary as we have moved away from using an OpenAPI generator approach. We aim to add support for more API resources in the near future. If you have any specific requests, please [open an issue](https://github.com/Infisical/python-sdk-official/issues).
|
|
11
|
-
|
|
12
|
-
2. **New response types**: The 1.0.3 release uses return types that differ from the older versions. The new return types such as `BaseSecret`, are all exported from the Infisical SDK.
|
|
13
|
-
|
|
14
|
-
3. **Property renaming**: Some properties on the responses have been slightly renamed. An example of this would be that the `secret_key` property on the `get_secret_by_name()` method, that has been renamed to `secretKey`.
|
|
15
|
-
|
|
16
|
-
With this in mind, you're ready to upgrade your SDK version to `1.0.3` or above.
|
|
17
|
-
|
|
18
|
-
You can refer to our [legacy documentation](https://github.com/Infisical/python-sdk-official/tree/9b0403938ee5ae599d42c5f1fdf9158671a15606?tab=readme-ov-file#infisical-python-sdk) if need be.
|
|
19
|
-
|
|
20
|
-
## Requirements
|
|
21
|
-
|
|
22
|
-
Python 3.7+
|
|
23
|
-
|
|
24
|
-
## Installation
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
pip install infisicalsdk
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Getting Started
|
|
31
|
-
|
|
32
|
-
```python
|
|
33
|
-
from infisical_sdk import InfisicalSDKClient
|
|
34
|
-
|
|
35
|
-
# Initialize the client
|
|
36
|
-
client = InfisicalSDKClient(host="https://app.infisical.com")
|
|
37
|
-
|
|
38
|
-
# Authenticate (example using Universal Auth)
|
|
39
|
-
client.auth.universal_auth.login(
|
|
40
|
-
client_id="<machine-identity-client-id>",
|
|
41
|
-
client_secret="<machine-identity-client-secret>"
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
# Use the SDK to interact with Infisical
|
|
45
|
-
secrets = client.secrets.list_secrets(project_id="<project-id>", environment_slug="dev", secret_path="/")
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## InfisicalSDKClient Parameters
|
|
49
|
-
|
|
50
|
-
The `InfisicalSDKClient` takes the following parameters, which are used as a global configuration for the lifetime of the SDK instance.
|
|
51
|
-
|
|
52
|
-
- **host** (`str`, _Optional_): The host URL for your Infisical instance. Defaults to `https://app.infisical.com`.
|
|
53
|
-
- **token** (`str`, _Optional_): Specify an authentication token to use for all requests. If provided, you will not need to call any of the `auth` methods. Defaults to `None`
|
|
54
|
-
- **cache_ttl** (`int`, _Optional_): The SDK has built-in client-side caching for secrets, greatly improving response times. By default, secrets are cached for 1 minute (60 seconds). You can disable caching by setting `cache_ttl` to `None`, or adjust the duration in seconds as needed.
|
|
55
|
-
|
|
56
|
-
```python
|
|
57
|
-
client = InfisicalSDKClient(
|
|
58
|
-
host="https://app.infisical.com", # Defaults to https://app.infisical.com
|
|
59
|
-
token="<optional-auth-token>", # If not set, use the client.auth() methods.
|
|
60
|
-
cache_ttl = 300 # `None` to disable caching
|
|
61
|
-
)
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Core Methods
|
|
65
|
-
|
|
66
|
-
The SDK methods are organized into the following high-level categories:
|
|
67
|
-
|
|
68
|
-
1. `auth`: Handles authentication methods.
|
|
69
|
-
2. `secrets`: Manages CRUD operations for secrets.
|
|
70
|
-
3. `kms`: Perform cryptographic operations with Infisical KMS.
|
|
71
|
-
|
|
72
|
-
### `auth`
|
|
73
|
-
|
|
74
|
-
The `Auth` component provides methods for authentication:
|
|
75
|
-
|
|
76
|
-
#### Universal Auth
|
|
77
|
-
|
|
78
|
-
```python
|
|
79
|
-
response = client.auth.universal_auth.login(
|
|
80
|
-
client_id="<machine-identity-client-id>",
|
|
81
|
-
client_secret="<machine-identity-client-secret>"
|
|
82
|
-
)
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
#### AWS Auth
|
|
86
|
-
|
|
87
|
-
```python
|
|
88
|
-
response = client.auth.aws_auth.login(identity_id="<machine-identity-id>")
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### `secrets`
|
|
92
|
-
|
|
93
|
-
This sub-class handles operations related to secrets:
|
|
94
|
-
|
|
95
|
-
#### List Secrets
|
|
96
|
-
|
|
97
|
-
```python
|
|
98
|
-
secrets = client.secrets.list_secrets(
|
|
99
|
-
project_id="<project-id>",
|
|
100
|
-
environment_slug="dev",
|
|
101
|
-
secret_path="/",
|
|
102
|
-
expand_secret_references=True, # Optional
|
|
103
|
-
view_secret_value=True, # Optional
|
|
104
|
-
recursive=False, # Optional
|
|
105
|
-
include_imports=True, # Optional
|
|
106
|
-
tag_filters=[] # Optional
|
|
107
|
-
)
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
**Parameters:**
|
|
111
|
-
- `project_id` (str): The ID of your project.
|
|
112
|
-
- `project_slug` (str): The slug of your project.
|
|
113
|
-
- `environment_slug` (str): The environment in which to list secrets (e.g., "dev").
|
|
114
|
-
- `secret_path` (str): The path to the secrets.
|
|
115
|
-
- `expand_secret_references` (bool): Whether to expand secret references.
|
|
116
|
-
- `view_secret_value` (bool): Whether or not to include the secret value in the response. If set to false, the `secretValue` will be masked with `<hidden-by-infisical>`. Defaults to true.
|
|
117
|
-
- `recursive` (bool): Whether to list secrets recursively.
|
|
118
|
-
- `include_imports` (bool): Whether to include imported secrets.
|
|
119
|
-
- `tag_filters` (List[str]): Tags to filter secrets.
|
|
120
|
-
|
|
121
|
-
**Note:** Exactly one of `project_id` or `project_slug` is required. If both are provided, `project_id` takes precedence.
|
|
122
|
-
|
|
123
|
-
**Returns:**
|
|
124
|
-
- `ListSecretsResponse`: The response containing the list of secrets.
|
|
125
|
-
|
|
126
|
-
#### Create Secret
|
|
127
|
-
|
|
128
|
-
```python
|
|
129
|
-
new_secret = client.secrets.create_secret_by_name(
|
|
130
|
-
secret_name="NEW_SECRET",
|
|
131
|
-
project_id="<project-id>",
|
|
132
|
-
secret_path="/",
|
|
133
|
-
environment_slug="dev",
|
|
134
|
-
secret_value="secret_value",
|
|
135
|
-
secret_comment="Optional comment",
|
|
136
|
-
skip_multiline_encoding=False,
|
|
137
|
-
secret_reminder_repeat_days=30, # Optional
|
|
138
|
-
secret_reminder_note="Remember to update this secret" # Optional
|
|
139
|
-
secret_metadata=[{"key": "metadata_key", "value": "metadata_value"}], # Optional
|
|
140
|
-
tags_ids=["tag_id_1", "tag_id_2"] # Optional
|
|
141
|
-
)
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
**Parameters:**
|
|
145
|
-
- `secret_name` (str): The name of the secret.
|
|
146
|
-
- `project_id` (str): The ID of your project.
|
|
147
|
-
- `project_slug` (str): The slug of your project.
|
|
148
|
-
- `secret_path` (str): The path to the secret.
|
|
149
|
-
- `environment_slug` (str): The environment in which to create the secret.
|
|
150
|
-
- `secret_value` (str): The value of the secret.
|
|
151
|
-
- `secret_comment` (str, optional): A comment associated with the secret.
|
|
152
|
-
- `skip_multiline_encoding` (bool, optional): Whether to skip encoding for multiline secrets.
|
|
153
|
-
- `secret_reminder_repeat_days` (Union[float, int], optional): Number of days after which to repeat secret reminders.
|
|
154
|
-
- `secret_reminder_note` (str, optional): A note for the secret reminder.
|
|
155
|
-
- `secret_metadata` (List[Dict[str, Any]], optional): Metadata associated with the secret.
|
|
156
|
-
- `tags_ids` (List[str], optional): IDs of tags to associate with the secret.
|
|
157
|
-
|
|
158
|
-
**Note:** Exactly one of `project_id` or `project_slug` is required. If both are provided, `project_id` takes precedence.
|
|
159
|
-
|
|
160
|
-
**Returns:**
|
|
161
|
-
- `BaseSecret`: The response after creating the secret.
|
|
162
|
-
|
|
163
|
-
#### Update Secret
|
|
164
|
-
|
|
165
|
-
```python
|
|
166
|
-
updated_secret = client.secrets.update_secret_by_name(
|
|
167
|
-
current_secret_name="EXISTING_SECRET",
|
|
168
|
-
project_id="<project-id>",
|
|
169
|
-
project_slug="<project-slug>",
|
|
170
|
-
secret_path="/",
|
|
171
|
-
environment_slug="dev",
|
|
172
|
-
secret_value="new_secret_value",
|
|
173
|
-
secret_comment="Updated comment", # Optional
|
|
174
|
-
skip_multiline_encoding=False,
|
|
175
|
-
secret_reminder_repeat_days=30, # Optional
|
|
176
|
-
secret_reminder_note="Updated reminder note", # Optional
|
|
177
|
-
new_secret_name="NEW_NAME" # Optional
|
|
178
|
-
secret_metadata=[{"key": "metadata_key", "value": "metadata_value"}], # Optional
|
|
179
|
-
tags_ids=["tag_id_1", "tag_id_2"] # Optional
|
|
180
|
-
)
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
**Parameters:**
|
|
184
|
-
- `current_secret_name` (str): The current name of the secret.
|
|
185
|
-
- `project_id` (str): The ID of your project.
|
|
186
|
-
- `project_slug` (str): The slug of your project.
|
|
187
|
-
- `secret_path` (str): The path to the secret.
|
|
188
|
-
- `environment_slug` (str): The environment in which to update the secret.
|
|
189
|
-
- `secret_value` (str, optional): The new value of the secret.
|
|
190
|
-
- `secret_comment` (str, optional): An updated comment associated with the secret.
|
|
191
|
-
- `skip_multiline_encoding` (bool, optional): Whether to skip encoding for multiline secrets.
|
|
192
|
-
- `secret_reminder_repeat_days` (Union[float, int], optional): Updated number of days after which to repeat secret reminders.
|
|
193
|
-
- `secret_reminder_note` (str, optional): An updated note for the secret reminder.
|
|
194
|
-
- `new_secret_name` (str, optional): A new name for the secret.
|
|
195
|
-
- `secret_metadata` (List[Dict[str, Any]], optional): Metadata associated with the secret.
|
|
196
|
-
- `tags_ids` (List[str], optional): IDs of tags to associate with the secret.
|
|
197
|
-
|
|
198
|
-
**Note:** Exactly one of `project_id` or `project_slug` is required. If both are provided, `project_id` takes precedence.
|
|
199
|
-
|
|
200
|
-
**Returns:**
|
|
201
|
-
- `BaseSecret`: The response after updating the secret.
|
|
202
|
-
|
|
203
|
-
#### Get Secret by Name
|
|
204
|
-
|
|
205
|
-
```python
|
|
206
|
-
secret = client.secrets.get_secret_by_name(
|
|
207
|
-
secret_name="EXISTING_SECRET",
|
|
208
|
-
project_id="<project-id>",
|
|
209
|
-
environment_slug="dev",
|
|
210
|
-
secret_path="/",
|
|
211
|
-
expand_secret_references=True, # Optional
|
|
212
|
-
view_secret_value=True, # Optional
|
|
213
|
-
include_imports=True, # Optional
|
|
214
|
-
version=None # Optional
|
|
215
|
-
)
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
**Parameters:**
|
|
219
|
-
- `secret_name` (str): The name of the secret.
|
|
220
|
-
- `project_id` (str): The ID of your project.
|
|
221
|
-
- `project_slug` (str): The slug of your project.
|
|
222
|
-
- `environment_slug` (str): The environment in which to retrieve the secret.
|
|
223
|
-
- `secret_path` (str): The path to the secret.
|
|
224
|
-
- `expand_secret_references` (bool): Whether to expand secret references.
|
|
225
|
-
- `view_secret_value` (bool): Whether or not to include the secret value in the response. If set to false, the `secretValue` will be masked with `<hidden-by-infisical>`. Defaults to true.
|
|
226
|
-
- `include_imports` (bool): Whether to include imported secrets.
|
|
227
|
-
- `version` (str, optional): The version of the secret to retrieve. Fetches the latest by default.
|
|
228
|
-
|
|
229
|
-
**Note:** Exactly one of `project_id` or `project_slug` is required. If both are provided, `project_id` takes precedence.
|
|
230
|
-
|
|
231
|
-
**Returns:**
|
|
232
|
-
- `BaseSecret`: The response containing the secret.
|
|
233
|
-
|
|
234
|
-
#### Delete Secret by Name
|
|
235
|
-
|
|
236
|
-
```python
|
|
237
|
-
deleted_secret = client.secrets.delete_secret_by_name(
|
|
238
|
-
secret_name="EXISTING_SECRET",
|
|
239
|
-
project_id="<project-id>",
|
|
240
|
-
environment_slug="dev",
|
|
241
|
-
secret_path="/"
|
|
242
|
-
)
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
**Parameters:**
|
|
246
|
-
- `secret_name` (str): The name of the secret to delete.
|
|
247
|
-
- `project_id` (str): The ID of your project.
|
|
248
|
-
- `project_slug` (str): The slug of your project.
|
|
249
|
-
- `environment_slug` (str): The environment in which to delete the secret.
|
|
250
|
-
- `secret_path` (str): The path to the secret.
|
|
251
|
-
|
|
252
|
-
**Note:** Exactly one of `project_id` or `project_slug` is required. If both are provided, `project_id` takes precedence.
|
|
253
|
-
|
|
254
|
-
**Returns:**
|
|
255
|
-
- `BaseSecret`: The response after deleting the secret.
|
|
256
|
-
|
|
257
|
-
### `kms`
|
|
258
|
-
|
|
259
|
-
This sub-class handles KMS related operations:
|
|
260
|
-
|
|
261
|
-
#### List KMS Keys
|
|
262
|
-
|
|
263
|
-
```python
|
|
264
|
-
kms_keys = client.kms.list_keys(
|
|
265
|
-
project_id="<project-id>",
|
|
266
|
-
offset=0, # Optional
|
|
267
|
-
limit=100, # Optional
|
|
268
|
-
order_by=KmsKeysOrderBy.NAME, # Optional
|
|
269
|
-
order_direction=OrderDirection.ASC, # Optional
|
|
270
|
-
search=None # Optional
|
|
271
|
-
)
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
**Parameters:**
|
|
275
|
-
- `project_id` (str): The ID of your project.
|
|
276
|
-
- `offset` (int, optional): The offset to paginate from.
|
|
277
|
-
- `limit` (int, optional): The page size for paginating.
|
|
278
|
-
- `order_by` (KmsKeysOrderBy, optional): The key property to order the list response by.
|
|
279
|
-
- `order_direction` (OrderDirection, optional): The direction to order the list response in.
|
|
280
|
-
- `search` (str, optional): The text value to filter key names by.
|
|
281
|
-
|
|
282
|
-
**Returns:**
|
|
283
|
-
- `ListKmsKeysResponse`: The response containing the list of KMS keys.
|
|
284
|
-
|
|
285
|
-
#### Get KMS Key by ID
|
|
286
|
-
|
|
287
|
-
```python
|
|
288
|
-
kms_key = client.kms.get_key_by_id(
|
|
289
|
-
key_id="<key-id>"
|
|
290
|
-
)
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
**Parameters:**
|
|
294
|
-
- `key_id` (str): The ID of the key to retrieve.
|
|
295
|
-
|
|
296
|
-
**Returns:**
|
|
297
|
-
- `KmsKey`: The specified key.
|
|
298
|
-
|
|
299
|
-
#### Get KMS Key by Name
|
|
300
|
-
|
|
301
|
-
```python
|
|
302
|
-
kms_key = client.kms.get_key_by_name(
|
|
303
|
-
key_name="my-key",
|
|
304
|
-
project_id="<project-id>"
|
|
305
|
-
)
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
**Parameters:**
|
|
309
|
-
- `key_name` (str): The name of the key to retrieve.
|
|
310
|
-
- `project_id` (str): The ID of your project.
|
|
311
|
-
|
|
312
|
-
**Returns:**
|
|
313
|
-
- `KmsKey`: The specified key.
|
|
314
|
-
|
|
315
|
-
#### Create KMS Key
|
|
316
|
-
|
|
317
|
-
```python
|
|
318
|
-
kms_key = client.kms.create_key(
|
|
319
|
-
name="my-key",
|
|
320
|
-
project_id="<project-id>",
|
|
321
|
-
encryption_algorithm=SymmetricEncryption.AES_GCM_256,
|
|
322
|
-
description=None # Optional
|
|
323
|
-
)
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
**Parameters:**
|
|
327
|
-
- `name` (str): The name of the key (must be slug-friendly).
|
|
328
|
-
- `project_id` (str): The ID of your project.
|
|
329
|
-
- `encryption_algorithm` (SymmetricEncryption): The encryption alogrithm this key should use.
|
|
330
|
-
- `description` (str, optional): A description of your key.
|
|
331
|
-
|
|
332
|
-
**Returns:**
|
|
333
|
-
- `KmsKey`: The newly created key.
|
|
334
|
-
|
|
335
|
-
#### Update KMS Key
|
|
336
|
-
|
|
337
|
-
```python
|
|
338
|
-
updated_key = client.kms.update_key(
|
|
339
|
-
key_id="<key-id>",
|
|
340
|
-
name="my-updated-key", # Optional
|
|
341
|
-
description="Updated description", # Optional
|
|
342
|
-
is_disabled=True # Optional
|
|
343
|
-
)
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
**Parameters:**
|
|
347
|
-
- `key_id` (str): The ID of the key to be updated.
|
|
348
|
-
- `name` (str, optional): The updated name of the key (must be slug-friendly).
|
|
349
|
-
- `description` (str): The updated description of the key.
|
|
350
|
-
- `is_disabled` (str): The flag to disable operations with this key.
|
|
351
|
-
|
|
352
|
-
**Returns:**
|
|
353
|
-
- `KmsKey`: The updated key.
|
|
354
|
-
|
|
355
|
-
#### Delete KMS Key
|
|
356
|
-
|
|
357
|
-
```python
|
|
358
|
-
deleted_key = client.kms.delete_key(
|
|
359
|
-
key_id="<key-id>"
|
|
360
|
-
)
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
**Parameters:**
|
|
364
|
-
- `key_id` (str): The ID of the key to be deleted.
|
|
365
|
-
|
|
366
|
-
**Returns:**
|
|
367
|
-
- `KmsKey`: The deleted key.
|
|
368
|
-
|
|
369
|
-
#### Encrypt Data with KMS Key
|
|
370
|
-
|
|
371
|
-
```python
|
|
372
|
-
encrypted_data = client.kms.encrypt_data(
|
|
373
|
-
key_id="<key-id>",
|
|
374
|
-
base64EncodedPlaintext="TXkgc2VjcmV0IG1lc3NhZ2U=" # must be base64 encoded
|
|
375
|
-
)
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
**Parameters:**
|
|
379
|
-
- `key_id` (str): The ID of the key to encrypt the data with.
|
|
380
|
-
- `base64EncodedPlaintext` (str): The plaintext data to encrypt (must be base64 encoded).
|
|
381
|
-
|
|
382
|
-
**Returns:**
|
|
383
|
-
- `str`: The encrypted ciphertext.
|
|
384
|
-
|
|
385
|
-
#### Decrypte Data with KMS Key
|
|
386
|
-
|
|
387
|
-
```python
|
|
388
|
-
decrypted_data = client.kms.decrypt_data(
|
|
389
|
-
key_id="<key-id>",
|
|
390
|
-
ciphertext="Aq96Ry7sMH3k/ogaIB5MiSfH+LblQRBu69lcJe0GfIvI48ZvbWY+9JulyoQYdjAx"
|
|
391
|
-
)
|
|
392
|
-
```
|
|
393
|
-
|
|
394
|
-
**Parameters:**
|
|
395
|
-
- `key_id` (str): The ID of the key to decrypt the data with.
|
|
396
|
-
- `ciphertext` (str): The ciphertext returned from the encrypt operation.
|
|
397
|
-
|
|
398
|
-
**Returns:**
|
|
399
|
-
- `str`: The base64 encoded plaintext.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisical_sdk/resources/auth_methods/__init__.py
RENAMED
|
File without changes
|
{infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisical_sdk/resources/auth_methods/aws_auth.py
RENAMED
|
File without changes
|
{infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisical_sdk/resources/auth_methods/oidc_auth.py
RENAMED
|
File without changes
|
{infisicalsdk-1.0.11 → infisicalsdk-1.0.12}/infisical_sdk/resources/auth_methods/universal_auth.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|