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

Commit 0e17298

Browse files
committed
Define the polyproto import/export format for moving data
1 parent dfd6019 commit 0e17298

File tree

1 file changed

+43
-5
lines changed
  • docs/Protocol Specifications

1 file changed

+43
-5
lines changed

docs/Protocol Specifications/core.md

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ of the specification document: **v0.1.0-alpha.1**
5555
- [7.2.2.2 Interval between re-signing batches](#7222-interval-between-re-signing-batches)
5656
- [7.3 Moving data](#73-moving-data)
5757
- [7.3.1 Resource Addressing with relative roots](#731-resource-addressing-with-relative-roots)
58+
- [7.3.2 polyproto export/import format](#732-polyproto-exportimport-format)
5859
- [7.4 Challenges and trust](#74-challenges-and-trust)
5960
- [8. Protocol extensions (P2 extensions)](#8-protocol-extensions-p2-extensions)
6061
- [8.1 Extension design](#81-extension-design)
@@ -1071,7 +1072,7 @@ specific context, which is unavailable on the new server.
10711072
of the chat application. Typically, the messages in a group chat are stored on the server
10721073
hosting the group. Moving the messages of one individual from one server to another is not
10731074
possible in these cases.
1074-
1075+
<a name="example-static-information" id="example-static-information"></a>
10751076
!!! example "Example: Information not necessarily tied to a specific context"
10761077

10771078
Continuing the chat application example, it might very well be possible to move messages
@@ -1310,10 +1311,15 @@ between re-signing batches.
13101311
### 7.3 Moving data
13111312

13121313
In cases of an imminent server shutdown or distrust in the old server, moving data from the old server
1313-
is necessary to prevent data loss. This process extends upon the reassigning ownership process, and
1314+
is necessary to prevent data loss.
1315+
1316+
Note, that only ["static" resources](#example-static-information) can be moved. "Dynamic" resources,
1317+
which are resources tied to a specific context, can be migrated through [re-signing messages](#72-re-signing-messages).
1318+
1319+
This process extends upon the reassigning ownership process, and
13141320
usually involves the following steps:
13151321

1316-
1. Using the old account, the client requests a data export from your old home server.
1322+
1. Using the old account, the client requests a data export from their old home server.
13171323
2. The old home server sends a data export to the client. The client will check the signatures on
13181324
the exported data, to ensure it was not tampered with.
13191325
3. The new account re-signs the data with its own keys and imports it into the new home server.
@@ -1344,8 +1350,7 @@ aa-xsa: Deactivate account
13441350

13451351
*Fig. 8: Sequence diagram depicting the data moving process.*
13461352

1347-
How this process is implemented is up to P2 extensions to define. The above steps are only a
1348-
guideline. The API routes for data export and import are documented in the
1353+
The API routes for data export and import are documented in the
13491354
[API documentation](https://apidocs.polyproto.org)
13501355

13511356
#### 7.3.1 Resource Addressing with relative roots
@@ -1385,6 +1390,39 @@ Servers with no need for resource addressing with relative roots can select to n
13851390
feature. Servers not implementing this feature should return a `404 Not Found` status code when
13861391
the API route is accessed. Clients should expect finding servers not implementing this feature.
13871392

1393+
#### 7.3.2 polyproto export/import format
1394+
1395+
Data exports and -imports must use the polyproto export/import format. Home servers are required to
1396+
support this format when actors perform data exports and imports.
1397+
1398+
The data is a [gzipped](https://en.wikipedia.org/wiki/Gzip) [tarball](https://en.wikipedia.org/wiki/Tar_(computing))
1399+
archive (.tar.gz) named `[email protected]`, where
1400+
1401+
- `export[numbers]` is the word `export` with 20 random digits appended to it
1402+
- `user` is the actors' name
1403+
- `subdomain.example.com` is the FQDN of the server the actor is registered on.
1404+
1405+
This file archive contains a file `messages.p2mb` which is a JSON file containing [message batches](#721-message-batches)
1406+
of all messages sent by the user. If the server where the data export was requested from has
1407+
[RawR](#731-resource-addressing-with-relative-roots) enabled, the file archive will contain a
1408+
folder named `rawr`. This folder contains all RawR content uploaded by the actor to that server.
1409+
The files in this folder are named after the resource ID given to the resource.
1410+
File extensions are only added if they were known to the server.
1411+
1412+
!!! example
1413+
1414+
An example file name might be
1415+
`2c851bfb6daffa944fa1723c7bd4d362ffbc9defe292f2daaf05e895989d179b.jxl`, referencing the file
1416+
which was hosted at `<server_url>/.p2/core/resource/2c851bfb6daffa944fa1723c7bd4d362ffbc9defe292f2daaf05e895989d179b.jxl`.
1417+
1418+
If the server where the data export was requested from is the actors' home server, the
1419+
archive will contain a folder `certs` and a file `crypt_certs.p2epk`. `certs` will contain all ID-Certs
1420+
the server has stored of the actor. The ID-Certs will be stored in
1421+
[ASCII PEM format](https://web.archive.org/web/20250107131731/https://learn.microsoft.com/en-us/azure/iot-hub/reference-x509-certificates#:~:text=ASN.1%20encoding.-,ascii%20pem%20format,-A%20PEM%20certificate)
1422+
The file `crypt_certs.p2epk` contains all [encrypted private key material](#63-private-key-loss-prevention-and-private-key-recovery)
1423+
that the actor has uploaded to the server. Just like `messages.p2mb`, `crypt_certs.p2epk` is a standard
1424+
JSON file.
1425+
13881426
### 7.4 Challenges and trust
13891427

13901428
Changing the publicly visible ownership of actor data requires the chain of trust to be maintained.

0 commit comments

Comments
 (0)