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

Commit 2df2526

Browse files
authored
Extension Draft: polyproto-mls (#28)
This PR adds an initial draft for the `polyproto-mls` extension, defining how [MLS](https://messaginglayersecurity.rocks) interacts and integrates with polyproto. Additionally, this PR features new automatic code formatting and linting tooling + CI, instrumented by the `pre-commit` python package.
2 parents f14ad9e + 006f40f commit 2df2526

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2591
-2220
lines changed

.github/dependabot.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
version: 2
77
updates:
8-
- package-ecosystem: "npm" # See documentation for possible values
9-
directory: "/" # Location of package manifests
10-
schedule:
11-
interval: "weekly"
8+
- package-ecosystem: "npm" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"

.github/workflows/build.yml

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and run yarn project
1+
name: Lint, Build, Smoketest Run
22

33
on:
44
push:
@@ -8,10 +8,15 @@ on:
88
branches:
99
- "*"
1010

11+
# Auto-abort duplicate jobs (e.g. job being triggered again on push to open PR)
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
1116
jobs:
12-
build-and-run:
17+
lint:
18+
name: Lint
1319
runs-on: ubuntu-latest
14-
1520
steps:
1621
- name: Checkout repository
1722
uses: actions/checkout@v4
@@ -25,8 +30,34 @@ jobs:
2530
- name: Install dependencies
2631
run: yarn install --frozen-lockfile
2732

28-
- name: Prettier check
29-
run: yarn add --dev --exact prettier && yarn exec prettier . --write
33+
- name: Setup Python
34+
uses: actions/setup-python@v4
35+
with:
36+
python-version: "3.13"
37+
38+
- name: Install pre-commit
39+
run: |
40+
python -m pip install --upgrade pip
41+
pip install pre-commit
42+
43+
- name: Run pre-commit
44+
run: pre-commit run --all-files
45+
46+
build-and-run:
47+
name: Build and Run
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Checkout repository
51+
uses: actions/checkout@v4
52+
53+
- name: Setup Node.js
54+
uses: actions/setup-node@v4
55+
with:
56+
node-version: "22"
57+
cache: "yarn"
58+
59+
- name: Install dependencies
60+
run: yarn install --frozen-lockfile
3061

3162
- name: Build project
3263
run: yarn build

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ npm-debug.log*
1919
yarn-debug.log*
2020
yarn-error.log*
2121

22-
*:Zone.Identifier
22+
*:Zone.Identifier

.pre-commit-config.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-added-large-files
9+
10+
- repo: https://github.com/igorshubovych/markdownlint-cli
11+
rev: v0.45.0
12+
hooks:
13+
- id: markdownlint
14+
args: [--config=.markdownlint.json]
15+
16+
- repo: local
17+
hooks:
18+
- id: prettier
19+
name: prettier
20+
entry: yarn prettier
21+
language: node
22+
types_or: [markdown, mdx]
23+
pass_filenames: true
24+
args: [--write]
25+
additional_dependencies:
26+

.prettierrc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
"useTabs": false,
55
"semi": false,
66
"singleQuote": false,
7-
"endOfLine": "lf"
8-
}
7+
"endOfLine": "lf",
8+
"printWidth": 100,
9+
"proseWrap": "always"
10+
}

.vscode/settings.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
{
22
"languageToolLinter.languageTool.ignoredWordsInWorkspace": [
3+
"hkdf",
4+
"hpke",
5+
"megolm",
36
"polyproto-auth",
47
"polyproto-chat",
8+
"polyproto-core",
59
"polyproto-mls"
6-
]
10+
],
11+
"languageToolLinter.languageTool.disabledRules": "UPPERCASE_SENTENCE_START"
712
}

README.md

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,67 @@
1+
[![FAQ-shield]][FAQ]
2+
13
# Website
24

35
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
46

5-
### Installation
7+
## Installation
68

7-
```
8-
$ yarn
9+
```bash
10+
yarn
911
```
1012

11-
### Local Development
13+
### Pre-commit Hooks
1214

13-
```
14-
$ yarn start
15-
```
15+
This project uses pre-commit hooks to ensure code quality and uniform formatting. To set up
16+
pre-commit hooks:
1617

17-
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18+
1. Install pre-commit:
1819

19-
### Build
20+
```bash
21+
pip install pre-commit
22+
```
2023

21-
```
22-
$ yarn build
23-
```
24+
2. Install prettier and dev-dependencies:
2425

25-
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
```bash
27+
yarn install
28+
```
2629

27-
### Deployment
30+
3. Install the git hooks:
2831

29-
Using SSH:
32+
```bash
33+
pre-commit install
34+
```
3035

31-
```
32-
$ USE_SSH=true yarn deploy
36+
The pre-commit hooks will automatically:
37+
38+
- Format Markdown and MDX files using Prettier
39+
- Lint Markdown files using markdownlint
40+
- Check for common issues like trailing whitespace and file endings
41+
42+
You can manually run the checks on all files:
43+
44+
```bash
45+
pre-commit run --all-files
3346
```
3447

35-
Not using SSH:
48+
### Local Development
3649

50+
```bash
51+
yarn start
3752
```
38-
$ GIT_USER=<Your GitHub username> yarn deploy
53+
54+
This command starts a local development server and opens up a browser window. Most changes are
55+
reflected live without having to restart the server.
56+
57+
### Build
58+
59+
```bash
60+
yarn build
3961
```
4062

41-
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
63+
This command generates static content into the `build` directory and can be served using any static
64+
contents hosting service.
65+
66+
[FAQ-shield]: https://img.shields.io/badge/Frequently_Asked_Questions_(FAQ)-ff62bd
67+
[FAQ]: https://github.com/polyphony-chat/.github/blob/main/FAQ.md

blog/2023-08-17-self-updating-structs.md

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,63 @@
22
draft: false
33
date: 2023-08-17
44
categories:
5-
- chorus
6-
- updates
5+
- chorus
6+
- updates
77
authors:
8-
- bitfl0wer
8+
- bitfl0wer
99
---
1010

11-
# Self-updating structs, moving blog posts to GitHub, and more!
11+
# Self-updating structs, moving blog posts to GitHub, and more
1212

13-
Introducing self-updating structs, explaining how they work, and what they are good for. Also, moving blog posts to GitHub, and other improvements.
13+
Introducing self-updating structs, explaining how they work, and what they are good for. Also,
14+
moving blog posts to GitHub, and other improvements.
1415

15-
{/* truncate */}
16+
{/_ truncate _/}
1617

17-
It has been a while since the last update post - 1 month to be precise! I haven't gotten around to writing one of these, mostly because of personal time- and energy constraints. However, now that these resources are finally replenishing again, I figured that it is once again time!
18+
It has been a while since the last update post - 1 month to be precise! I haven't gotten around to
19+
writing one of these, mostly because of personal time- and energy constraints. However, now that
20+
these resources are finally replenishing again, I figured that it is once again time!
1821

1922
## Moving Blog Posts to GitHub
2023

21-
This is a pretty self-explanatory point. I thought, that opencollective would find more use by me and other polyphony-curious folk, however, this didn't go as planned. Also, opencollective made their Discord embeds really poopy, which is why I am moving all the blog posts over to GitHub.
24+
This is a pretty self-explanatory point. I thought, that opencollective would find more use by me
25+
and other polyphony-curious folk, however, this didn't go as planned. Also, opencollective made
26+
their Discord embeds really poopy, which is why I am moving all the blog posts over to GitHub.
2227

2328
## A big one: Self-updating structs
2429

25-
Ideally, you want entities like Channels, Guilds, or Users to react to Gateway events. A Gateway event is basically a message from Spacebar/Discord to you, which says: "Hey, User `x` has changed their name to `y`!". If you can reflect those changes immediately within your code, you save yourself from having to make a lot of requests and potentially getting rate-limited.
30+
Ideally, you want entities like Channels, Guilds, or Users to react to Gateway events. A Gateway
31+
event is basically a message from Spacebar/Discord to you, which says: "Hey, User `x` has changed
32+
their name to `y`!". If you can reflect those changes immediately within your code, you save
33+
yourself from having to make a lot of requests and potentially getting rate-limited.
2634

27-
This is exactly what Self-updating structs set out to solve. The first implementation was done by @SpecificProtagonist and me (thank you a lot again, btw) on the 21st of July. However: This implementation, being in its' infancy, has had some design flaws, which to me made pretty clear, that this whole thing needed to be thought through a little better.
35+
This is exactly what Self-updating structs set out to solve. The first implementation was done by
36+
@SpecificProtagonist and me (thank you a lot again, btw) on the 21st of July. However: This
37+
implementation, being in its' infancy, has had some design flaws, which to me made pretty clear,
38+
that this whole thing needed to be thought through a little better.
2839

29-
The second iteration of these Self-updating structs was finished... today, actually, by me. It saves memory compared to the first iteration by storing unique objects only once, instead of `n = how many times they are being referenced`-times. While this way of doing things is really efficient, it also has been a pain in the ass to make, which is precisely the reason why this took me so long. I've learned a lot along the way though.
40+
The second iteration of these Self-updating structs was finished... today, actually, by me. It saves
41+
memory compared to the first iteration by storing unique objects only once, instead of
42+
`n = how many times they are being referenced`-times. While this way of doing things is really
43+
efficient, it also has been a pain in the ass to make, which is precisely the reason why this took
44+
me so long. I've learned a lot along the way though.
3045

31-
The public API has also gotten a *lot* better in "v2". This is mostly because I am a big believer in writing tests for your code, and through writing what are essentialy real-world-simulation-examples, I noticed how repetitive or stupid some things were, and thus could improve upon them.
46+
The public API has also gotten a _lot_ better in "v2". This is mostly because I am a big believer in
47+
writing tests for your code, and through writing what are essentialy real-world-simulation-examples,
48+
I noticed how repetitive or stupid some things were, and thus could improve upon them.
3249

33-
Having this whole thing finished is a big relief. This self-updating thing is an essential feature for any Discord/Spacebar compatible library, and I think that we implemented it very nicely.
50+
Having this whole thing finished is a big relief. This self-updating thing is an essential feature
51+
for any Discord/Spacebar compatible library, and I think that we implemented it very nicely.
3452

3553
## Documentation and other improvements
3654

37-
@kozabrada123 took it upon himself to re-write a lot of the codes' Documentation. Thanks for that! This will massively improve the ease of use of this library - both when developing *for* and *with* it. koza also improved our CI/CT pipeline by incorporating build-caching into it, which speeds up builds.
55+
@kozabrada123 took it upon himself to re-write a lot of the codes' Documentation. Thanks for that!
56+
This will massively improve the ease of use of this library - both when developing _for_ and _with_
57+
it. koza also improved our CI/CT pipeline by incorporating build-caching into it, which speeds up
58+
builds.
3859

3960
This has been the last month of Polyphony. In the coming weeks, I will be working on
61+
4062
- Implementing self-updating-struct behavior for every struct which needs it
4163
- Fixing bugs
4264
- Adding more features, like emojis, 2FA, Guild Settings, etc.!

blog/2023-08-29-chorus-alpha.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,40 @@
22
draft: false
33
date: 2023-08-29
44
categories:
5-
- chorus
6-
- updates
5+
- chorus
6+
- updates
77
authors:
8-
- bitfl0wer
8+
- bitfl0wer
99
---
1010

1111
# chorus Alpha 0.1.0
1212

13-
We are alpha now! As of 2 days ago, the first Alpha of Chorus, Version 0.1.0, has been released for everyone to look at and use on crates.io!
13+
We are alpha now! As of 2 days ago, the first Alpha of Chorus, Version 0.1.0, has been released for
14+
everyone to look at and use on crates.io!
1415

15-
{/* truncate */}
16+
{/_ truncate _/}
1617

1718
So, is the library complete now? No. And yes! It's, well, complicated... Let me explain!
1819

19-
Chorus is at a point where I can comfortably say that, if you take voice-support out of the calculation for a bit, the foundation feels rock-solid, easy to work with and easily expandable. However, to stay with our house/building metaphor for a bit, the walls aren't painted yet, there's barely any furniture and not all of the electrical outlets have been installed yet.
20+
Chorus is at a point where I can comfortably say that, if you take voice-support out of the
21+
calculation for a bit, the foundation feels rock-solid, easy to work with and easily expandable.
22+
However, to stay with our house/building metaphor for a bit, the walls aren't painted yet, there's
23+
barely any furniture and not all of the electrical outlets have been installed yet.
2024

21-
Okay, enough with this bad metaphor; What I meant to convey is, that a lot of the API endpoints have not yet been implemented, and there are at least a few points we haven't addressed yet - like Gateway Error Handling, to name an example.
25+
Okay, enough with this bad metaphor; What I meant to convey is, that a lot of the API endpoints have
26+
not yet been implemented, and there are at least a few points we haven't addressed yet - like
27+
Gateway Error Handling, to name an example.
2228

23-
But for an early Alpha, this, in my opinion, is absolutely acceptable. Implementing API endpoints is something that probably someone who is entirely new to Rust could do, given that we've streamlined the procedure so much, and the other stuff can comfortably be fixed without having to do any major changes to the internals.
29+
But for an early Alpha, this, in my opinion, is absolutely acceptable. Implementing API endpoints is
30+
something that probably someone who is entirely new to Rust could do, given that we've streamlined
31+
the procedure so much, and the other stuff can comfortably be fixed without having to do any major
32+
changes to the internals.
2433

25-
I, for one, am currently experimenting around with the Polyphony Client, which, by the way, will likely be written with Iced as a GUI Framework, not GTK. I have no prior experience in GUI/Desktop Application development, but I am feeling more confident than ever and I'm eager to learn all there is to know about these topics.
34+
I, for one, am currently experimenting around with the Polyphony Client, which, by the way, will
35+
likely be written with Iced as a GUI Framework, not GTK. I have no prior experience in GUI/Desktop
36+
Application development, but I am feeling more confident than ever and I'm eager to learn all there
37+
is to know about these topics.
2638

27-
That's that! Seeya next time.
28-
Cheers,
39+
That's that! Seeya next time. Cheers,
2940

3041
Flori

blog/2023-09-02-client-getting-started.md

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,39 @@
22
draft: false
33
date: 2023-09-02
44
categories:
5-
- polyphony
6-
- updates
5+
- polyphony
6+
- updates
77
authors:
8-
- bitfl0wer
8+
- bitfl0wer
99
---
1010

1111
# Getting started with the Polyphony Client
1212

13-
{/* truncate */}
13+
{/_ truncate _/}
1414

15-
Us labeling Chorus to be in a public-alpha state was really great news for me, for a lot of reasons! It marked a point in Polyphonys history where, after all these months of work, we agreed upon the fact that what we *have* is good enough to be shown to the public, and that's always a nice thing when investing so much of your free-time into a project.
16-
The other main reason why this is such a great thing is, because this alpha state (at least to me) means, that the public API is kind-of stable, or at least stable enough so that I, the project lead, can rely upon the fact that all the public methods will not, in fact, be replaced in 4 days.
15+
Us labeling Chorus to be in a public-alpha state was really great news for me, for a lot of reasons!
16+
It marked a point in Polyphonys history where, after all these months of work, we agreed upon the
17+
fact that what we _have_ is good enough to be shown to the public, and that's always a nice thing
18+
when investing so much of your free-time into a project. The other main reason why this is such a
19+
great thing is, because this alpha state (at least to me) means, that the public API is kind-of
20+
stable, or at least stable enough so that I, the project lead, can rely upon the fact that all the
21+
public methods will not, in fact, be replaced in 4 days.
1722

18-
This means, that I can finally start working on the Client! And I have done that! For the past 2? 3? Days, I've been tinkering around with Iced-rs (a really, really great UI framework for Rust, written in Rust) and the client repository to create the 'skeleton' of the application. While this is definitely not trivial, especially since I have *no* prior experience in desktop application development, it's also not too hard either.
23+
This means, that I can finally start working on the Client! And I have done that! For the past 2? 3?
24+
Days, I've been tinkering around with Iced-rs (a really, really great UI framework for Rust, written
25+
in Rust) and the client repository to create the 'skeleton' of the application. While this is
26+
definitely not trivial, especially since I have _no_ prior experience in desktop application
27+
development, it's also not too hard either.
1928

20-
While Iced is not mature yet, and "how-to" guides, as well as the promised Iced-book, are still largely missing, the maintainers have done a great job with providing a LOT of code examples and solid rustdocs. It's a fun library/framework to work with, and the Elm-inspired approach of dividing up State, Messages, View- and Update-Logic feels really intuitive and seems to make sure that your Application will never end up in an unexpected state.
29+
While Iced is not mature yet, and "how-to" guides, as well as the promised Iced-book, are still
30+
largely missing, the maintainers have done a great job with providing a LOT of code examples and
31+
solid rustdocs. It's a fun library/framework to work with, and the Elm-inspired approach of dividing
32+
up State, Messages, View- and Update-Logic feels really intuitive and seems to make sure that your
33+
Application will never end up in an unexpected state.
2134

22-
That's all I have for today. Thanks for reading this! Here's a video of multi-user login already working ^^
35+
That's all I have for today. Thanks for reading this! Here's a video of multi-user login already
36+
working ^^
2337

2438
<video controls width="auto">
2539
<source src="https://cloud.bitfl0wer.de/index.php/s/Gd556SnwAQYejYw/download/screenrec.mp4"/>
2640
</video>
27-

0 commit comments

Comments
 (0)