Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Commit 6e51766

Browse files
committed
Change format of message batches according to spec
1 parent 2c3c0e5 commit 6e51766

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

api/src/core/main.tsp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,22 @@ namespace models {
9292
@doc("The serial number of the ID-Cert corresponding to the private identity key used to sign the key trial string.")
9393
serial_number: uint64;
9494
}
95+
96+
/**
97+
* A message batch, as received from and sent to the server in the context of re-signing messages.
98+
* This type is generic over `T`, where `T` represents the content of the actual message. This
99+
* means, that the specific message content depends on the concrete implementation or extension
100+
* of the polyproto protocol.
101+
*/
102+
model MessageBatch<T> {
103+
@doc("The ID-Cert that the following messages' signatures correspond to.")
104+
idCert: string,
105+
@doc("The actual message.")
106+
messages: {
107+
@doc("Signature of the whole message")
108+
signature: string,
109+
@doc("Arbitrary content `T`. This depends on the specific implementation or extension of the protocol.")
110+
content: T
111+
}[];
112+
}
95113
}

api/src/core/routes/main.tsp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ namespace Migration {
456456
* @param messages Messages. The distinct format of messages is up to the specific p2 extension to define.
457457
* @returns `200` On success; `400` if re-signed messages are improperly formatted; `403` if messages have been modified where the original keys have not passed the key trial, if a key trial has not been passed at all or if the messages have been signed with keys that were not on the `allowedResigningKeys` list.
458458
*/
459-
op commitMessages(@body messages: string[]): {
459+
op commitMessages(@body messages: polyproto.core.models.MessageBatch<string>): {
460460
@statusCode statusCode: 200 | 400 | 403;
461461
};
462462

@@ -471,7 +471,7 @@ namespace Migration {
471471
*/
472472
op getMessages(@query limit?: uint32 = 100): {
473473
@statusCode statusCode: 200;
474-
@body message: string;
474+
@body message: polyproto.core.models.MessageBatch<string>;
475475
} | {
476476
@statusCode statusCode: 403;
477477
};

0 commit comments

Comments
 (0)