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
+16-21Lines changed: 16 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -61,14 +61,21 @@ namespace Migration {
61
61
@post
62
62
@added(Version.`v1.0-alpha.1`)
63
63
@summary("Import data to server")
64
+
@tag("Sensitive Actions")
64
65
/**
65
-
* //TODO
66
+
* Import a `P2Export` file. `messages` in this file must have been re-signed to the current
67
+
* actor. Only messages classified as ["Information not tied to a specific context"](https://docs.polyphony.chat/Protocol%20Specifications/core/#:~:text=Example%3A%20Information%20not,without%0Aany%20issues.)
68
+
* can be imported.
69
+
* @returns
70
+
* - `202`: The content has been accepted for processing, but processing has not been
@doc("Sensitive actions require a second factor of authentication to be executed. Read [section 4.1.2 of the protocol definition](https://docs.polyphony.chat/Protocol%20Specifications/core/#412-sensitive-actions) for more information.")
* Export all of your data for safekeeping or for importing it to another server
244
-
* @returns - `202` and a key trial, if one still needs to be passed
251
+
* @returns
252
+
* - `202` and a key trial, if one still needs to be passed
245
253
* - `200` and the appropriate data if the key trial has been passed and is not yet expired.
246
-
* The data is a gzipped tarball (.tar.gz) named `export1234567890-user@subdomain.example.com`, where
247
-
* - `export[numbers]` is the word `export` with 20 random digits appended to it
248
-
* - `user` is the actors' name
249
-
* - `subdomain.example.com` is the FQDN of the server the actor is registered on.
250
-
*
251
-
* This file archive contains a file `messages.json` which is a JSON `MessageBatch` of all
252
-
* messages sent by the user. Note the [definition of the word "message" in polyproto](https://docs.polyphony.chat/Protocol%20Specifications/core/#:~:text=software%20for%20clients.-,message%2C%20messages,-%3A%20In%20the%20context).
253
-
* If the server where the data export was requested from has [RawR](https://docs.polyphony.chat/Protocol%20Specifications/core/#731-resource-addressing-with-relative-roots)
254
-
* enabled, the file archive will contain a folder named `rawr`. This folder contains all
255
-
* RawR-content uploaded by the actor to that server. The files in this folder are named after
256
-
* the resource ID. File extensions are only added if they were known to the server. An
257
-
* example file name might be `2c851bfb6daffa944fa1723c7bd4d362ffbc9defe292f2daaf05e895989d179b.jxl`,
258
-
* referencing the file which was hosted at `<server_url>/.p2/core/resource/2c851bfb6daffa944fa1723c7bd4d362ffbc9defe292f2daaf05e895989d179b.jxl`.
254
+
* See the `P2Export` schema for more information.
259
255
* - `204` if the server needs time to gather the data. A `Retry-After` header is included in
260
256
* the response, indicating to the actor the point in time at which they should query this
261
257
* endpoint again. If this point in time is after the expiry timestamp of the completed key trial,
@@ -267,7 +263,7 @@ namespace Migration {
267
263
@bodybody:polyproto.core.models.KeyTrial;
268
264
} | {
269
265
@statusCodestatusCode:200;
270
-
@bodybody:File;
266
+
@bodybody:polyproto.core.models.P2Export;
271
267
} | {
272
268
@statusCodestatusCode:204;
273
269
@header({name:"Retry-After"}) retryAfter:uint64;
@@ -276,6 +272,5 @@ namespace Migration {
276
272
}
277
273
278
274
/* TODO things that are missing:
279
-
* - RawR routes
280
275
- The description of the RawR .tar.gz file format could be added into the p2 spec
0 commit comments