Skip to content

Commit 417277d

Browse files
Add ledger certificate package (#43278)
* add ledger certificate package * regen * update changelog --------- Co-authored-by: catalinaperalta <[email protected]>
1 parent 8d2eb5e commit 417277d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+4830
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Release History
2+
3+
## 1.0.0b1 (2025-10-10)
4+
5+
- Initial version
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright (c) Microsoft Corporation.
2+
3+
MIT License
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
include *.md
2+
include LICENSE
3+
include azure/confidentialledger/certificate/py.typed
4+
recursive-include tests *.py
5+
recursive-include samples *.py *.md
6+
include azure/__init__.py
7+
include azure/confidentialledger/__init__.py
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Azure Confidential Ledger Certificate client library for Python
2+
3+
The Confidential Ledger Certificate client library is used to retrieve the TLS certificate required for connecting to a Confidential Ledger.
4+
5+
## Getting started
6+
7+
### Install the package
8+
9+
```bash
10+
python -m pip install azure-confidentialledger-certificate
11+
```
12+
13+
#### Prerequisites
14+
15+
- Python 3.9 or later is required to use this package.
16+
- You need an [Azure subscription][azure_sub] to use this package.
17+
- An existing Confidential Ledger instance.
18+
19+
## Key concepts
20+
21+
Clients may authenticate with a client certificate in mutual TLS instead of via an Azure Active Directory token. Use the `get_ledger_identity()` method on the `ConfidentialLedgerCertificateClient` to retrieve the certificate.
22+
23+
## Examples
24+
25+
Get a ledger certificate for authentication using the `ConfidentialLedgerCertificateClient` from the `azure-confidentialledger-certificate` package, save the certificate, pass the certificate path to the `ConfidentialLedgerCertificateCredential` from the `azure-confidentialledger` package, and pass the credential to the `ConfidentialLedgerClient` for authentication:
26+
27+
```python
28+
from azure.confidentialledger.certificate import ConfidentialLedgerCertificateClient
29+
from azure.confidentialledger import (
30+
ConfidentialLedgerCertificateCredential,
31+
ConfidentialLedgerClient,
32+
)
33+
34+
identity_client = ConfidentialLedgerCertificateClient()
35+
network_identity = identity_client.get_ledger_identity(
36+
ledger_id="my-ledger-id"
37+
)
38+
39+
ledger_tls_cert_file_name = "ledger_certificate.pem"
40+
with open(ledger_tls_cert_file_name, "w") as cert_file:
41+
cert_file.write(network_identity["ledgerTlsCertificate"])
42+
43+
credential = ConfidentialLedgerCertificateCredential(
44+
certificate_path="Path to user certificate PEM file"
45+
)
46+
ledger_client = ConfidentialLedgerClient(
47+
endpoint="https://my-ledger-id.confidential-ledger.azure.com",
48+
credential=credential,
49+
ledger_certificate_path=ledger_tls_cert_file_name
50+
)
51+
```
52+
53+
## Troubleshooting
54+
55+
Confidential Ledger clients raise exceptions defined in [azure-core][azure_core_exceptions].
56+
57+
## Next steps
58+
59+
Use the certificate retrieved using this library with the `azure-confidentialledger` package. The Azure Confidential Ledger client library has several code samples that show common scenario operations.
60+
61+
### Additional Documentation
62+
63+
For more extensive documentation on Azure Confidential Ledger, see the
64+
[API reference documentation][reference_docs]. You may also read more about Microsoft Research's open-source [Confidential Consortium Framework][ccf].
65+
66+
## Contributing
67+
68+
This project welcomes contributions and suggestions. Most contributions require
69+
you to agree to a Contributor License Agreement (CLA) declaring that you have
70+
the right to, and actually do, grant us the rights to use your contribution.
71+
For details, visit https://cla.microsoft.com.
72+
73+
When you submit a pull request, a CLA-bot will automatically determine whether
74+
you need to provide a CLA and decorate the PR appropriately (e.g., label,
75+
comment). Simply follow the instructions provided by the bot. You will only
76+
need to do this once across all repos using our CLA.
77+
78+
This project has adopted the
79+
[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information,
80+
see the Code of Conduct FAQ or contact [email protected] with any
81+
additional questions or comments.
82+
83+
<!-- LINKS -->
84+
85+
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
86+
[azure_core_exceptions]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core#azure-core-library-exceptions
87+
[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
88+
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
89+
[azure_identity_pip]: https://pypi.org/project/azure-identity/
90+
[pip]: https://pypi.org/project/pip/
91+
[azure_sub]: https://azure.microsoft.com/free/
92+
[reference_docs]: https://aka.ms/azsdk/python/confidentialledger/ref-docs
93+
[ccf]: https://github.com/Microsoft/CCF
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"apiVersion": "2024-12-09-preview"
3+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"CrossLanguagePackageId": "ConfidentialLedgerCertificate",
3+
"CrossLanguageDefinitionId": {
4+
"azure.confidentialledger.certificate.models.ConfidentialLedgerError": "ConfidentialLedgerCommon.ConfidentialLedgerError",
5+
"azure.confidentialledger.certificate.models.ConfidentialLedgerErrorBody": "ConfidentialLedgerCommon.ConfidentialLedgerErrorBody",
6+
"azure.confidentialledger.certificate.models.LedgerIdentityInformation": "ConfidentialLedgerCertificate.LedgerIdentityInformation",
7+
"azure.confidentialledger.certificate.ConfidentialLedgerCertificateClient.get_ledger_identity": "ConfidentialLedgerCertificate.getLedgerIdentity",
8+
"azure.confidentialledger.certificate.aio.ConfidentialLedgerCertificateClient.get_ledger_identity": "ConfidentialLedgerCertificate.getLedgerIdentity"
9+
}
10+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"AssetsRepo": "Azure/azure-sdk-assets",
3+
"AssetsRepoPrefixPath": "python",
4+
"TagPrefix": "python/confidentialledger/azure-confidentialledger-certificate",
5+
"Tag": "python/confidentialledger/azure-confidentialledger-certificate_e868943cfa"
6+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) Python Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
9+
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._client import ConfidentialLedgerCertificateClient # type: ignore
16+
from ._version import VERSION
17+
18+
__version__ = VERSION
19+
20+
try:
21+
from ._patch import __all__ as _patch_all
22+
from ._patch import *
23+
except ImportError:
24+
_patch_all = []
25+
from ._patch import patch_sdk as _patch_sdk
26+
27+
__all__ = [
28+
"ConfidentialLedgerCertificateClient",
29+
]
30+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
31+
32+
_patch_sdk()

0 commit comments

Comments
 (0)