@azure-rest/confidential-ledger 1.1.2-alpha.20250730.1 → 1.1.2-alpha.20250805.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 +173 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -99,6 +99,11 @@ const client = ConfidentialLedger(
|
|
|
99
99
|
|
|
100
100
|
Every write to Azure Confidential Ledger generates an immutable ledger entry in the service. Writes, also referred to as transactions, are uniquely identified by transaction ids that increment with each write. Once written, ledger entries may be retrieved at any time.
|
|
101
101
|
|
|
102
|
+
#### Tags
|
|
103
|
+
It is possible to further organize data within a collection as part of the latest preview version dated `2024-12-09-preview` or newer.
|
|
104
|
+
|
|
105
|
+
Specify the `tags` parameter as part of the create entry operation. Multiple tags can be specified using commas. There is a limit of five tags per transaction.
|
|
106
|
+
|
|
102
107
|
### Receipts
|
|
103
108
|
|
|
104
109
|
State changes to the Confidential Ledger are saved in a data structure called a Merkle tree. To cryptographically verify that writes were correctly saved, a Merkle proof, or receipt, can be retrieved for any transaction id.
|
|
@@ -126,8 +131,14 @@ Azure Confidential Ledger is built on Microsoft Research's open-source [Confiden
|
|
|
126
131
|
This section contains code snippets for the following samples:
|
|
127
132
|
|
|
128
133
|
- [Post Ledger Entry](#post-ledger-entry "Post Ledger Entry")
|
|
134
|
+
- [Post Ledger Entry With CollectionId](#post-ledger-entry-with-collectionid "Post Ledger Entry With CollectionId")]
|
|
135
|
+
- [Post Ledger Entry With CollectionId and Tags](#post-ledger-entry-with-collectionid-and-tags "Post Ledger Entry With CollectionId and Tags")]
|
|
129
136
|
- [Get a Ledger Entry By Transaction Id](#get-a-ledger-entry "Get a Ledger Entry By Transaction Id")
|
|
137
|
+
- [Get a Ledger Entry By Transaction Id With CollectionId](#get-a-ledger-entry-with-collectionid "Get a Ledger Entry By Transaction Id With CollectionId")
|
|
138
|
+
- [Get a Ledger Entry By Transaction Id With CollectionId and Tag](#get-a-ledger-entry-with-collectionid-and-tag "Get a Ledger Entry By Transaction Id With CollectionId and Tag")
|
|
130
139
|
- [Get All Ledger Entries](#get-all-ledger-entries "Get All Ledger Entries")
|
|
140
|
+
- [Get All Ledger Entries With CollectionId](#get-all-ledger-entries-with-collectionid "Get All Ledger Entries With CollectionId")
|
|
141
|
+
- [Get All Ledger Entries With CollectionId and Tag](#get-all-ledger-entries-with-collectionid-and-tag "Get All Ledger Entries With CollectionId and Tag")
|
|
131
142
|
- [Get All Collections](#get-all-collections "Get All Collections")
|
|
132
143
|
- [Get Transactions for a Collection](#transactions-for-collection "Get Transactions for a Collection")
|
|
133
144
|
- [List Enclave Quotes](#list-enclave-quotes "List Enclave Quotes")
|
|
@@ -164,6 +175,73 @@ const ledgerEntry: CreateLedgerEntryParameters = {
|
|
|
164
175
|
const result = await client.path("/app/transactions").post(ledgerEntry);
|
|
165
176
|
```
|
|
166
177
|
|
|
178
|
+
### Post Ledger Entry With CollectionId
|
|
179
|
+
|
|
180
|
+
```ts snippet:ReadmeSamplePostLedgerEntryWithCollectionId
|
|
181
|
+
import ConfidentialLedger, {
|
|
182
|
+
getLedgerIdentity,
|
|
183
|
+
LedgerEntry,
|
|
184
|
+
CreateLedgerEntryParameters,
|
|
185
|
+
} from "@azure-rest/confidential-ledger";
|
|
186
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
187
|
+
|
|
188
|
+
const { ledgerIdentityCertificate } = await getLedgerIdentity(
|
|
189
|
+
"test-ledger-name",
|
|
190
|
+
"https://identity.confidential-ledger.core.azure.com",
|
|
191
|
+
);
|
|
192
|
+
const credential = new DefaultAzureCredential();
|
|
193
|
+
const client = ConfidentialLedger(
|
|
194
|
+
"https://test-ledger-name.confidential-ledger.azure.com",
|
|
195
|
+
ledgerIdentityCertificate,
|
|
196
|
+
credential,
|
|
197
|
+
);
|
|
198
|
+
// Type assertion is used to allow collectionId
|
|
199
|
+
const entry: LedgerEntry = {
|
|
200
|
+
contents: "<content>",
|
|
201
|
+
};
|
|
202
|
+
const ledgerEntry: CreateLedgerEntryParameters = {
|
|
203
|
+
queryParameters: {
|
|
204
|
+
collectionId: "my collection",
|
|
205
|
+
},
|
|
206
|
+
contentType: "application/json",
|
|
207
|
+
body: entry,
|
|
208
|
+
};
|
|
209
|
+
const result = await client.path("/app/transactions").post(ledgerEntry);
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Post Ledger Entry With CollectionId and Tags
|
|
213
|
+
```ts snippet:ReadmeSamplePostLedgerEntryWithCollectionIdAndTags
|
|
214
|
+
import ConfidentialLedger, {
|
|
215
|
+
getLedgerIdentity,
|
|
216
|
+
LedgerEntry,
|
|
217
|
+
CreateLedgerEntryParameters,
|
|
218
|
+
} from "@azure-rest/confidential-ledger";
|
|
219
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
220
|
+
|
|
221
|
+
const { ledgerIdentityCertificate } = await getLedgerIdentity(
|
|
222
|
+
"test-ledger-name",
|
|
223
|
+
"https://identity.confidential-ledger.core.azure.com",
|
|
224
|
+
);
|
|
225
|
+
const credential = new DefaultAzureCredential();
|
|
226
|
+
const client = ConfidentialLedger(
|
|
227
|
+
"https://test-ledger-name.confidential-ledger.azure.com",
|
|
228
|
+
ledgerIdentityCertificate,
|
|
229
|
+
credential,
|
|
230
|
+
);
|
|
231
|
+
// Type assertion is used to allow collectionId and tags
|
|
232
|
+
const entry: LedgerEntry = {
|
|
233
|
+
contents: "<content>",
|
|
234
|
+
};
|
|
235
|
+
const ledgerEntry: CreateLedgerEntryParameters = {
|
|
236
|
+
queryParameters: {
|
|
237
|
+
tags: "tag1,tag2",
|
|
238
|
+
},
|
|
239
|
+
contentType: "application/json",
|
|
240
|
+
body: entry,
|
|
241
|
+
};
|
|
242
|
+
const result = await client.path("/app/transactions").post(ledgerEntry);
|
|
243
|
+
```
|
|
244
|
+
|
|
167
245
|
### Get a Ledger Entry By Transaction Id
|
|
168
246
|
|
|
169
247
|
```ts snippet:ReadmeSampleGetLedgerEntry
|
|
@@ -186,6 +264,56 @@ const transactionId = "<TRANSACTION_ID>";
|
|
|
186
264
|
const status = await client.path("/app/transactions/{transactionId}/status", transactionId).get();
|
|
187
265
|
```
|
|
188
266
|
|
|
267
|
+
### Get a Ledger Entry By Transaction Id With CollectionId
|
|
268
|
+
|
|
269
|
+
```ts snippet:ReadmeSampleGetLedgerEntryWithCollectionIdSample
|
|
270
|
+
import ConfidentialLedger, { getLedgerIdentity } from "@azure-rest/confidential-ledger";
|
|
271
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
272
|
+
|
|
273
|
+
const { ledgerIdentityCertificate } = await getLedgerIdentity(
|
|
274
|
+
"test-ledger-name",
|
|
275
|
+
"https://identity.confidential-ledger.core.azure.com",
|
|
276
|
+
);
|
|
277
|
+
const credential = new DefaultAzureCredential();
|
|
278
|
+
const client = ConfidentialLedger(
|
|
279
|
+
"https://test-ledger-name.confidential-ledger.azure.com",
|
|
280
|
+
ledgerIdentityCertificate,
|
|
281
|
+
credential,
|
|
282
|
+
);
|
|
283
|
+
const transactionId = "<TRANSACTION_ID>";
|
|
284
|
+
const getLedgerEntryParams = {
|
|
285
|
+
queryParameters: { collectionId: "my-collection" },
|
|
286
|
+
};
|
|
287
|
+
const result = await client
|
|
288
|
+
.path("/app/transactions/{transactionId}", transactionId)
|
|
289
|
+
.get(getLedgerEntryParams);
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Get a Ledger Entry By Transaction Id With CollectionId and Tag
|
|
293
|
+
|
|
294
|
+
```ts snippet:ReadmeSampleGetLedgerEntryWithCollectionIdAndTagSample
|
|
295
|
+
import ConfidentialLedger, { getLedgerIdentity } from "@azure-rest/confidential-ledger";
|
|
296
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
297
|
+
|
|
298
|
+
const { ledgerIdentityCertificate } = await getLedgerIdentity(
|
|
299
|
+
"test-ledger-name",
|
|
300
|
+
"https://identity.confidential-ledger.core.azure.com",
|
|
301
|
+
);
|
|
302
|
+
const credential = new DefaultAzureCredential();
|
|
303
|
+
const client = ConfidentialLedger(
|
|
304
|
+
"https://test-ledger-name.confidential-ledger.azure.com",
|
|
305
|
+
ledgerIdentityCertificate,
|
|
306
|
+
credential,
|
|
307
|
+
);
|
|
308
|
+
const transactionId = "<TRANSACTION_ID>";
|
|
309
|
+
const getLedgerEntryParams = {
|
|
310
|
+
queryParameters: { collectionId: "my-collection", tag: "tag1" },
|
|
311
|
+
};
|
|
312
|
+
const result = await client
|
|
313
|
+
.path("/app/transactions/{transactionId}", transactionId)
|
|
314
|
+
.get(getLedgerEntryParams);
|
|
315
|
+
```
|
|
316
|
+
|
|
189
317
|
### Get All Ledger Entries
|
|
190
318
|
|
|
191
319
|
```ts snippet:ReadmeSampleGetAllLedgerEntries
|
|
@@ -207,6 +335,50 @@ const client = ConfidentialLedger(
|
|
|
207
335
|
const ledgerEntries = await client.path("/app/transactions");
|
|
208
336
|
```
|
|
209
337
|
|
|
338
|
+
### Get All Ledger Entries With CollectionId
|
|
339
|
+
|
|
340
|
+
```ts snippet:ReadmeSampleGetAllLedgerEntriesWithCollectionIdSample
|
|
341
|
+
import ConfidentialLedger, { getLedgerIdentity } from "@azure-rest/confidential-ledger";
|
|
342
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
343
|
+
|
|
344
|
+
const { ledgerIdentityCertificate } = await getLedgerIdentity(
|
|
345
|
+
"test-ledger-name",
|
|
346
|
+
"https://identity.confidential-ledger.core.azure.com",
|
|
347
|
+
);
|
|
348
|
+
const credential = new DefaultAzureCredential();
|
|
349
|
+
const client = ConfidentialLedger(
|
|
350
|
+
"https://test-ledger-name.confidential-ledger.azure.com",
|
|
351
|
+
ledgerIdentityCertificate,
|
|
352
|
+
credential,
|
|
353
|
+
);
|
|
354
|
+
const getLedgerEntriesParams = {
|
|
355
|
+
queryParameters: { collectionId: "my-collection" },
|
|
356
|
+
};
|
|
357
|
+
const ledgerEntries = await client.path("/app/transactions").get(getLedgerEntriesParams);
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### Get All Ledger Entries With CollectionId and Tag
|
|
361
|
+
|
|
362
|
+
```ts snippet:ReadmeSampleGetAllLedgerEntriesWithCollectionIdAndTagSample
|
|
363
|
+
import ConfidentialLedger, { getLedgerIdentity } from "@azure-rest/confidential-ledger";
|
|
364
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
365
|
+
|
|
366
|
+
const { ledgerIdentityCertificate } = await getLedgerIdentity(
|
|
367
|
+
"test-ledger-name",
|
|
368
|
+
"https://identity.confidential-ledger.core.azure.com",
|
|
369
|
+
);
|
|
370
|
+
const credential = new DefaultAzureCredential();
|
|
371
|
+
const client = ConfidentialLedger(
|
|
372
|
+
"https://test-ledger-name.confidential-ledger.azure.com",
|
|
373
|
+
ledgerIdentityCertificate,
|
|
374
|
+
credential,
|
|
375
|
+
);
|
|
376
|
+
const getLedgerEntriesParams = {
|
|
377
|
+
queryParameters: { collectionId: "my-collection", tag: "tag1" },
|
|
378
|
+
};
|
|
379
|
+
const ledgerEntries = await client.path("/app/transactions").get(getLedgerEntriesParams);
|
|
380
|
+
```
|
|
381
|
+
|
|
210
382
|
### Get All Collections
|
|
211
383
|
|
|
212
384
|
```ts snippet:ReadmeSampleGetAllCollections
|
|
@@ -325,4 +497,4 @@ If you'd like to contribute to this library, please read the [contributing guide
|
|
|
325
497
|
[azure_sub]: https://azure.microsoft.com/free/
|
|
326
498
|
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials
|
|
327
499
|
[default_azure_credential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential
|
|
328
|
-
[azure_resource_manager]: https://learn.microsoft.com/azure/azure-resource-manager/management/overview
|
|
500
|
+
[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.2-alpha.
|
|
6
|
+
"version": "1.1.2-alpha.20250805.1",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"node",
|
|
9
9
|
"azure",
|