You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 15, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: api/src/core/routes/migration.tsp
+76-58Lines changed: 76 additions & 58 deletions
Original file line number
Diff line number
Diff line change
@@ -24,32 +24,49 @@ namespace Migration {
24
24
* to move to another home server. To fulfill this action,
25
25
*
26
26
* 1. A key trial must be passed
27
+
* // TODO: Must it? If yes, specify for which cert(s) ^
27
28
* 2. The "new" actor named in this request must confirm setting up this redirect.
28
29
*
29
30
* @returns
30
31
* - `200` if the link has been created
31
-
* - `202` if the other account still needs to accept to establish the link. Contains a key trial
32
+
* - `202` if the other account still needs to accept to establish the link.
32
33
* @paramnewActorFid The FID of the actor, that this actor would like to be redirected to.
33
34
*/
34
35
@route("/redirect")
35
36
@post
36
37
@added(Version.`v1.0-beta.1`)
37
38
@summary("Set up a redirect for migrating identities")
38
-
opsetupRedirect(@bodynewActorFid:string): {
39
+
opsetupRedirect(
40
+
@bodynewActorFid:string,
41
+
42
+
@doc("A completed `KeyTrial`.")
43
+
@header({
44
+
name:"X-P2-core-keytrial",
45
+
})
46
+
keyTrial:polyproto.core.models.KeyTrialCompleted,
47
+
): {
39
48
@statusCodestatusCode:200 | 202;
40
-
@bodybody:polyproto.core.models.KeyTrial;
41
49
};
42
50
43
51
/**
44
-
* Stop an in-progress or existing redirection process.
45
-
* @returns A key trial
52
+
* Stop an in-progress or existing redirection process. Requires a completed key trial.
53
+
* // TODO: Does it? ^ If yes, specify for which cert(s)
54
+
*
46
55
* @paramremoveActorFid The FID of the actor to which a redirect should no longer exist
47
56
*/
48
57
@route("/redirect")
49
58
@delete
50
59
@added(Version.`v1.0-beta.1`)
51
60
@summary("Remove a redirect for migrating identities")
52
-
opremoveRedirect(@queryremoveActorFid:string): {
61
+
opremoveRedirect(
62
+
@queryremoveActorFid:string,
63
+
64
+
@doc("A completed `KeyTrial`.")
65
+
@header({
66
+
name:"X-P2-core-keytrial",
67
+
})
68
+
keyTrial:polyproto.core.models.KeyTrialCompleted,
69
+
): {
53
70
@statusCodestatusCode:200;
54
71
@bodybody:polyproto.core.models.KeyTrial;
55
72
} | {
@@ -79,6 +96,7 @@ namespace Migration {
79
96
@bodyimportData?:polyproto.core.models.P2Export,
80
97
): {
81
98
@statusCodestatusCode:202;
99
+
82
100
@header({
83
101
name:"Content-Length",
84
102
})
@@ -118,6 +136,7 @@ namespace Migration {
118
136
@statusCodestatusCode:404;
119
137
} | {
120
138
@statusCodestatusCode:204;
139
+
121
140
@header({
122
141
name:"Content-Length",
123
142
})
@@ -126,7 +145,6 @@ namespace Migration {
126
145
127
146
/**
128
147
* Request allowing message re-signing. To fulfill this action, a key trial must be passed.
129
-
* @returns a key trial
130
148
* @paramallowedResigningKeys List of PEM encoded `SubjectPublicKeyInfo`s. Only key pairs mentioned in this list are allowed to re-sign messages after the key trial has been passed.
131
149
*/
132
150
@route("/messages")
@@ -138,16 +156,24 @@ namespace Migration {
138
156
newActorFid:string;
139
157
allowedResigningKeys:string[];
140
158
},
159
+
160
+
@doc("A completed `KeyTrial`.")
161
+
@header({
162
+
name:"X-P2-core-keytrial",
163
+
})
164
+
keyTrial:polyproto.core.models.KeyTrialCompleted, // TODO doesnt this have to be an array?
141
165
): {
142
-
@statusCodestatusCode:200;
143
-
@bodybody:polyproto.core.models.KeyTrial;
166
+
@statusCodestatusCode:200 | 403;
144
167
};
145
168
146
169
/**
147
170
* Commit messages that have been re-signed to the server.
148
171
* @parammessages Messages. The distinct format of messages is up to the specific p2 extension to define.
149
172
* @returns
150
-
* - `200` On success
173
+
* - `200` On success. Returns another `MessageBatch`, if there are more messages to re-sign.
174
+
* If this endpoint is queried again while
175
+
* the previous batch of messages has not yet been re-signed (or only partially so), the
176
+
* returned message batch will contain those uncommitted messages again.
151
177
* - `400` if re-signed messages are improperly formatted
152
178
* - `403` if messages have been modified where the original keys have not passed the key
153
179
* trial, if a key trial has not been passed at all or if the messages have been signed
@@ -167,22 +193,34 @@ namespace Migration {
167
193
name:"Retry-After",
168
194
})
169
195
retryAfter:uint16;
196
+
197
+
@doc("This header tells the client whether the route to commit re-signed messages has an upload size limit, and what the size of that limit is. A value of `0` means that there is no limit. This header not being present can also be interpreted as no limit existing.")
198
+
@header({
199
+
name:"X-P2-Return-Body-Size-Limit ",
200
+
})
201
+
sizeLimit?:uint64;
202
+
203
+
@doc("Another message batch, if there are still messages left to re-sign.")
@doc("This header tells the client whether the route to commit re-signed messages has an upload size limit, and what the size of that limit is. A value of `0` means that there is no limit. This header not being present can also be interpreted as no limit existing.")
@@ -196,39 +234,6 @@ namespace Migration {
196
234
@statusCodestatusCode:403;
197
235
};
198
236
199
-
/**
200
-
* Complete a key trial. After the successful completion of the key trial, the action that
201
-
* required this key trial to be performed may be executed until the `expires` UNIX timestamp
202
-
* of the key trial has been reached. After that point, another key trial must be performed
203
-
* before executing the action.
204
-
*
205
-
* If only a subset of all trialed keys had a trial completed for them, the server must only
206
-
* allow changes which concern information tied to these exact keys.
207
-
*
208
-
* @parambody Completed key trials.
209
-
* @returns
210
-
* - `200` if the key trials were processed and deemed to be valid
211
-
* - `202`, if the server needs additional time to process the key trials
212
-
* - `400`, if one or more completed key trials were faulty. Contains faulty key trials in the response body.
@doc("Returns `200` if the key trials were processed and deemed to be valid. Returns `202`, if the server needs additional time to process the key trials.")
222
-
@statusCode
223
-
statusCode:202 | 200;
224
-
} | {
225
-
@doc("Received if one or more completed key trials were faulty. Contains faulty key trials in the response body.")
keyTrial:polyproto.core.models.KeyTrialCompleted, // TODO: Must be array. re-evaluate if keytrial responses should be part of header. i think they are better suited as a body
305
+
): {
294
306
@statusCodestatusCode:204;
307
+
295
308
@header({
296
309
name:"Content-Length",
297
310
})
298
311
contentLength:0;
312
+
} | {
313
+
@statusCodestatusCode:403 | 401;
299
314
};
300
315
301
316
/**
302
-
* Export all of your data for safekeeping or for importing it to another server
317
+
* Export all of your data for safekeeping or for importing it to another server.
303
318
* @returns
304
-
* - `202` and a key trial, if one still needs to be passed
305
319
* - `200` and the appropriate data if the key trial has been passed and is not yet expired.
306
320
* See the `P2Export` schema for more information.
307
321
* - `204` if the server needs time to gather the data. A `Retry-After` header is included in
0 commit comments