-
Notifications
You must be signed in to change notification settings - Fork 5.1k
/
confidentialledger.json
863 lines (863 loc) · 25.2 KB
/
confidentialledger.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
{
"swagger": "2.0",
"info": {
"version": "0.1-preview",
"title": "ConfidentialLedgerClient",
"description": "The ConfidentialLedgerClient writes and retrieves ledger entries against the Confidential Ledger service."
},
"x-ms-parameterized-host": {
"hostTemplate": "{ledgerUri}",
"useSchemePrefix": false,
"positionInOperation": "first",
"parameters": [
{
"name": "ledgerUri",
"description": "The Confidential Ledger URL, for example https://contoso.confidentialledger.azure.com",
"required": true,
"type": "string",
"in": "path",
"format": "url",
"x-ms-skip-url-encoding": true,
"x-ms-parameter-location": "client"
}
]
},
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/app/governance/constitution": {
"get": {
"operationId": "ConfidentialLedger_GetConstitution",
"x-ms-examples": {
"GetConstitution": {
"$ref": "./examples/ledger/GetConstitution.json"
}
},
"summary": "Gets the constitution used for governance.",
"description": "The constitution is a script that assesses and applies proposals from consortium members.",
"parameters": [
{
"$ref": "common.json#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "The constitution.",
"schema": {
"$ref": "#/definitions/Constitution"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "common.json#/definitions/ConfidentialLedgerError"
}
}
}
}
},
"/app/governance/members": {
"get": {
"operationId": "ConfidentialLedger_GetConsortiumMembers",
"x-ms-examples": {
"GetConsortiumMembers": {
"$ref": "./examples/ledger/GetConsortiumMembers.json"
}
},
"summary": "Gets the consortium members.",
"description": "Consortium members can manage the Confidential Ledger.",
"parameters": [
{
"$ref": "common.json#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "List of consortium members.",
"schema": {
"$ref": "#/definitions/Consortium"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "common.json#/definitions/ConfidentialLedgerError"
}
}
}
}
},
"/app/enclaveQuotes": {
"get": {
"operationId": "ConfidentialLedger_GetEnclaveQuotes",
"x-ms-examples": {
"GetEnclaveQuotes": {
"$ref": "./examples/ledger/GetEnclaveQuotes.json"
}
},
"summary": "Gets quotes for all nodes of the Confidential Ledger.",
"description": "A quote is an SGX enclave measurement that can be used to verify the validity of a node and its enclave.",
"parameters": [
{
"$ref": "common.json#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "Response containing enclave quotes.",
"schema": {
"$ref": "#/definitions/ConfidentialLedgerEnclaves"
}
},
"default": {
"description": "Error response describing why the operation failed",
"schema": {
"$ref": "common.json#/definitions/ConfidentialLedgerError"
}
}
}
}
},
"/app/transactions": {
"get": {
"operationId": "ConfidentialLedger_GetLedgerEntries",
"x-ms-examples": {
"GetLedgerEntries": {
"$ref": "./examples/ledger/GetLedgerEntries.json"
}
},
"x-ms-pageable": {
"itemName": "entries",
"nextLinkName": "@nextLink"
},
"summary": "Gets ledger entries from a sub-ledger corresponding to a range.",
"description": "A sub-ledger id may optionally be specified. Only entries in the specified (or default) sub-ledger will be returned.",
"parameters": [
{
"$ref": "common.json#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/SubLedgerIdParameter"
},
{
"$ref": "#/parameters/TransactionIdFromParameter"
},
{
"$ref": "#/parameters/TransactionIdToParameter"
}
],
"responses": {
"200": {
"description": "Ledger entries in the specified range.",
"schema": {
"$ref": "#/definitions/PagedLedgerEntries"
}
},
"default": {
"description": "Error response describing why the operation failed",
"schema": {
"$ref": "common.json#/definitions/ConfidentialLedgerError"
}
}
}
},
"post": {
"operationId": "ConfidentialLedger_PostLedgerEntry",
"x-ms-examples": {
"PostLedgerEntry": {
"$ref": "./examples/ledger/PostLedgerEntry.json"
}
},
"summary": "Writes a ledger entry.",
"description": "A sub-ledger id may optionally be specified.",
"parameters": [
{
"$ref": "common.json#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/SubLedgerIdParameter"
},
{
"in": "body",
"name": "entry",
"description": "Ledger entry.",
"schema": {
"$ref": "#/definitions/LedgerEntry"
}
}
],
"responses": {
"200": {
"description": "Returns the transaction id at which the write will be durably stored.",
"headers": {
"x-ms-ccf-transaction-id": {
"type": "string",
"description": "The transaction id at which this write will become durable."
}
},
"schema": {
"$ref": "#/definitions/LedgerWriteResult"
}
},
"default": {
"description": "Error response describing why the operation failed",
"schema": {
"$ref": "common.json#/definitions/ConfidentialLedgerError"
}
}
}
}
},
"/app/transactions/{transactionId}": {
"get": {
"operationId": "ConfidentialLedger_GetLedgerEntry",
"x-ms-examples": {
"GetLedgerEntry": {
"$ref": "./examples/ledger/GetLedgerEntry.json"
}
},
"summary": "Gets the ledger entry at the specified transaction id. A sub-ledger id may optionally be specified to indicate the sub-ledger from which to fetch the value.",
"description": "To return older ledger entries, the relevant sections of the ledger must be read from disk and validated. To prevent blocking within the enclave, the response will indicate whether the entry is ready and part of the response, or if the loading is still ongoing.",
"parameters": [
{
"$ref": "common.json#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/SubLedgerIdParameter"
},
{
"$ref": "#/parameters/TransactionIdParameter"
}
],
"responses": {
"200": {
"description": "The result of querying the Confidential Ledger.",
"schema": {
"$ref": "#/definitions/LedgerQueryResult"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "common.json#/definitions/ConfidentialLedgerError"
}
}
}
}
},
"/app/transactions/{transactionId}/receipt": {
"get": {
"operationId": "ConfidentialLedger_GetReceipt",
"x-ms-examples": {
"GetReceipt": {
"$ref": "./examples/ledger/GetReceipt.json"
}
},
"summary": "Gets a receipt certifying ledger contents at a particular transaction id.",
"parameters": [
{
"$ref": "common.json#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/TransactionIdParameter"
}
],
"responses": {
"200": {
"description": "The receipt for the write occurring at the transaction id.",
"schema": {
"$ref": "#/definitions/TransactionReceipt"
}
},
"default": {
"description": "Error response describing why the operation failed",
"schema": {
"$ref": "common.json#/definitions/ConfidentialLedgerError"
}
}
}
}
},
"/app/transactions/{transactionId}/status": {
"get": {
"operationId": "ConfidentialLedger_GetTransactionStatus",
"x-ms-examples": {
"GetTransactionStatus": {
"$ref": "./examples/ledger/GetTransactionStatus.json"
}
},
"summary": "Gets the status of an entry identified by a transaction id.",
"parameters": [
{
"$ref": "common.json#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/TransactionIdParameter"
}
],
"responses": {
"200": {
"description": "The status of the entry recorded at the specified transaction id.",
"schema": {
"$ref": "#/definitions/TransactionStatus"
}
},
"default": {
"description": "Error response describing why the operation failed",
"schema": {
"$ref": "common.json#/definitions/ConfidentialLedgerError"
}
}
}
}
},
"/app/transactions/current": {
"get": {
"operationId": "ConfidentialLedger_GetCurrentLedgerEntry",
"x-ms-examples": {
"GetCurrentLedgerEntry": {
"$ref": "./examples/ledger/GetCurrentLedgerEntry.json"
}
},
"summary": "Gets the current value available in the ledger.",
"description": "A sub-ledger id may optionally be specified.",
"parameters": [
{
"$ref": "common.json#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/SubLedgerIdParameter"
}
],
"responses": {
"200": {
"description": "The current ledger entry available on the receiving node. Non-primary nodes may return older values.",
"schema": {
"$ref": "#/definitions/LedgerEntry"
}
},
"default": {
"description": "Error response describing why the operation failed",
"schema": {
"$ref": "common.json#/definitions/ConfidentialLedgerError"
}
}
}
}
},
"/app/users/{userId}": {
"delete": {
"operationId": "ConfidentialLedger_DeleteUser",
"x-ms-examples": {
"DeleteUser": {
"$ref": "./examples/ledger/DeleteUser.json"
}
},
"summary": "Deletes a user from the Confidential Ledger.",
"parameters": [
{
"$ref": "common.json#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/UserIdParameter"
}
],
"responses": {
"204": {
"description": "The specified user is deleted."
},
"default": {
"description": "Error response describing why the operation failed",
"schema": {
"$ref": "common.json#/definitions/ConfidentialLedgerError"
}
}
}
},
"get": {
"operationId": "ConfidentialLedger_GetUser",
"x-ms-examples": {
"GetUser": {
"$ref": "./examples/ledger/GetUser.json"
}
},
"summary": "Gets a user.",
"parameters": [
{
"$ref": "common.json#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/UserIdParameter"
}
],
"responses": {
"200": {
"description": "Details about the specified user.",
"schema": {
"$ref": "#/definitions/LedgerUser"
}
},
"default": {
"description": "Error response describing why the operation failed",
"schema": {
"$ref": "common.json#/definitions/ConfidentialLedgerError"
}
}
}
},
"patch": {
"operationId": "ConfidentialLedger_CreateOrUpdateUser",
"x-ms-examples": {
"CreateOrUpdateUser": {
"$ref": "./examples/ledger/CreateOrUpdateUser.json"
}
},
"summary": "Adds a user or updates a user's fields.",
"description": "A JSON merge patch is applied for existing users",
"parameters": [
{
"$ref": "common.json#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/UserIdParameter"
},
{
"$ref": "#/parameters/UserDetailsParameter"
}
],
"responses": {
"200": {
"description": "User created or updated successfully.",
"schema": {
"$ref": "#/definitions/LedgerUser"
}
},
"default": {
"description": "Error response describing why the operation failed",
"schema": {
"$ref": "common.json#/definitions/ConfidentialLedgerError"
}
}
}
}
}
},
"definitions": {
"ConfidentialLedgerEnclaves": {
"description": "Information about the enclaves running the Confidential Ledger.",
"required": [
"currentNodeId",
"enclaveQuotes"
],
"properties": {
"currentNodeId": {
"description": "Id of the Confidential Ledger node responding to the request.",
"$ref": "#/definitions/EntityId"
},
"enclaveQuotes": {
"$ref": "#/definitions/EnclaveQuotes"
}
},
"type": "object"
},
"Consortium": {
"description": "List of members in the consortium.",
"required": [
"members"
],
"properties": {
"members": {
"type": "array",
"items": {
"$ref": "#/definitions/ConsortiumMember"
}
}
},
"type": "object"
},
"ConsortiumMember": {
"description": "Describes a member of the consortium.",
"required": [
"certificate",
"id"
],
"properties": {
"certificate": {
"type": "string",
"description": "PEM-encoded certificate associated with the member."
},
"id": {
"description": "Identifier assigned to the member.",
"$ref": "#/definitions/EntityId"
}
},
"type": "object"
},
"Constitution": {
"description": "The governance script for the application.",
"required": [
"digest",
"script"
],
"properties": {
"digest": {
"description": "SHA256 digest of the constitution script.",
"type": "string"
},
"script": {
"description": "Contents of the constitution.",
"type": "string"
}
},
"type": "object"
},
"EnclaveQuote": {
"description": "Contains the enclave quote.",
"required": [
"nodeId",
"quoteVersion",
"raw"
],
"properties": {
"nodeId": {
"description": "ID assigned to this node.",
"$ref": "#/definitions/EntityId"
},
"mrenclave": {
"description": "MRENCLAVE value of the code running in the enclave.",
"type": "string"
},
"quoteVersion": {
"description": "Version of the quote presented.",
"type": "string"
},
"raw": {
"description": "Raw SGX quote, parsable by tools like Open Enclave's oeverify.",
"type": "string"
}
},
"type": "object"
},
"EnclaveQuotes": {
"description": "Dictionary of enclave quotes, indexed by node id.",
"additionalProperties": {
"$ref": "#/definitions/EnclaveQuote"
},
"type": "object"
},
"EntityId": {
"description": "Identifier for an entity.",
"type": "string"
},
"LedgerEntries": {
"description": "Array of ledger entries.",
"type": "array",
"items": {
"$ref": "#/definitions/LedgerEntry"
}
},
"LedgerEntry": {
"description": "An entry in the ledger.",
"required": [
"contents"
],
"properties": {
"contents": {
"type": "string",
"description": "Contents of the ledger entry."
},
"subLedgerId": {
"$ref": "#/definitions/SubLedgerId",
"readOnly": true
},
"transactionId": {
"$ref": "#/definitions/TransactionId",
"readOnly": true
}
},
"type": "object"
},
"LedgerQueryResult": {
"description": "The result of querying for a ledger entry from an older transaction id. The ledger entry is available in the response only if the returned state is Ready.",
"required": [
"state"
],
"properties": {
"state": {
"$ref": "#/definitions/LedgerQueryState"
},
"entry": {
"description": "The ledger entry found as a result of the query. This is only available if the query is in Ready state.",
"$ref": "#/definitions/LedgerEntry"
}
},
"type": "object"
},
"LedgerQueryState": {
"description": "State of a ledger query.",
"type": "string",
"enum": [
"Loading",
"Ready"
],
"x-ms-enum": {
"name": "ConfidentialLedgerQueryState",
"modelAsString": true
}
},
"LedgerUser": {
"description": "Details about a Confidential Ledger user.",
"required": [
"assignedRole"
],
"properties": {
"assignedRole": {
"$ref": "#/definitions/LedgerUserRole"
},
"userId": {
"$ref": "#/definitions/UserId",
"readOnly": true
}
},
"type": "object"
},
"LedgerUserRole": {
"type": "string",
"description": "Represents an assignable role.",
"enum": [
"Administrator",
"Contributor",
"Reader"
],
"x-ms-enum": {
"name": "ConfidentialLedgerUserRoleName",
"modelAsString": true
}
},
"LedgerWriteResult": {
"description": "Returned as a result of a write to the Confidential Ledger, the transaction id in the response indicates when the write will become durable.",
"required": [
"subLedgerId"
],
"properties": {
"subLedgerId": {
"$ref": "#/definitions/SubLedgerId"
}
},
"type": "object"
},
"MerkleProof": {
"description": "The Merkle proof verifying a transaction.",
"type": "array",
"items": {
"$ref": "#/definitions/MerkleProofElement"
}
},
"MerkleProofElement": {
"description": "An item in the Merkle proof.",
"type": "object",
"properties": {
"left": {
"type": "string"
},
"right": {
"type": "string"
}
}
},
"PagedLedgerEntries": {
"description": "Paginated ledger entries returned in response to a query.",
"type": "object",
"required": [
"state",
"entries"
],
"properties": {
"state": {
"$ref": "#/definitions/LedgerQueryState"
},
"@nextLink": {
"description": "Path from which to retrieve the next page of results.",
"type": "string"
},
"entries": {
"$ref": "#/definitions/LedgerEntries"
}
}
},
"ReceiptContents": {
"description": "A receipt certifying the transaction at the specified id.",
"required": [
"leaf",
"nodeId",
"proof",
"root",
"signature"
],
"type": "object",
"properties": {
"leaf": {
"description": "Merkle tree leaf for this transaction.",
"type": "string"
},
"nodeId": {
"description": "Id of the node returning the receipt.",
"$ref": "#/definitions/EntityId"
},
"proof": {
"description": "Merkle proof.",
"$ref": "#/definitions/MerkleProof"
},
"root": {
"description": "Root of the Merkle tree at the time the transaction was recorded.",
"type": "string"
},
"signature": {
"description": "Signature by the node, with its certificate, over the Merkle root.",
"type": "string"
}
}
},
"RoleAssignment": {
"description": "Object for assigning a role to a user.",
"required": [
"roleName"
],
"properties": {
"roleName": {
"$ref": "#/definitions/LedgerUserRole"
},
"description": {
"description": "Description of the role.",
"type": "string"
}
},
"type": "object"
},
"SubLedgerId": {
"description": "Identifier for sub-ledgers.",
"type": "string"
},
"TransactionId": {
"description": "A unique identifier for the state of the ledger. If returned as part of a LedgerEntry, it indicates the state from which the entry was read.",
"type": "string"
},
"TransactionReceipt": {
"description": "A receipt certifying the transaction at the specified id.",
"required": [
"state",
"transactionId"
],
"properties": {
"receipt": {
"$ref": "#/definitions/ReceiptContents"
},
"state": {
"$ref": "#/definitions/LedgerQueryState"
},
"transactionId": {
"$ref": "#/definitions/TransactionId"
}
},
"type": "object"
},
"TransactionState": {
"type": "string",
"description": "Represents the state of the transaction.",
"enum": [
"Committed",
"Pending"
],
"x-ms-enum": {
"name": "TransactionState",
"modelAsString": true
}
},
"TransactionStatus": {
"description": "Response returned to a query for the transaction status",
"required": [
"state",
"transactionId"
],
"properties": {
"state": {
"$ref": "#/definitions/TransactionState"
},
"transactionId": {
"$ref": "#/definitions/TransactionId"
}
},
"type": "object"
},
"UserId": {
"description": "Identifier for the user. This must either be an AAD object id or a certificate fingerprint.",
"type": "string"
}
},
"parameters": {
"CommitParameter": {
"name": "commit",
"in": "query",
"required": true,
"x-ms-parameter-location": "method",
"maximum": 9223372036854775807,
"minimum": -9223372036854775808,
"type": "integer",
"description": "The commit in the consensus protocol."
},
"SubLedgerIdParameter": {
"name": "subLedgerId",
"in": "query",
"required": false,
"x-ms-parameter-location": "method",
"description": "The sub-ledger id.",
"type": "string"
},
"TransactionIdParameter": {
"name": "transactionId",
"in": "path",
"required": true,
"x-ms-parameter-location": "method",
"description": "Identifies a write transaction.",
"type": "string"
},
"TransactionIdFromParameter": {
"name": "fromTransactionId",
"in": "query",
"required": false,
"x-ms-parameter-location": "method",
"description": "Specify the first transaction ID in a range.",
"type": "string"
},
"TransactionIdToParameter": {
"name": "toTransactionId",
"in": "query",
"required": false,
"x-ms-parameter-location": "method",
"description": "Specify the last transaction ID in a range.",
"type": "string"
},
"UserDetailsParameter": {
"name": "userDetails",
"description": "Details about a Confidential Ledger user.",
"in": "body",
"required": true,
"x-ms-parameter-location": "method",
"schema": {
"$ref": "#/definitions/LedgerUser"
}
},
"UserIdParameter": {
"name": "userId",
"in": "path",
"required": true,
"description": "The user id, either an AAD object ID or certificate fingerprint.",
"type": "string",
"x-ms-parameter-location": "method"
}
}
}