@azure-rest/confidential-ledger 1.1.0-alpha.20241216.1 → 1.1.0-alpha.20241219.1
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.
- package/README.md +33 -28
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -50,15 +50,15 @@ Because Confidential Ledgers use self-signed certificates securely generated and
|
|
|
50
50
|
import ConfidentialLedger, { getLedgerIdentity } from "../../src";
|
|
51
51
|
|
|
52
52
|
const { ledgerIdentityCertificate } = await getLedgerIdentity(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
// for example, test-ledger-name
|
|
54
|
+
LEDGER_IDENTITY,
|
|
55
|
+
// for example, https://identity.confidential-ledger.core.azure.com
|
|
56
|
+
IDENTITY_SERVICE_URL,
|
|
57
|
+
);
|
|
58
|
+
const credential = new DefaultAzureCredential();
|
|
59
|
+
|
|
60
|
+
// ENDPOINT example: https://test-ledger-name.confidential-ledger.azure.com
|
|
61
|
+
const ledgerClient = ConfidentialLedger(ENDPOINT, ledgerIdentityCertificate, credential);
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
#### Using a client certificate
|
|
@@ -70,20 +70,20 @@ import ConfidentialLedger, { getLedgerIdentity } from "@azure-rest/confidential-
|
|
|
70
70
|
|
|
71
71
|
// Get the signing certificate from the Confidential Ledger Identity Service
|
|
72
72
|
const { ledgerIdentityCertificate } = await getLedgerIdentity(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
73
|
+
LEDGER_IDENTITY,
|
|
74
|
+
IDENTITY_SERVICE_URL,
|
|
75
|
+
);
|
|
76
|
+
// both cert (certificate key) and key (private key) are in PEM format
|
|
77
|
+
const cert = PUBLIC_KEY;
|
|
78
|
+
const key = PRIVATE_KEY;
|
|
79
|
+
// Create the Confidential Ledger Client
|
|
80
|
+
// ENDPOINT example: https://test-ledger-name.confidential-ledger.azure.com
|
|
81
|
+
const ledgerClient = ConfidentialLedger(env.ENDPOINT, ledgerIdentityCertificate, {
|
|
82
|
+
tlsOptions: {
|
|
83
|
+
cert,
|
|
84
|
+
key,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
## Key concepts
|
|
@@ -126,6 +126,7 @@ This section contains code snippets for the following samples:
|
|
|
126
126
|
- [List Enclave Quotes](#list-enclave-quotes "List Enclave Quotes")
|
|
127
127
|
|
|
128
128
|
### Post Ledger Entry
|
|
129
|
+
|
|
129
130
|
```typescript
|
|
130
131
|
const entry: LedgerEntry = {
|
|
131
132
|
contents: contentBody,
|
|
@@ -138,29 +139,32 @@ const result = await client.path("/app/transactions").post(ledgerEntry);
|
|
|
138
139
|
```
|
|
139
140
|
|
|
140
141
|
### Get a Ledger Entry By Transaction Id
|
|
142
|
+
|
|
141
143
|
```typescript
|
|
142
|
-
const status = await client
|
|
143
|
-
.path("/app/transactions/{transactionId}/status", transactionId)
|
|
144
|
-
.get();
|
|
144
|
+
const status = await client.path("/app/transactions/{transactionId}/status", transactionId).get();
|
|
145
145
|
```
|
|
146
146
|
|
|
147
147
|
### Get All Ledger Entries
|
|
148
|
+
|
|
148
149
|
```typescript
|
|
149
150
|
const ledgerEntries = await client.path("/app/transactions");
|
|
150
151
|
```
|
|
151
152
|
|
|
152
153
|
### Get All Collections
|
|
154
|
+
|
|
153
155
|
```typescript
|
|
154
156
|
const result = await client.path("/app/collections").get();
|
|
155
157
|
```
|
|
156
158
|
|
|
157
159
|
### Get Transactions for a Collection
|
|
160
|
+
|
|
158
161
|
```typescript
|
|
159
162
|
const getLedgerEntriesParams = { queryParameters: { collectionId: "my collection" } };
|
|
160
163
|
const ledgerEntries = await client.path("/app/transactions").get(getLedgerEntriesParams);
|
|
161
164
|
```
|
|
162
165
|
|
|
163
166
|
### List Enclave Quotes
|
|
167
|
+
|
|
164
168
|
```typescript
|
|
165
169
|
// Get enclave quotes
|
|
166
170
|
const enclaveQuotes = await confidentialLedger.path("/app/enclaveQuotes").get();
|
|
@@ -177,6 +181,7 @@ Object.keys(enclaveQuotes.body.enclaveQuotes).forEach((key) => {
|
|
|
177
181
|
```
|
|
178
182
|
|
|
179
183
|
### Full Example
|
|
184
|
+
|
|
180
185
|
```typescript
|
|
181
186
|
import ConfidentialLedger, { getLedgerIdentity } from "@azure-rest/confidential-ledger";
|
|
182
187
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
@@ -189,7 +194,7 @@ export async function main() {
|
|
|
189
194
|
const confidentialLedger = ConfidentialLedger(
|
|
190
195
|
"https://<ledger-name>.eastus.cloudapp.azure.com",
|
|
191
196
|
ledgerIdentity.ledgerIdentityCertificate,
|
|
192
|
-
new DefaultAzureCredential()
|
|
197
|
+
new DefaultAzureCredential(),
|
|
193
198
|
);
|
|
194
199
|
|
|
195
200
|
// Get enclave quotes
|
|
@@ -251,4 +256,4 @@ If you'd like to contribute to this library, please read the [contributing guide
|
|
|
251
256
|
[azure_sub]: https://azure.microsoft.com/free/
|
|
252
257
|
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials
|
|
253
258
|
[default_azure_credential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential
|
|
254
|
-
[azure_resource_manager]: https://
|
|
259
|
+
[azure_resource_manager]: https://learn.microsoft.com/azure/azure-resource-manager/management/overview
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"sdk-type": "client",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "An isomorphic rest level client library for the Azure Confidential Ledger service.",
|
|
6
|
-
"version": "1.1.0-alpha.
|
|
6
|
+
"version": "1.1.0-alpha.20241219.1",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"node",
|
|
9
9
|
"azure",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"@vitest/coverage-istanbul": "^2.1.5",
|
|
97
97
|
"dotenv": "^16.0.0",
|
|
98
98
|
"eslint": "^9.9.0",
|
|
99
|
-
"typescript": "~5.
|
|
99
|
+
"typescript": "~5.7.2",
|
|
100
100
|
"vitest": "^2.1.5"
|
|
101
101
|
},
|
|
102
102
|
"type": "module",
|