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

Commit b21d31b

Browse files
committed
2 parents da07674 + e71028f commit b21d31b

File tree

16 files changed

+2009
-608
lines changed

16 files changed

+2009
-608
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
name: docs/mkdocs issue report
3+
about: Report a bug or an issue concerning the website generated with mkdocs-material.
4+
title: "[docs]"
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**Screenshots**
14+
If applicable, add screenshots to help explain your problem.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
name: 'polyproto: Specification/API documentation issue report'
3+
about: Report a bug or mistake concerning the polyproto specification document or
4+
API documentation.
5+
title: "[p2spec]"
6+
labels: ''
7+
assignees: ''
8+
9+
---
10+
11+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: TypeSpec project issue report
3+
about: Report a bug, an issue or an inconsistency with the TypeSpec (.tsp) projects.
4+
title: "[typespec]"
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+

.vscode/ltex.dictionary.en-US.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ NLnet
2222
OpenAPI
2323
TypeSpec
2424
Protobuf
25+
gzipped
26+
RawR
27+
OID
28+
apidocs

.vscode/ltex.hiddenFalsePositives.en-US.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,13 @@
5656
{"rule":"MORFOLOGIK_RULE_EN_US","sentence":"^\\QSee \\E(?:Dummy|Ina|Jimmy-)[0-9]+\\Q\nFederation ID - A unique identifier; In public contexts, usually **actor@**subdomain.example.com, where bolded parts are required and non-bolded parts are optional.\\E$"}
5757
{"rule":"ADMIT_ENJOY_VB","sentence":"^\\QThe following sections are dedicated to documenting best practices to consider when implementing polyproto.\\E$"}
5858
{"rule":"ADMIT_ENJOY_VB","sentence":"^\\QThe following subsections are dedicated to documenting best practices to consider when implementing polyproto.\\E$"}
59+
{"rule":"MORFOLOGIK_RULE_EN_US","sentence":"^\\QThe data is a gzipped tarball archive (.tar.gz) named \\E(?:Dummy|Ina|Jimmy-)[0-9]+\\Q, where\\E$"}
60+
{"rule":"ADMIT_ENJOY_VB","sentence":"^\\QIt is also recommended to back up the encrypted private identity keys in some other secure location.\\E$"}
61+
{"rule":"EN_A_VS_AN","sentence":"^\\QCommunicating the body size limit is done by adding an \\E(?:Dummy|Ina|Jimmy-)[0-9]+\\Q header to the response.\\E$"}
62+
{"rule":"ANY_BODY","sentence":"^\\QIf this header is not present or has a value of \\E(?:Dummy|Ina|Jimmy-)[0-9]+\\Q, clients should assume that there is no body size limit.\\E$"}
63+
{"rule":"EN_A_VS_AN","sentence":"^\\QThe session ID is an \\E(?:Dummy|Ina|Jimmy-)[0-9]+\\Q \\E(?:Dummy|Ina|Jimmy-)[0-9]+\\Q chosen by the actor requesting the ID-Cert.\\E$"}
64+
{"rule":"REPEATED_VERBS","sentence":"^\\Q\\E(?:Dummy|Ina|Jimmy-)[0-9]+\\Q Server Certificate Change Actor Receive Received when the server's certificate changed.\\E$"}
65+
{"rule":"REPEATED_VERBS","sentence":"^\\Q\\E(?:Dummy|Ina|Jimmy-)[0-9]+\\Q Hello Actor Receive Received upon establishing a connection.\\E$"}
66+
{"rule":"REPEATED_VERBS","sentence":"^\\Q\\E(?:Dummy|Ina|Jimmy-)[0-9]+\\Q New Session Actor Receive Received by all sessions except the new one.\\E$"}
67+
{"rule":"REPEATED_VERBS","sentence":"^\\Q\\E(?:Dummy|Ina|Jimmy-)[0-9]+\\Q Actor Certificate Invalidation Actor Send/Receive Received by server when an actor certificate has been invalidated.\\E$"}
68+
{"rule":"REPEATED_VERBS","sentence":"^\\Q\\E(?:Dummy|Ina|Jimmy-)[0-9]+\\Q Message Actor Receive Received when a message is sent to the actor.\\E$"}

api/build/core-openapi3.yaml

Lines changed: 870 additions & 230 deletions
Large diffs are not rendered by default.

api/src/core/main.tsp

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ using Routes;
88
using FederatedIdentity;
99
using Services;
1010
using Migration;
11+
using ResourceAddressingWithRelativeRoots;
1112

1213
namespace polyproto.core;
1314

@@ -113,4 +114,102 @@ namespace models {
113114
content: T
114115
}[];
115116
}
117+
118+
model MessageBatchExample extends MessageBatch<string> {}
119+
120+
/** The data is a gzipped tarball (.tar.gz) named `export1234567890-user@subdomain.example.com`, where
121+
* - `export[numbers]` is the word `export` with 20 random digits appended to it
122+
* - `user` is the actors' name
123+
* - `subdomain.example.com` is the FQDN of the server the actor is registered on.
124+
* This file archive contains a file `messages.p2mb` which is a JSON file containing [message batches](https://docs.polyphony.chat/Protocol%20Specifications/core/#721-message-batches)
125+
* of all messages sent by the user. If the server where the data export was requested from has
126+
* [RawR](https://docs.polyphony.chat/Protocol%20Specifications/core/#731-resource-addressing-with-relative-roots) enabled, the file archive will contain a
127+
* folder named `rawr`. This folder contains all RawR content uploaded by the actor to that server.
128+
* The files in this folder are named after the resource ID given to the resource. File extensions are only
129+
* added if they were known to the server. An example file name might be
130+
* `2c851bfb6daffa944fa1723c7bd4d362ffbc9defe292f2daaf05e895989d179b.jxl`, referencing the file
131+
* which was hosted at `<server_url>/.p2/core/resource/2c851bfb6daffa944fa1723c7bd4d362ffbc9defe292f2daaf05e895989d179b.jxl`.
132+
* In addition, the folder `rawr` contains a file named `access_properties.p2al`. This JSON
133+
* file contains a data structure mapping each resource ID to an access properties object.
134+
* In particular, the file is structured as an array containing objects. Each object has a key which is equal
135+
* to the resource ID of a resource in the `rawr` directory and a value which is an object
136+
* representing the access properties. An example of the contents of this file is given below:
137+
*
138+
```json
139+
[
140+
{
141+
"2062a23e2a25b226ca4c546fec5ec06e0df9648281f45da8b5aaabebdf66cf4c.jxl": {
142+
"private": false,
143+
"allowlist": ["user1@example.com", "instance.example.com"],
144+
"denylist": ["user2@example.com", "otherinstance@example.com"]
145+
}
146+
},
147+
{
148+
"a9144379a161e1fcf6b07801b70db6d6c481933bd634fe2409eb713723ab1a0a": {
149+
"private": true,
150+
"allowlist": ["user1@example.com"],
151+
"denylist": []
152+
}
153+
}
154+
]
155+
```
156+
*
157+
* If the server where the data export was requested from is the actors' home server, the
158+
* archive will contain a folder `certs` and a file `crypt_certs.p2epk`. `certs` will contain all ID-Certs
159+
* the server has stored of the actor. The ID-Certs will be stored in
160+
* [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).
161+
* The file `crypt_certs.p2epk` contains all [encrypted private key material](https://docs.polyphony.chat/Protocol%20Specifications/core/#63-private-key-loss-prevention-and-private-key-recovery)
162+
* that the actor has uploaded to the server. Just like `messages.p2mb`, `crypt_certs.p2epk` is a standard
163+
* JSON file.
164+
*/
165+
model P2Export {}
166+
167+
/**
168+
* `ResourceAccessProperties` define which actors may access an uploaded resource. Actors and
169+
* entire instances can have access granted or revoked.
170+
*/
171+
model ResourceAccessProperties {
172+
@doc("Whether the resource should be private by default. Private resources can only be accessed by the uploader and by instances and actors declared in the `allowlist`.")
173+
private: boolean = false;
174+
@doc("A list of actors and/or instances allowed to access this resource.")
175+
@example(#["[email protected]", "instance.example.com"])
176+
allowlist?: string[];
177+
@doc("A list of actors and/or instances who cannot have access to this resource.")
178+
@example(#["[email protected]", "other_instance.example.com"])
179+
denylist?: string[];
180+
}
181+
182+
/**
183+
* When querying the server for a list of resources uploaded by you, you can optionally request
184+
* the resulting list to be sorted in a specific way. These are the four options you have.
185+
*/
186+
enum ResourceListSorting {
187+
SizeAsc,
188+
SizeDesc,
189+
NewestFirst,
190+
OldestFirst
191+
}
192+
193+
/**
194+
* A cacheable response to an ID-Cert request.
195+
*/
196+
model CacheableIDCert {
197+
@doc("The requested ID-Cert in ASCII PEM format.")
198+
@example("------BEGIN CERTIFICATE------...")
199+
idCertPem: string,
200+
@doc("UNIX timestamp that specifies when this specific id_cert has been marked as invalidated by the server. An ID-Cert is considered invalidated, if the server or actor choose to revoke the validity of the ID-Cert before the lifetime of the certificate was scheduled to end. If this property does not exist, the ID-Cert has not been invalidated.")
201+
@example(1736610000)
202+
invalidatedAt?: uint64,
203+
@doc("UNIX timestamp that specifies the time from which this cache entry may be treated as valid.")
204+
@example(1736606402)
205+
cacheNotValidBefore: uint64,
206+
@doc("UNIX timestamp that specifies a time until which this cache entry may be treated as valid.")
207+
@example(1736613602)
208+
cacheNotValidAfter: uint64,
209+
@doc("Signature generated by the home server. This signature can be verified using the home servers' public identity key. A server generates the `cacheSignature` by concatenating the serial number of the ID-Cert in question with the `cacheValidNotBefore` timestamp and the `cacheValidNotAfter` timestamp, then generating the signature of the resulting concatenated string using the private identity key of the server. Clients must reject certificates of which the `cacheSignature` can not be verified to be correct.")
210+
@example("7ab2bbde7fe43c7481a3a61031546bab16bc1a8735b2f0cdd519958c7f2f99f8")
211+
@minLength(32)
212+
@maxLength(32)
213+
cacheSignature: string
214+
}
116215
}

0 commit comments

Comments
 (0)