Skip to content

Commit e3cfea7

Browse files
eddyashtonMahatiCmikeharder
authored andcommitted
Managed CCF governance API (Azure#23627)
* Rebase with current mCCF gov TypeSpec * Update config, initial build * Managed CCF governance API * Update with current state from CCF repo (Renaming CADL to TypeSpec) * Move files around, and create a minimal `readme.md` * Prettier * Update from CCF main, initial errors, and formatting * Remove prev version * Update autorest README * Spell check and small linters * Drop to supported types for spec validation * Add JWTs to custom-words * Move file, use output-file arg * Correct README name, remove unused package * Pull in latest changes * Latest changes and re-generate * Clearer operation names * Pull latest changes * Rename for consistency, and pull latest changes * Regenerate OpenAPI at correct path * Initial auto-generated examples * Correct visibility * Working towards canonical examples * Improve examples * Rename fles * Ah, build puts these in second location * Improve proposal examples * Pull latest: Mark more optionals, correct discriminator use, fix example-errors * More tweaks to exmaples * Latest * Combine readmes * Format and custom-words * Add missing field * Latest: Verb'd operation IDs * Latest: Remove readOnlys * Rename to restore actions * Rename in source too * Latest, update examples * Fix warnings and rebuild with latest version * Add ManagedCcf to CI pipeline * Suppress doc-required for Versions, remove local package.json * Build with 0.45.0 again * Add specification/confidentialledger to PR trigger * tsp format --------- Co-authored-by: Mahati Chamarthy <[email protected]> Co-authored-by: Mike Harder <[email protected]>
1 parent 495a11f commit e3cfea7

File tree

59 files changed

+4113
-1
lines changed

Some content is hidden

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

59 files changed

+4113
-1
lines changed

custom-words.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2825,6 +2825,9 @@ Metadatas
28252825
Gtid
28262826
GTID
28272827
gtid
2828+
Acks
2829+
safeuint
2830+
JWTs
28282831
Wifi
28292832
Nwfs
28302833
Hnsw
@@ -2844,4 +2847,4 @@ manytomany
28442847
stransparent
28452848
forceencryption
28462849
tlsciphers
2847-
tlsprotocols
2850+
tlsprotocols

eng/pipelines/typespec-ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pr:
1616
- eng/pipelines/templates/steps/typespec-ci.yml
1717
- specification/contosowidgetmanager
1818
- specification/cognitiveservices
19+
- specification/confidentialledger
1920
- specification/containerservice
2021
- specification/servicenetworking
2122
- specification/translation
@@ -69,6 +70,11 @@ jobs:
6970
Folder: specification/cognitiveservices/OpenAI.Inference
7071
DisplayName: OpenAI.Inference
7172

73+
- template: templates/steps/typespec-ci.yml
74+
parameters:
75+
Folder: specification/confidentialledger/Microsoft.ManagedCcf
76+
DisplayName: ManagedCcf
77+
7278
- template: templates/steps/typespec-ci.yml
7379
parameters:
7480
Folder: specification/containerservice/Fleet.Management
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import "@typespec/rest";
2+
import "@typespec/versioning";
3+
import "@azure-tools/typespec-azure-core";
4+
5+
import "./common.tsp";
6+
import "./cose.tsp";
7+
8+
@TypeSpec.Http.route("/gov/members")
9+
namespace Microsoft.ManagedCcf.Acks;
10+
11+
@doc("A compact summary of the service's state up to a certain point in time, updated and signed by members to indicate their participation in and approval of the service.")
12+
@TypeSpec.Rest.resource("state-digests")
13+
model StateDigest {
14+
@doc("Identifier for member this stateDigest applies to.")
15+
@visibility("query")
16+
@key
17+
memberId: memberId;
18+
19+
@doc("Hex-encoding of SHA-256 hash of the root of the service's merkle tree. This should be signed by a new member and submitted as an ACK to mark that member as Active.")
20+
@pattern("^[a-f0-9]{64}$")
21+
digest: string;
22+
}
23+
24+
interface StateDigests {
25+
@doc("Request that this member's stateDigest is updated to a fresher value. Only this member may update their own stateDigest. Returns the refreshed value.")
26+
@TypeSpec.Rest.action("update")
27+
update is Azure.Core.StandardResourceOperations.ResourceAction<
28+
StateDigest,
29+
CoseSigned,
30+
StateDigest,
31+
TxIdWriteHeader
32+
>;
33+
34+
@doc("Submit a signed acknowledgement of a recent digest of the service status, to transition the member to Active.")
35+
@TypeSpec.Rest.action("ack")
36+
acknowledge is Azure.Core.StandardResourceOperations.ResourceAction<
37+
StateDigest,
38+
CoseSigned<StateDigest>,
39+
TypeSpec.Http.NoContentResponse,
40+
TxIdWriteHeader
41+
>;
42+
43+
@doc("Get the stateDigest assigned to the given member, which that member must sign to become active.")
44+
get is Azure.Core.StandardResourceOperations.ResourceRead<
45+
StateDigest,
46+
TxIdReadHeader
47+
>;
48+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import "@typespec/http";
2+
import "@azure-tools/typespec-azure-core";
3+
4+
namespace Microsoft.ManagedCcf;
5+
6+
alias transactionIdHeaderField = "x-ms-ccf-transaction-id";
7+
8+
@doc("Uniquely identifies an atomic transaction within a CCF service. Composed of a term number and sequence number. Sequence numbers increase monotonically, apart from during elections where the service may reuse an existing sequence number. Each election will result in a new, higher term number being used for the conflicting and future sequence numbers.")
9+
@pattern("^[0-9]+\\.[0-9]+$")
10+
scalar transactionId extends string;
11+
12+
alias TxIdWriteHdr = {
13+
@doc("Identifier for transaction where this request produced a write on the service. This uniquely identifies the submitted request, and can be used to confirm that the request becomes committed.")
14+
@TypeSpec.Http.header(transactionIdHeaderField)
15+
transactionId: transactionId;
16+
};
17+
18+
alias TxIdWriteHeader = Azure.Core.Traits.ResponseHeadersTrait<TxIdWriteHdr>;
19+
20+
alias TxIdReadHdr = {
21+
@doc("Identifier for transaction this response was read from. The service state may be altered by other write requests. Reads at the same transactionId describe a consistent single point in the service history.")
22+
@TypeSpec.Http.header(transactionIdHeaderField)
23+
transactionId: transactionId;
24+
};
25+
26+
alias TxIdReadHeader = Azure.Core.Traits.ResponseHeadersTrait<TxIdReadHdr>;
27+
28+
alias JavaScriptSource = {
29+
@doc("This contains raw JavaScript source code, not escaped into a JSON object.")
30+
@TypeSpec.Http.header("content-type")
31+
contentType: "text/javascript";
32+
};
33+
34+
@doc("Hex encoding of SHA-256 of a node's public key.")
35+
@pattern("^[a-f0-9]{64}$")
36+
scalar nodeId extends string;
37+
38+
@doc("Hex encoding of SHA-256 of a member certificate's fingerprint.")
39+
@pattern("^[a-f0-9]{64}$")
40+
scalar memberId extends string;
41+
42+
@doc("Hex encoding of SHA-256 of user certificate's fingerprint.")
43+
@pattern("^[a-f0-9]{64}$")
44+
scalar userId extends string;
45+
46+
@doc("Hex encoding of SHA-256 of proposed actions and merkle root of store at proposal creation. Unlike other IDs, this is generated on the service and will not be known in advance.")
47+
@pattern("^[a-f0-9]{64}$")
48+
scalar proposalId extends string;
49+
50+
@doc("A non-negative JSON-safe integer (ie max is 2^53 - 1)")
51+
@minValue(0)
52+
scalar safeuint extends safeint;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import "@typespec/http";
2+
3+
@doc("HTTP request containing a COSE signature")
4+
model CoseSignature {
5+
@doc("The MIME content type for all auditable member actions is application/cose, containing a CoseSign1 signature.")
6+
@TypeSpec.Http.header("content-type")
7+
contentType: "application/cose";
8+
9+
@doc("A raw CoseSign1 signature. See CCF docs for required headers and body schema: https://microsoft.github.io/CCF/main/use_apps/issue_commands.html#cose-schemas")
10+
@TypeSpec.Http.body
11+
body: bytes;
12+
}
13+
14+
model CoseSigned<T = {}> extends CoseSignature {}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"title": "Ballots_Get",
3+
"operationId": "Ballots_Get",
4+
"parameters": {
5+
"api-version": "2023-06-01-preview",
6+
"proposalId": "1c04c5bb4bdc207dbf35bc4b32dbf92cbc23eabb34a6e8b163b2de2c7833e87b",
7+
"memberId": "f8ac7c60c164f7f13c04ba41645b18eabcc55a8f799c83a90d001f4e89907970"
8+
},
9+
"responses": {
10+
"200": {
11+
"body": {
12+
"script": "export function vote (rawProposal, proposerId) { return true }"
13+
}
14+
}
15+
}
16+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"title": "Ballots_Submit",
3+
"operationId": "Ballots_Submit",
4+
"parameters": {
5+
"api-version": "2023-06-01-preview",
6+
"proposalId": "1c04c5bb4bdc207dbf35bc4b32dbf92cbc23eabb34a6e8b163b2de2c7833e87b",
7+
"memberId": "f8ac7c60c164f7f13c04ba41645b18eabcc55a8f799c83a90d001f4e89907970",
8+
"body": "{binary COSE Sign1}"
9+
},
10+
"responses": {
11+
"200": {
12+
"body": {
13+
"proposalId": "1c04c5bb4bdc207dbf35bc4b32dbf92cbc23eabb34a6e8b163b2de2c7833e87b",
14+
"proposerId": "f8ac7c60c164f7f13c04ba41645b18eabcc55a8f799c83a90d001f4e89907970",
15+
"proposalState": "Open",
16+
"ballotCount": 2,
17+
"finalVotes": {
18+
"f8ac7c60c164f7f13c04ba41645b18eabcc55a8f799c83a90d001f4e89907970": true,
19+
"b9626e3856b3ef3b433e612d59fbb9edd71cfa2efc772bcfbb50aaa9b6e033f7": false
20+
}
21+
}
22+
}
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"title": "EncryptedShares_Get",
3+
"operationId": "EncryptedShares_Get",
4+
"parameters": {
5+
"api-version": "2023-06-01-preview",
6+
"memberId": "f8ac7c60c164f7f13c04ba41645b18eabcc55a8f799c83a90d001f4e89907970"
7+
},
8+
"responses": {
9+
"200": {
10+
"body": {
11+
"encryptedShare": "ZW5jcnlwdGVkU2hhcmUx"
12+
}
13+
}
14+
}
15+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"title": "Proposals_Create",
3+
"operationId": "Proposals_Create",
4+
"parameters": {
5+
"api-version": "2023-06-01-preview",
6+
"body": "{binary COSE Sign1}"
7+
},
8+
"responses": {
9+
"200": {
10+
"body": {
11+
"proposalId": "1c04c5bb4bdc207dbf35bc4b32dbf92cbc23eabb34a6e8b163b2de2c7833e87b",
12+
"proposerId": "f8ac7c60c164f7f13c04ba41645b18eabcc55a8f799c83a90d001f4e89907970",
13+
"proposalState": "Open",
14+
"ballotCount": 0,
15+
"finalVotes": {}
16+
}
17+
}
18+
}
19+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"title": "Proposals_Get",
3+
"operationId": "Proposals_Get",
4+
"parameters": {
5+
"api-version": "2023-06-01-preview",
6+
"proposalId": "1c04c5bb4bdc207dbf35bc4b32dbf92cbc23eabb34a6e8b163b2de2c7833e87b"
7+
},
8+
"responses": {
9+
"200": {
10+
"body": {
11+
"proposalId": "1c04c5bb4bdc207dbf35bc4b32dbf92cbc23eabb34a6e8b163b2de2c7833e87b",
12+
"proposerId": "f8ac7c60c164f7f13c04ba41645b18eabcc55a8f799c83a90d001f4e89907970",
13+
"proposalState": "Open",
14+
"ballotCount": 2,
15+
"finalVotes": {
16+
"f8ac7c60c164f7f13c04ba41645b18eabcc55a8f799c83a90d001f4e89907970": true,
17+
"b9626e3856b3ef3b433e612d59fbb9edd71cfa2efc772bcfbb50aaa9b6e033f7": false
18+
}
19+
}
20+
}
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"title": "Proposals_GetActions",
3+
"operationId": "Proposals_GetActions",
4+
"parameters": {
5+
"api-version": "2023-06-01-preview",
6+
"proposalId": "1c04c5bb4bdc207dbf35bc4b32dbf92cbc23eabb34a6e8b163b2de2c7833e87b"
7+
},
8+
"responses": {
9+
"200": {
10+
"body": {
11+
"actions": [
12+
{
13+
"name": "set_member",
14+
"args": {
15+
"cert": "-----BEGIN CERTIFICATE-----\nMIIBtzCCATygAwIBAgIUYqXLFcT1aCENVpgp2K+Vv53cauEwCgYIKoZIzj0EAwMw\nEjEQMA4GA1UEAwwHbWVtYmVyMzAeFw0yMzA1MTcxMzUwMzJaFw0yNDA1MTYxMzUw\nMzJaMBIxEDAOBgNVBAMMB21lbWJlcjMwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQI\ngWV8Lcf+eegGXVj1I4N8jWcfTb6MRt0Znl8aFOBBwZ5lgRlTePYLHBb81wOJaX+k\nIYqHRaI3Wblg72gV/dhf4qBYw9ENqJtE2ClenYkRFAX2/1GwjxTOf9XGpBUt5Rij\nUzBRMB0GA1UdDgQWBBT7oAebRrqSDSG89jW0nFF5fHRRTzAfBgNVHSMEGDAWgBT7\noAebRrqSDSG89jW0nFF5fHRRTzAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49BAMD\nA2kAMGYCMQCmCKWLEbCooecDiuMyUf/B2vppNZ75U96B2ypg88Xy5y4xhRV1qoCT\nRT4sUCFl6ioCMQCKm0df2DzlRbhX6+0i6KikBkUf9kFowb5ctikJsym0rTigpPZC\nHaZlaQD2pNBud/0=\n-----END CERTIFICATE-----\n",
16+
"encryption_pub_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzIh4oWoiTFCu/8tsfmo9\njTDryaTrL7wo8+HJAGUTL827CiZ8Rm9wgo7iJDOza7UPaPnXpR6kIlZbdItDOx9k\nmJSVWbDMufaqqs+y/i+WrTiDqL02zbT/lI4kx5l7Wyu0VEHT5GmSKQiVyJt/Q4vE\n1b9rKNy3Ol1g5VuW9PKOHFz3tvjWksVWXi16qulN3IjAhSFVRtasbqdNSNdDbirv\nLTe24Y9v7UP8CI3qgjr3x8qLYM/X0ou4ZcJvXWVtxZfQLGVgyZcgHD6OtbYJr9Iy\neh/x+G3pPFg2eQY8xNZgqqtH1StKcI++eD7iSDosKRkN3efCKLeKStg6F/xluarc\nkQIDAQAB\n-----END PUBLIC KEY-----\n"
17+
}
18+
}
19+
]
20+
}
21+
}
22+
}
23+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"title": "Proposals_List",
3+
"operationId": "Proposals_List",
4+
"parameters": {
5+
"api-version": "2023-06-01-preview"
6+
},
7+
"responses": {
8+
"200": {
9+
"body": {
10+
"value": [
11+
{
12+
"proposalId": "1c04c5bb4bdc207dbf35bc4b32dbf92cbc23eabb34a6e8b163b2de2c7833e87b",
13+
"proposerId": "f8ac7c60c164f7f13c04ba41645b18eabcc55a8f799c83a90d001f4e89907970",
14+
"proposalState": "Open",
15+
"ballotCount": 2,
16+
"finalVotes": {
17+
"f8ac7c60c164f7f13c04ba41645b18eabcc55a8f799c83a90d001f4e89907970": true,
18+
"b9626e3856b3ef3b433e612d59fbb9edd71cfa2efc772bcfbb50aaa9b6e033f7": false
19+
}
20+
}
21+
],
22+
"nextLink": "https://microsoft.com/avwpnzmy"
23+
}
24+
}
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"title": "Proposals_Withdraw",
3+
"operationId": "Proposals_Withdraw",
4+
"parameters": {
5+
"api-version": "2023-06-01-preview",
6+
"proposalId": "1c04c5bb4bdc207dbf35bc4b32dbf92cbc23eabb34a6e8b163b2de2c7833e87b",
7+
"body": "{binary COSE Sign1}"
8+
},
9+
"responses": {
10+
"200": {
11+
"body": {
12+
"proposalId": "1c04c5bb4bdc207dbf35bc4b32dbf92cbc23eabb34a6e8b163b2de2c7833e87b",
13+
"proposerId": "f8ac7c60c164f7f13c04ba41645b18eabcc55a8f799c83a90d001f4e89907970",
14+
"proposalState": "Withdrawn",
15+
"ballotCount": 2,
16+
"finalVotes": {
17+
"f8ac7c60c164f7f13c04ba41645b18eabcc55a8f799c83a90d001f4e89907970": true,
18+
"b9626e3856b3ef3b433e612d59fbb9edd71cfa2efc772bcfbb50aaa9b6e033f7": false
19+
}
20+
}
21+
}
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"title": "ServiceState_GetConstitution",
3+
"operationId": "ServiceState_GetConstitution",
4+
"parameters": {
5+
"api-version": "2023-06-01-preview"
6+
},
7+
"responses": {
8+
"200": {
9+
"body": {
10+
"constitution": "export function validate(input) {\n ...\n}\n\nexport function resolve(proposal, proposerId, votes) {\n ...\n}\n\nexport function apply(proposal, proposalId) {\n ...\n}\n"
11+
}
12+
}
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"title": "ServiceState_GetJoinPolicies",
3+
"operationId": "ServiceState_GetJoinPolicies",
4+
"parameters": {
5+
"api-version": "2023-06-01-preview"
6+
},
7+
"responses": {
8+
"200": {
9+
"body": {
10+
"sgx": {
11+
"measurements": [
12+
"cs/RoNCp2UCxpN+i1UnVYw=="
13+
]
14+
},
15+
"snp": {
16+
"measurements": [
17+
"XqJZLOA9/xCx9nnsDch4vw=="
18+
],
19+
"hostData": {
20+
"key9497": "NiNrjmA9/aSj4F076mVdrA=="
21+
},
22+
"uvmEndorsements": {
23+
"key9553": "cbneXARxfLGcqw3cc09mYQ=="
24+
}
25+
}
26+
}
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)