aembit-edge-sdk 1.35.0__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.
Files changed (90) hide show
  1. aembit_edge_sdk-1.35.0/.gitignore +14 -0
  2. aembit_edge_sdk-1.35.0/AGENTS.md +147 -0
  3. aembit_edge_sdk-1.35.0/LICENSE +190 -0
  4. aembit_edge_sdk-1.35.0/PKG-INFO +160 -0
  5. aembit_edge_sdk-1.35.0/README.md +129 -0
  6. aembit_edge_sdk-1.35.0/architecture.md +123 -0
  7. aembit_edge_sdk-1.35.0/examples/README.md +95 -0
  8. aembit_edge_sdk-1.35.0/examples/aws_imds/README.md +130 -0
  9. aembit_edge_sdk-1.35.0/examples/aws_imds/main.py +128 -0
  10. aembit_edge_sdk-1.35.0/examples/aws_role/README.md +135 -0
  11. aembit_edge_sdk-1.35.0/examples/aws_role/main.py +144 -0
  12. aembit_edge_sdk-1.35.0/examples/azure_function_entra_oidc/README.md +149 -0
  13. aembit_edge_sdk-1.35.0/examples/azure_function_entra_oidc/function_app.py +190 -0
  14. aembit_edge_sdk-1.35.0/examples/azure_function_entra_oidc/host.json +3 -0
  15. aembit_edge_sdk-1.35.0/examples/azure_function_entra_oidc/requirements.txt +3 -0
  16. aembit_edge_sdk-1.35.0/examples/azure_imds/README.md +129 -0
  17. aembit_edge_sdk-1.35.0/examples/azure_imds/main.py +109 -0
  18. aembit_edge_sdk-1.35.0/examples/gcp_identity_token_function/README.md +151 -0
  19. aembit_edge_sdk-1.35.0/examples/gcp_identity_token_function/main.py +159 -0
  20. aembit_edge_sdk-1.35.0/examples/gcp_identity_token_function/requirements.txt +2 -0
  21. aembit_edge_sdk-1.35.0/examples/github_actions/README.md +178 -0
  22. aembit_edge_sdk-1.35.0/examples/github_actions/main.py +169 -0
  23. aembit_edge_sdk-1.35.0/examples/gitlab_ci/README.md +180 -0
  24. aembit_edge_sdk-1.35.0/examples/gitlab_ci/main.py +143 -0
  25. aembit_edge_sdk-1.35.0/examples/kubernetes_service_account/README.md +143 -0
  26. aembit_edge_sdk-1.35.0/examples/kubernetes_service_account/main.py +146 -0
  27. aembit_edge_sdk-1.35.0/examples/logging_integration/README.md +81 -0
  28. aembit_edge_sdk-1.35.0/examples/logging_integration/loguru_example.py +75 -0
  29. aembit_edge_sdk-1.35.0/examples/logging_integration/standard_logging_example.py +62 -0
  30. aembit_edge_sdk-1.35.0/examples/multi_credential_aws_sts/README.md +89 -0
  31. aembit_edge_sdk-1.35.0/examples/multi_credential_aws_sts/main.py +125 -0
  32. aembit_edge_sdk-1.35.0/examples/oidc_symmetric/README.md +122 -0
  33. aembit_edge_sdk-1.35.0/examples/oidc_symmetric/main.py +164 -0
  34. aembit_edge_sdk-1.35.0/examples/oidc_vercel_function/README.md +150 -0
  35. aembit_edge_sdk-1.35.0/examples/oidc_vercel_function/api/index.py +131 -0
  36. aembit_edge_sdk-1.35.0/examples/oidc_vercel_function/requirements.txt +1 -0
  37. aembit_edge_sdk-1.35.0/examples/terraform_cloud/README.md +128 -0
  38. aembit_edge_sdk-1.35.0/examples/terraform_cloud/main.py +123 -0
  39. aembit_edge_sdk-1.35.0/pyproject.toml +105 -0
  40. aembit_edge_sdk-1.35.0/src/aembit_edge/__init__.py +75 -0
  41. aembit_edge_sdk-1.35.0/src/aembit_edge/auth.py +13 -0
  42. aembit_edge_sdk-1.35.0/src/aembit_edge/client.py +665 -0
  43. aembit_edge_sdk-1.35.0/src/aembit_edge/config.py +22 -0
  44. aembit_edge_sdk-1.35.0/src/aembit_edge/credentials.py +63 -0
  45. aembit_edge_sdk-1.35.0/src/aembit_edge/errors.py +138 -0
  46. aembit_edge_sdk-1.35.0/src/aembit_edge/internal/__init__.py +3 -0
  47. aembit_edge_sdk-1.35.0/src/aembit_edge/internal/client/__init__.py +3 -0
  48. aembit_edge_sdk-1.35.0/src/aembit_edge/internal/client/auth_parsing.py +65 -0
  49. aembit_edge_sdk-1.35.0/src/aembit_edge/internal/client/credential_parsing.py +76 -0
  50. aembit_edge_sdk-1.35.0/src/aembit_edge/internal/client/token_state.py +119 -0
  51. aembit_edge_sdk-1.35.0/src/aembit_edge/internal/protocol/__init__.py +14 -0
  52. aembit_edge_sdk-1.35.0/src/aembit_edge/internal/protocol/edge_api.py +105 -0
  53. aembit_edge_sdk-1.35.0/src/aembit_edge/internal/protocol/errors.py +124 -0
  54. aembit_edge_sdk-1.35.0/src/aembit_edge/internal/protocol/http_transport.py +261 -0
  55. aembit_edge_sdk-1.35.0/src/aembit_edge/internal/protocol/retry.py +27 -0
  56. aembit_edge_sdk-1.35.0/src/aembit_edge/internal/protocol/types.py +116 -0
  57. aembit_edge_sdk-1.35.0/src/aembit_edge/internal/retry.py +249 -0
  58. aembit_edge_sdk-1.35.0/src/aembit_edge/internal/shared.py +19 -0
  59. aembit_edge_sdk-1.35.0/src/aembit_edge/internal/trust_providers/__init__.py +15 -0
  60. aembit_edge_sdk-1.35.0/src/aembit_edge/internal/trust_providers/aws_role.py +157 -0
  61. aembit_edge_sdk-1.35.0/src/aembit_edge/py.typed +1 -0
  62. aembit_edge_sdk-1.35.0/src/aembit_edge/retry.py +16 -0
  63. aembit_edge_sdk-1.35.0/src/aembit_edge/trust_providers/__init__.py +39 -0
  64. aembit_edge_sdk-1.35.0/src/aembit_edge/trust_providers/aws_metadata_service.py +146 -0
  65. aembit_edge_sdk-1.35.0/src/aembit_edge/trust_providers/aws_role.py +183 -0
  66. aembit_edge_sdk-1.35.0/src/aembit_edge/trust_providers/azure_metadata_service.py +180 -0
  67. aembit_edge_sdk-1.35.0/src/aembit_edge/trust_providers/base.py +60 -0
  68. aembit_edge_sdk-1.35.0/src/aembit_edge/trust_providers/gcp_identity_token.py +59 -0
  69. aembit_edge_sdk-1.35.0/src/aembit_edge/trust_providers/kubernetes_service_account.py +83 -0
  70. aembit_edge_sdk-1.35.0/src/aembit_edge/trust_providers/oidc_id_token.py +59 -0
  71. aembit_edge_sdk-1.35.0/src/aembit_edge/trust_providers/oidc_providers.py +159 -0
  72. aembit_edge_sdk-1.35.0/src/aembit_edge/types.py +33 -0
  73. aembit_edge_sdk-1.35.0/tests/test_edge_client.py +1250 -0
  74. aembit_edge_sdk-1.35.0/tests/test_internal_aws_role_signer.py +133 -0
  75. aembit_edge_sdk-1.35.0/tests/test_internal_http_transport.py +78 -0
  76. aembit_edge_sdk-1.35.0/tests/test_internal_parsing.py +110 -0
  77. aembit_edge_sdk-1.35.0/tests/test_internal_protocol_errors.py +48 -0
  78. aembit_edge_sdk-1.35.0/tests/test_internal_retry.py +70 -0
  79. aembit_edge_sdk-1.35.0/tests/test_internal_token_state.py +75 -0
  80. aembit_edge_sdk-1.35.0/tests/test_license.py +81 -0
  81. aembit_edge_sdk-1.35.0/tests/test_logging.py +235 -0
  82. aembit_edge_sdk-1.35.0/tests/test_public_api.py +206 -0
  83. aembit_edge_sdk-1.35.0/tests/test_scaffold.py +8 -0
  84. aembit_edge_sdk-1.35.0/tests/test_trust_provider_aws_metadata_service.py +226 -0
  85. aembit_edge_sdk-1.35.0/tests/test_trust_provider_aws_role.py +319 -0
  86. aembit_edge_sdk-1.35.0/tests/test_trust_provider_azure_metadata_service.py +172 -0
  87. aembit_edge_sdk-1.35.0/tests/test_trust_provider_gcp_identity_token.py +67 -0
  88. aembit_edge_sdk-1.35.0/tests/test_trust_provider_kubernetes_service_account.py +126 -0
  89. aembit_edge_sdk-1.35.0/tests/test_trust_provider_oidc.py +218 -0
  90. aembit_edge_sdk-1.35.0/tests/test_trust_provider_oidc_id_token.py +67 -0
@@ -0,0 +1,14 @@
1
+ .venv/
2
+ .pkg-venv/
3
+ __pycache__/
4
+ .mypy_cache/
5
+ .pytest_cache/
6
+ .ruff_cache/
7
+ dist/
8
+ build/
9
+ *.egg-info/
10
+ .coverage
11
+ coverage.xml
12
+ mutants/
13
+ .mutmut-cache/
14
+ .mutmut-cache
@@ -0,0 +1,147 @@
1
+ # Python SDK Agent Guide
2
+
3
+ Language-specific guidance for contributors and coding agents working in `py/`.
4
+
5
+ This file augments the root `AGENTS.md`. Follow both files. If guidance conflicts, the root `AGENTS.md` takes precedence unless this file is stricter for Python-specific behavior.
6
+
7
+ ## Purpose
8
+
9
+ The Python SDK should follow the conceptual design established by the TypeScript SDK while feeling idiomatic for modern Python.
10
+
11
+ Changes in `py/` should prioritize:
12
+
13
+ - clear and ergonomic developer APIs
14
+ - predictable authentication and token lifecycle behavior
15
+ - portability of concepts from the TypeScript reference implementation
16
+ - compatibility with Python `>=3.10`
17
+
18
+ ## Scope
19
+
20
+ This guide applies to files under `py/`, including:
21
+
22
+ - SDK source code
23
+ - Python tests
24
+ - Python examples
25
+ - Python documentation
26
+ - Python packaging and tooling configuration
27
+
28
+ ## Directory Conventions
29
+
30
+ Keep Python assets inside `py/` and avoid cross-language coupling.
31
+
32
+ Recommended structure for Python work:
33
+
34
+ - `py/src/aembit_edge/` for SDK implementation
35
+ - `py/tests/` for tests
36
+ - `py/examples/` for runnable examples
37
+ - `py/README.md` for Python SDK usage docs
38
+ - `py/architecture.md` for Python SDK architecture notes
39
+
40
+ If the structure changes, keep naming and placement consistent within `py/`.
41
+
42
+ ## API Design Rules
43
+
44
+ Python should expose a high-level client-first interface.
45
+
46
+ - Primary entry points should hide raw protocol details.
47
+ - Public methods should map to developer tasks such as `authenticate()` and `get_credential()`.
48
+ - Public APIs should use Python naming conventions such as `snake_case`.
49
+ - Public configuration should use `Trust Provider` terminology.
50
+ - Use official Aembit Edge API terminology from `https://docs.aembit.io/api-guide/edge/`; avoid alternate API names in docs/comments.
51
+ - Keep advanced options optional and well-scoped.
52
+ - Preserve credential response data without forcing a rigid credential schema.
53
+
54
+ Planned public entry points:
55
+
56
+ - `EdgeClient`
57
+ - `AsyncEdgeClient`
58
+
59
+ ## Python Standards
60
+
61
+ - Support Python `>=3.10`.
62
+ - Use full type hints in public and internal code.
63
+ - Prefer `Protocol`, `TypedDict`, `dataclass`, and small focused classes where they improve clarity.
64
+ - Keep public types intentionally minimal and stable.
65
+ - Avoid unnecessary metaprogramming.
66
+ - Prefer standard-library features unless a dependency materially improves reliability or maintainability.
67
+ - Keep docstrings concise and focused on behavior-affecting details.
68
+
69
+ ## Sync And Async Design
70
+
71
+ The SDK is expected to support both synchronous and asynchronous usage.
72
+
73
+ - Keep shared logic in reusable core modules where possible.
74
+ - Keep sync and async transport/client behavior aligned.
75
+ - Do not force async-only or sync-only design assumptions into shared types or architecture.
76
+ - When one path lands before the other, keep the code structure ready for parity.
77
+
78
+ ## Error Handling
79
+
80
+ Errors should be actionable and consistent.
81
+
82
+ - Normalize transport and API errors into SDK-defined exception types.
83
+ - Include structured metadata when available, such as HTTP status and API error code.
84
+ - Preserve root causes with exception chaining.
85
+ - Avoid leaking raw low-level error shapes through public interfaces.
86
+
87
+ ## Auth And Token Lifecycle
88
+
89
+ Authentication behavior should be predictable and safe under concurrency.
90
+
91
+ - Cache bearer tokens with clear expiration handling.
92
+ - Refresh tokens before hard expiry using a small safety window.
93
+ - Prevent duplicate concurrent refreshes for the same client instance.
94
+ - Handle auth failures explicitly and clear invalid cached state.
95
+
96
+ ## Testing Requirements
97
+
98
+ Python SDK changes should include tests when behavior changes.
99
+
100
+ Testing and quality tools:
101
+
102
+ - use `pytest`
103
+ - use `ruff` for linting and formatting
104
+ - use `pyright` as the primary static type checker
105
+ - use `uv` for local environment and dependency management
106
+
107
+ Focus tests on:
108
+
109
+ - request construction and serialization
110
+ - authentication flow behavior
111
+ - token caching and refresh logic
112
+ - error mapping and propagation
113
+ - credential retrieval behavior with varied payload shapes
114
+
115
+ Prefer deterministic tests with mocked network behavior and controlled time for token-expiry logic.
116
+
117
+ ## Documentation And Examples
118
+
119
+ When public Python SDK behavior changes:
120
+
121
+ - update `py/README.md`
122
+ - update or add `py/examples/` usage snippets
123
+ - keep examples runnable and minimal
124
+ - use placeholder values only
125
+
126
+ Examples are part of product quality, not optional extras.
127
+
128
+ ## Dependency Policy
129
+
130
+ - Avoid adding dependencies unless they materially improve reliability, maintainability, or developer experience.
131
+ - Prefer small, well-maintained libraries over broad frameworks.
132
+ - Do not add dependencies for trivial utilities that can be implemented clearly in SDK code.
133
+ - When adding dependencies, consider Python `>=3.10` compatibility and static typing support.
134
+
135
+ ## Review Checklist For Agents
136
+
137
+ Before handing work back to the user:
138
+
139
+ - run `uv run ruff check .` for Python file changes and confirm it passes
140
+ - run `uv run ruff format --check .`
141
+ - run `uv run pyright`
142
+ - run `uv run pytest`
143
+ - run `uv build --wheel --sdist` when Python packaging or build configuration changes
144
+ - ensure API and README changes are aligned
145
+ - verify examples still reflect recommended usage
146
+ - verify no secrets or production identifiers are present
147
+ - present diffs and do not commit unless explicitly requested
@@ -0,0 +1,190 @@
1
+ Copyright 2024-present Aembit, Inc.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+
15
+ Apache License
16
+ Version 2.0, January 2004
17
+ http://www.apache.org/licenses/
18
+
19
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
20
+
21
+ 1. Definitions.
22
+
23
+ "License" shall mean the terms and conditions for use, reproduction,
24
+ and distribution as defined by Sections 1 through 9 of this document.
25
+
26
+ "Licensor" shall mean the copyright owner or entity authorized by
27
+ the copyright owner that is granting the License.
28
+
29
+ "Legal Entity" shall mean the union of the acting entity and all
30
+ other entities that control, are controlled by, or are under common
31
+ control with that entity. For the purposes of this definition,
32
+ "control" means (i) the power, direct or indirect, to cause the
33
+ direction or management of such entity, whether by contract or
34
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
35
+ outstanding shares, or (iii) beneficial ownership of such entity.
36
+
37
+ "You" (or "Your") shall mean an individual or Legal Entity
38
+ exercising permissions granted by this License.
39
+
40
+ "Source" form shall mean the preferred form for making modifications,
41
+ including but not limited to software source code, documentation
42
+ source, and configuration files.
43
+
44
+ "Object" form shall mean any form resulting from mechanical
45
+ transformation or translation of a Source form, including but
46
+ not limited to compiled object code, generated documentation,
47
+ and conversions to other media types.
48
+
49
+ "Work" shall mean the work of authorship, whether in Source or
50
+ Object form, made available under the License, as indicated by a
51
+ copyright notice that is included in or attached to the work
52
+ (an example is provided in the Appendix below).
53
+
54
+ "Derivative Works" shall mean any work, whether in Source or Object
55
+ form, that is based on (or derived from) the Work and for which the
56
+ editorial revisions, annotations, elaborations, or other modifications
57
+ represent, as a whole, an original work of authorship. For the purposes
58
+ of this License, Derivative Works shall not include works that remain
59
+ separable from, or merely link (or bind by name) to the interfaces of,
60
+ the Work and Derivative Works thereof.
61
+
62
+ "Contribution" shall mean any work of authorship, including
63
+ the original version of the Work and any modifications or additions
64
+ to that Work or Derivative Works thereof, that is intentionally
65
+ submitted to Licensor for inclusion in the Work by the copyright owner
66
+ or by an individual or Legal Entity authorized to submit on behalf of
67
+ the copyright owner. For the purposes of this definition, "submitted"
68
+ means any form of electronic, verbal, or written communication sent
69
+ to the Licensor or its representatives, including but not limited to
70
+ communication on electronic mailing lists, source code control systems,
71
+ and issue tracking systems that are managed by, or on behalf of, the
72
+ Licensor for the purpose of discussing and improving the Work, but
73
+ excluding communication that is conspicuously marked or otherwise
74
+ designated in writing by the copyright owner as "Not a Contribution."
75
+
76
+ "Contributor" shall mean Licensor and any individual or Legal Entity
77
+ on behalf of whom a Contribution has been received by Licensor and
78
+ subsequently incorporated within the Work.
79
+
80
+ 2. Grant of Copyright License. Subject to the terms and conditions of
81
+ this License, each Contributor hereby grants to You a perpetual,
82
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
83
+ copyright license to reproduce, prepare Derivative Works of,
84
+ publicly display, publicly perform, sublicense, and distribute the
85
+ Work and such Derivative Works in Source or Object form.
86
+
87
+ 3. Grant of Patent License. Subject to the terms and conditions of
88
+ this License, each Contributor hereby grants to You a perpetual,
89
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
90
+ (except as stated in this section) patent license to make, have made,
91
+ use, offer to sell, sell, import, and otherwise transfer the Work,
92
+ where such license applies only to those patent claims licensable
93
+ by such Contributor that are necessarily infringed by their
94
+ Contribution(s) alone or by combination of their Contribution(s)
95
+ with the Work to which such Contribution(s) was submitted. If You
96
+ institute patent litigation against any entity (including a
97
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
98
+ or a Contribution incorporated within the Work constitutes direct
99
+ or contributory patent infringement, then any patent licenses
100
+ granted to You under this License for that Work shall terminate
101
+ as of the date such litigation is filed.
102
+
103
+ 4. Redistribution. You may reproduce and distribute copies of the
104
+ Work or Derivative Works thereof in any medium, with or without
105
+ modifications, and in Source or Object form, provided that You
106
+ meet the following conditions:
107
+
108
+ (a) You must give any other recipients of the Work or
109
+ Derivative Works a copy of this License; and
110
+
111
+ (b) You must cause any modified files to carry prominent notices
112
+ stating that You changed the files; and
113
+
114
+ (c) You must retain, in the Source form of any Derivative Works
115
+ that You distribute, all copyright, patent, trademark, and
116
+ attribution notices from the Source form of the Work,
117
+ excluding those notices that do not pertain to any part of
118
+ the Derivative Works; and
119
+
120
+ (d) If the Work includes a "NOTICE" text file as part of its
121
+ distribution, then any Derivative Works that You distribute must
122
+ include a readable copy of the attribution notices contained
123
+ within such NOTICE file, excluding those notices that do not
124
+ pertain to any part of the Derivative Works, in at least one
125
+ of the following places: within a NOTICE text file distributed
126
+ as part of the Derivative Works; within the Source form or
127
+ documentation, if provided along with the Derivative Works; or,
128
+ within a display generated by the Derivative Works, if and
129
+ wherever such third-party notices normally appear. The contents
130
+ of the NOTICE file are for informational purposes only and
131
+ do not modify the License. You may add Your own attribution
132
+ notices within Derivative Works that You distribute, alongside
133
+ or as an addendum to the NOTICE text from the Work, provided
134
+ that such additional attribution notices cannot be construed
135
+ as modifying the License.
136
+
137
+ You may add Your own copyright statement to Your modifications and
138
+ may provide additional or different license terms and conditions
139
+ for use, reproduction, or distribution of Your modifications, or
140
+ for any such Derivative Works as a whole, provided Your use,
141
+ reproduction, and distribution of the Work otherwise complies with
142
+ the conditions stated in this License.
143
+
144
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
145
+ any Contribution intentionally submitted for inclusion in the Work
146
+ by You to the Licensor shall be under the terms and conditions of
147
+ this License, without any additional terms or conditions.
148
+ Notwithstanding the above, nothing herein shall supersede or modify
149
+ the terms of any separate license agreement you may have executed
150
+ with Licensor regarding such Contributions.
151
+
152
+ 6. Trademarks. This License does not grant permission to use the trade
153
+ names, trademarks, service marks, or product names of the Licensor,
154
+ except as required for reasonable and customary use in describing the
155
+ origin of the Work and reproducing the content of the NOTICE file.
156
+
157
+ 7. Disclaimer of Warranty. Unless required by applicable law or
158
+ agreed to in writing, Licensor provides the Work (and each
159
+ Contributor provides its Contributions) on an "AS IS" BASIS,
160
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
161
+ implied, including, without limitation, any warranties or conditions
162
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
163
+ PARTICULAR PURPOSE. You are solely responsible for determining the
164
+ appropriateness of using or redistributing the Work and assume any
165
+ risks associated with Your exercise of permissions under this License.
166
+
167
+ 8. Limitation of Liability. In no event and under no legal theory,
168
+ whether in tort (including negligence), contract, or otherwise,
169
+ unless required by applicable law (such as deliberate and grossly
170
+ negligent acts) or agreed to in writing, shall any Contributor be
171
+ liable to You for damages, including any direct, indirect, special,
172
+ incidental, or consequential damages of any character arising as a
173
+ result of this License or out of the use or inability to use the
174
+ Work (including but not limited to damages for loss of goodwill,
175
+ work stoppage, computer failure or malfunction, or any and all
176
+ other commercial damages or losses), even if such Contributor
177
+ has been advised of the possibility of such damages.
178
+
179
+ 9. Accepting Warranty or Additional Liability. While redistributing
180
+ the Work or Derivative Works thereof, You may choose to offer,
181
+ and charge a fee for, acceptance of support, warranty, indemnity,
182
+ or other liability obligations and/or rights consistent with this
183
+ License. However, in accepting such obligations, You may act only
184
+ on Your own behalf and on Your sole responsibility, not on behalf
185
+ of any other Contributor, and only if You agree to indemnify,
186
+ defend, and hold each Contributor harmless for any liability
187
+ incurred by, or claims asserted against, such Contributor by reason
188
+ of your accepting any such warranty or additional liability.
189
+
190
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,160 @@
1
+ Metadata-Version: 2.5
2
+ Name: aembit-edge-sdk
3
+ Version: 1.35.0
4
+ Summary: Python SDK for the Aembit Edge API
5
+ Author: Aembit
6
+ License: Apache-2.0
7
+ License-File: LICENSE
8
+ Keywords: aembit,credentials,edge,sdk,security
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Requires-Python: >=3.10
20
+ Requires-Dist: botocore>=1.42.83
21
+ Provides-Extra: dev
22
+ Requires-Dist: mutmut>=3.7.0; extra == 'dev'
23
+ Requires-Dist: pip-audit>=2.8.0; extra == 'dev'
24
+ Requires-Dist: pyright>=1.1.408; extra == 'dev'
25
+ Requires-Dist: pytest-cov>=6.0.0; extra == 'dev'
26
+ Requires-Dist: pytest>=8.4.2; extra == 'dev'
27
+ Requires-Dist: ruff>=0.14.0; extra == 'dev'
28
+ Requires-Dist: tomli-w>=1.0.0; extra == 'dev'
29
+ Requires-Dist: tomli>=2.0.1; extra == 'dev'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # Aembit Edge Python SDK
33
+
34
+ [![PyPI version](https://img.shields.io/pypi/v/aembit-edge-sdk.svg)](https://pypi.org/project/aembit-edge-sdk/)
35
+ [![Python](https://img.shields.io/pypi/pyversions/aembit-edge-sdk.svg)](https://pypi.org/project/aembit-edge-sdk/)
36
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/Aembit/edge-sdks/blob/main/LICENSE)
37
+
38
+ Official Python SDK for interacting with the [Aembit Edge API](https://docs.aembit.io/api-guide/edge/).
39
+
40
+ The Aembit Edge SDK allows Python backend services, serverless functions, web applications, AI agents, and MCP servers to authenticate and retrieve credentials dynamically without managing static secrets.
41
+
42
+ ## Features
43
+
44
+ - 🔐 **Zero Hardcoded Secrets**: Authenticate via workload identity (AWS STS Role, GitHub Actions OIDC, GitLab CI/CD OIDC, Terraform Cloud OIDC).
45
+ - 🔄 **Automatic Token Lifecycle**: Built-in in-memory bearer token caching and proactive background refresh.
46
+ - 🪵 **Standard Library Logging**: Configured via the standard `logging` library under the `aembit_edge` namespace.
47
+ - 📦 **Modern Python**: Strictly typed, supporting Python `>=3.10`.
48
+
49
+ ## Installation
50
+
51
+ ```bash
52
+ pip install aembit-edge-sdk
53
+ ```
54
+
55
+ Or using `uv`:
56
+
57
+ ```bash
58
+ uv add aembit-edge-sdk
59
+ ```
60
+
61
+ ## Quickstart
62
+
63
+ ### Using AWS IAM Role (STS)
64
+
65
+ ```python
66
+ from aembit_edge import CredentialServerRef, EdgeClient, EdgeClientConfig, GetCredentialInput
67
+ from aembit_edge.trust_providers import AwsRoleTrustProvider
68
+
69
+ # 1. Initialize the AWS Role Trust Provider
70
+ aws_provider = AwsRoleTrustProvider(region="us-east-1")
71
+
72
+ # 2. Configure the Edge Client
73
+ config = EdgeClientConfig(
74
+ base_url="https://your-tenant.aembit.io",
75
+ client_id="your-client-id",
76
+ trust_provider=aws_provider,
77
+ )
78
+ client = EdgeClient(config)
79
+
80
+ # 3. Retrieve target server credentials
81
+ server = CredentialServerRef(host="database.internal", port=5432)
82
+ request = GetCredentialInput(server=server, credential_type="api_key")
83
+
84
+ result = client.get_credential(request)
85
+ print("Retrieved Credential Data:", result.data)
86
+ ```
87
+
88
+ ### Using OIDC Trust Providers (GitHub, GitLab, Terraform)
89
+
90
+ ```python
91
+ from aembit_edge import CredentialServerRef, EdgeClient, EdgeClientConfig, GetCredentialInput
92
+ from aembit_edge.trust_providers import GitHubTrustProvider
93
+
94
+ # 1. Initialize the trust provider with the environment's identity token
95
+ github_provider = GitHubTrustProvider(identity_token="YOUR_GITHUB_OIDC_TOKEN")
96
+
97
+ # 2. Configure the Edge Client
98
+ config = EdgeClientConfig(
99
+ base_url="https://your-tenant.aembit.io",
100
+ client_id="your-client-id",
101
+ trust_provider=github_provider,
102
+ )
103
+ client = EdgeClient(config)
104
+
105
+ # 3. Request credentials for a target server
106
+ server = CredentialServerRef(host="api.internal", port=443)
107
+ request = GetCredentialInput(server=server, credential_type="api_key")
108
+
109
+ result = client.get_credential(request)
110
+ print("Retrieved Credential Data:", result.data)
111
+ ```
112
+
113
+ Other OIDC providers (`GitLabTrustProvider`, `TerraformTrustProvider`) follow the same pattern:
114
+
115
+ ```python
116
+ from aembit_edge.trust_providers import GitLabTrustProvider, TerraformTrustProvider
117
+
118
+ # For GitLab CI/CD:
119
+ gitlab_provider = GitLabTrustProvider(identity_token="YOUR_GITLAB_OIDC_TOKEN")
120
+
121
+ # For Terraform Cloud:
122
+ terraform_provider = TerraformTrustProvider(identity_token="YOUR_TERRAFORM_OIDC_TOKEN")
123
+ ```
124
+
125
+ ## Supported Trust Providers
126
+
127
+ | Trust Provider | Class Name | Import Path |
128
+ | :--- | :--- | :--- |
129
+ | **AWS IAM Role (STS)** | `AwsRoleTrustProvider(region=...)` | `aembit_edge.trust_providers` |
130
+ | **GitHub Actions OIDC** | `GitHubTrustProvider(identity_token=...)` | `aembit_edge.trust_providers` |
131
+ | **GitLab CI/CD OIDC** | `GitLabTrustProvider(identity_token=...)` | `aembit_edge.trust_providers` |
132
+ | **Terraform Cloud OIDC** | `TerraformTrustProvider(identity_token=...)` | `aembit_edge.trust_providers` |
133
+
134
+ ## Logging & Observability
135
+
136
+ By default, the SDK remains silent with a `logging.NullHandler` attached to the `aembit_edge` namespace. To enable operational debug logging:
137
+
138
+ ```python
139
+ import logging
140
+
141
+ logging.basicConfig(level=logging.INFO)
142
+ logging.getLogger("aembit_edge").setLevel(logging.DEBUG)
143
+ ```
144
+
145
+ ## Examples
146
+
147
+ Runnable integration examples are available in the GitHub repository:
148
+
149
+ - [Logging Integration (Loguru & Structlog)](https://github.com/Aembit/edge-sdks/tree/main/py/examples/logging_integration)
150
+
151
+ ## Documentation & Resources
152
+
153
+ - [Official Aembit Edge API Guide](https://docs.aembit.io/api-guide/edge/)
154
+ - [Aembit Documentation](https://docs.aembit.io/)
155
+ - [GitHub Issue Tracker](https://github.com/Aembit/edge-sdks/issues)
156
+ - [Contributing Guide](https://github.com/Aembit/edge-sdks/blob/main/CONTRIBUTING.md)
157
+
158
+ ## License
159
+
160
+ This project is licensed under the [Apache-2.0 License](https://github.com/Aembit/edge-sdks/blob/main/LICENSE).
@@ -0,0 +1,129 @@
1
+ # Aembit Edge Python SDK
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/aembit-edge-sdk.svg)](https://pypi.org/project/aembit-edge-sdk/)
4
+ [![Python](https://img.shields.io/pypi/pyversions/aembit-edge-sdk.svg)](https://pypi.org/project/aembit-edge-sdk/)
5
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/Aembit/edge-sdks/blob/main/LICENSE)
6
+
7
+ Official Python SDK for interacting with the [Aembit Edge API](https://docs.aembit.io/api-guide/edge/).
8
+
9
+ The Aembit Edge SDK allows Python backend services, serverless functions, web applications, AI agents, and MCP servers to authenticate and retrieve credentials dynamically without managing static secrets.
10
+
11
+ ## Features
12
+
13
+ - 🔐 **Zero Hardcoded Secrets**: Authenticate via workload identity (AWS STS Role, GitHub Actions OIDC, GitLab CI/CD OIDC, Terraform Cloud OIDC).
14
+ - 🔄 **Automatic Token Lifecycle**: Built-in in-memory bearer token caching and proactive background refresh.
15
+ - 🪵 **Standard Library Logging**: Configured via the standard `logging` library under the `aembit_edge` namespace.
16
+ - 📦 **Modern Python**: Strictly typed, supporting Python `>=3.10`.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install aembit-edge-sdk
22
+ ```
23
+
24
+ Or using `uv`:
25
+
26
+ ```bash
27
+ uv add aembit-edge-sdk
28
+ ```
29
+
30
+ ## Quickstart
31
+
32
+ ### Using AWS IAM Role (STS)
33
+
34
+ ```python
35
+ from aembit_edge import CredentialServerRef, EdgeClient, EdgeClientConfig, GetCredentialInput
36
+ from aembit_edge.trust_providers import AwsRoleTrustProvider
37
+
38
+ # 1. Initialize the AWS Role Trust Provider
39
+ aws_provider = AwsRoleTrustProvider(region="us-east-1")
40
+
41
+ # 2. Configure the Edge Client
42
+ config = EdgeClientConfig(
43
+ base_url="https://your-tenant.aembit.io",
44
+ client_id="your-client-id",
45
+ trust_provider=aws_provider,
46
+ )
47
+ client = EdgeClient(config)
48
+
49
+ # 3. Retrieve target server credentials
50
+ server = CredentialServerRef(host="database.internal", port=5432)
51
+ request = GetCredentialInput(server=server, credential_type="api_key")
52
+
53
+ result = client.get_credential(request)
54
+ print("Retrieved Credential Data:", result.data)
55
+ ```
56
+
57
+ ### Using OIDC Trust Providers (GitHub, GitLab, Terraform)
58
+
59
+ ```python
60
+ from aembit_edge import CredentialServerRef, EdgeClient, EdgeClientConfig, GetCredentialInput
61
+ from aembit_edge.trust_providers import GitHubTrustProvider
62
+
63
+ # 1. Initialize the trust provider with the environment's identity token
64
+ github_provider = GitHubTrustProvider(identity_token="YOUR_GITHUB_OIDC_TOKEN")
65
+
66
+ # 2. Configure the Edge Client
67
+ config = EdgeClientConfig(
68
+ base_url="https://your-tenant.aembit.io",
69
+ client_id="your-client-id",
70
+ trust_provider=github_provider,
71
+ )
72
+ client = EdgeClient(config)
73
+
74
+ # 3. Request credentials for a target server
75
+ server = CredentialServerRef(host="api.internal", port=443)
76
+ request = GetCredentialInput(server=server, credential_type="api_key")
77
+
78
+ result = client.get_credential(request)
79
+ print("Retrieved Credential Data:", result.data)
80
+ ```
81
+
82
+ Other OIDC providers (`GitLabTrustProvider`, `TerraformTrustProvider`) follow the same pattern:
83
+
84
+ ```python
85
+ from aembit_edge.trust_providers import GitLabTrustProvider, TerraformTrustProvider
86
+
87
+ # For GitLab CI/CD:
88
+ gitlab_provider = GitLabTrustProvider(identity_token="YOUR_GITLAB_OIDC_TOKEN")
89
+
90
+ # For Terraform Cloud:
91
+ terraform_provider = TerraformTrustProvider(identity_token="YOUR_TERRAFORM_OIDC_TOKEN")
92
+ ```
93
+
94
+ ## Supported Trust Providers
95
+
96
+ | Trust Provider | Class Name | Import Path |
97
+ | :--- | :--- | :--- |
98
+ | **AWS IAM Role (STS)** | `AwsRoleTrustProvider(region=...)` | `aembit_edge.trust_providers` |
99
+ | **GitHub Actions OIDC** | `GitHubTrustProvider(identity_token=...)` | `aembit_edge.trust_providers` |
100
+ | **GitLab CI/CD OIDC** | `GitLabTrustProvider(identity_token=...)` | `aembit_edge.trust_providers` |
101
+ | **Terraform Cloud OIDC** | `TerraformTrustProvider(identity_token=...)` | `aembit_edge.trust_providers` |
102
+
103
+ ## Logging & Observability
104
+
105
+ By default, the SDK remains silent with a `logging.NullHandler` attached to the `aembit_edge` namespace. To enable operational debug logging:
106
+
107
+ ```python
108
+ import logging
109
+
110
+ logging.basicConfig(level=logging.INFO)
111
+ logging.getLogger("aembit_edge").setLevel(logging.DEBUG)
112
+ ```
113
+
114
+ ## Examples
115
+
116
+ Runnable integration examples are available in the GitHub repository:
117
+
118
+ - [Logging Integration (Loguru & Structlog)](https://github.com/Aembit/edge-sdks/tree/main/py/examples/logging_integration)
119
+
120
+ ## Documentation & Resources
121
+
122
+ - [Official Aembit Edge API Guide](https://docs.aembit.io/api-guide/edge/)
123
+ - [Aembit Documentation](https://docs.aembit.io/)
124
+ - [GitHub Issue Tracker](https://github.com/Aembit/edge-sdks/issues)
125
+ - [Contributing Guide](https://github.com/Aembit/edge-sdks/blob/main/CONTRIBUTING.md)
126
+
127
+ ## License
128
+
129
+ This project is licensed under the [Apache-2.0 License](https://github.com/Aembit/edge-sdks/blob/main/LICENSE).