Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.10.0 #48

Merged
merged 277 commits into from
Mar 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
277 commits
Select commit Hold shift + click to select a range
90fa397
feature-lock appropriate methods and imports
bitfl0wer Feb 19, 2025
37fd32b
fix my test??? this was just wrong. what the hell?
bitfl0wer Feb 19, 2025
f6b88af
remove outdated docs
bitfl0wer Feb 19, 2025
674a8cd
fix last test
bitfl0wer Feb 19, 2025
cf542ad
make some areas easier to read.
bitfl0wer Feb 19, 2025
c5e156b
Fix rdns_to_url, add issuer_url test
bitfl0wer Feb 20, 2025
c74d0b5
remove todo as it has been implemented
bitfl0wer Feb 20, 2025
22cd664
idea for httpclient refactor
bitfl0wer Feb 20, 2025
9ed4186
make session into Session<S: Signature, T: PrivateKey<S>>
bitfl0wer Feb 21, 2025
9e3c50e
fix wrong invocations of HttpClient::new
bitfl0wer Feb 21, 2025
52ac8ef
Add documentation
bitfl0wer Feb 21, 2025
7881d02
add set_token, set_cert_and_key
bitfl0wer Feb 21, 2025
fddbab5
Move all authenticated requests to impl Session, fix impl HttpClient
bitfl0wer Feb 21, 2025
116fe2e
Update tests
bitfl0wer Feb 21, 2025
0edc633
Update examples
bitfl0wer Feb 21, 2025
5834030
document public fields
bitfl0wer Feb 21, 2025
551472d
Remove ChallengeString and all mentions to it
bitfl0wer Feb 21, 2025
df89b35
Remove ChallengeString and all mentions to it
bitfl0wer Feb 21, 2025
5382b5d
Merge branch 'dev/v0.10' of https://github.com/polyphony-chat/polypro…
bitfl0wer Feb 21, 2025
5d10693
update example
bitfl0wer Feb 21, 2025
a94d0ed
modernize language
bitfl0wer Feb 21, 2025
4d33bbf
Create cacheable_cert.rs
bitfl0wer Feb 21, 2025
709e17c
document parameter "time"
bitfl0wer Feb 21, 2025
11e4a6c
Delete rotate_session_idcert(), IdCertExt, IdCertExtJson, return Cach…
bitfl0wer Feb 21, 2025
8154ba9
Add custom UInt newtype because der::asn1::UInt is stupid
bitfl0wer Feb 22, 2025
1cf541b
remove copyright
bitfl0wer Feb 22, 2025
35ca72f
update tests
bitfl0wer Feb 22, 2025
3967d05
update example
bitfl0wer Feb 22, 2025
befa5ab
add trace log
bitfl0wer Feb 22, 2025
bf9a179
:3c
bitfl0wer Feb 22, 2025
d4a4a76
make tuple field public
bitfl0wer Feb 22, 2025
4d1fc0a
add CacheableIdCert::verify()
bitfl0wer Feb 22, 2025
91e0f6c
mark todo as completed
bitfl0wer Feb 22, 2025
439785f
document verify()
bitfl0wer Feb 22, 2025
d728772
add hex crate for cache signature validation
bitfl0wer Feb 22, 2025
8145b62
Update examples
bitfl0wer Feb 22, 2025
5f97ffa
Add some trace logging, fix verifying!
bitfl0wer Feb 22, 2025
885787b
Add 3 new methods to `Signature` trait
bitfl0wer Feb 22, 2025
ee2e92e
Refine `BadSignature` description
bitfl0wer Feb 22, 2025
a8bc56b
Adapt test::common to new Signature traitdef
bitfl0wer Feb 22, 2025
93fe84c
Test cache signature verification
bitfl0wer Feb 22, 2025
03b1697
add coverage action
bitfl0wer Feb 22, 2025
b8a17fe
Merge branch 'main' into dev/v0.10
bitfl0wer Feb 22, 2025
d2fff50
Merge branch 'main' into dev/v0.10
bitfl0wer Feb 22, 2025
43837ba
Merge branch 'main' into dev/v0.10
bitfl0wer Feb 23, 2025
d55c00e
Merge branch 'main' into dev/v0.10
bitfl0wer Feb 23, 2025
1e7f0f3
Merge branch 'main' into dev/v0.10
bitfl0wer Feb 23, 2025
d7c38d7
add additional failure check
bitfl0wer Feb 23, 2025
1d7296b
add warning about wasm-untestedness
bitfl0wer Feb 23, 2025
5097305
Merge branch 'main' into dev/v0.10
bitfl0wer Feb 23, 2025
8291f14
coverage: skip useless code
bitfl0wer Feb 23, 2025
73e550a
test signature<->publickey algorithm identifier equality
bitfl0wer Feb 23, 2025
4868889
add test for verification failure on invalid signature
bitfl0wer Feb 23, 2025
116aff6
fix overindenting
bitfl0wer Feb 23, 2025
7c7d190
Add documentation to Payload and HasOpcode
bitfl0wer Feb 23, 2025
4624e99
feature lock gateway module
bitfl0wer Feb 23, 2025
f220970
replace `Validity` declarations with `common::default_validity()`
bitfl0wer Feb 23, 2025
66618fc
create backend module and define a backend struct
bitfl0wer Feb 23, 2025
1275dda
create modules for different websocket backends
bitfl0wer Feb 23, 2025
fd5d7ea
clarify documentation
bitfl0wer Feb 24, 2025
2385bcc
rename `Event` to `CoreEvent`, create `AnyEvent`
bitfl0wer Feb 24, 2025
f59cf67
add missing mpl-2.0 license headers
bitfl0wer Feb 26, 2025
086256e
add own gateway types, copy closecode from tungstenite with appropria…
bitfl0wer Feb 26, 2025
5e55ace
Add license header check workflow
bitfl0wer Feb 26, 2025
48ba706
Include other files as to not cause errors
bitfl0wer Feb 26, 2025
2c04c35
Strict checking
bitfl0wer Feb 26, 2025
46820bc
Add missing license headers, consolidate slightly differing license h…
bitfl0wer Feb 26, 2025
ae20f9c
derive debug, clone for wasm backend
bitfl0wer Feb 26, 2025
02f9cdb
Helper conversion implementations from tungstenite crate
bitfl0wer Feb 26, 2025
f71d12e
add tokio, tokio_tungstenite, change reqwest to use rustls-webpki to …
bitfl0wer Feb 26, 2025
8e38036
convert tungstenite message to crate gateway message type (vice versa)
bitfl0wer Feb 26, 2025
b12887b
Move `mod sealer` and `Glue` to crate root, make it pub(crate)
bitfl0wer Feb 26, 2025
5da4c70
add documentation to Glue trait
bitfl0wer Feb 26, 2025
4b7c135
add send, subscribe methods to `BackendBehavior`; seal `BackendBehavior`
bitfl0wer Feb 26, 2025
4ed9757
#[allow(async_fn_in_trait)]
bitfl0wer Feb 27, 2025
a897328
remove clone derive: conflict
bitfl0wer Feb 27, 2025
3682558
add kill_send, kill_receive, gateway_task
bitfl0wer Feb 27, 2025
f961b74
add scripts directory with useful scripts
bitfl0wer Mar 1, 2025
45e72cd
make cargo nextest output logs on test failure
bitfl0wer Mar 1, 2025
13efa67
replace env_logger with log4rs
bitfl0wer Mar 1, 2025
4cb4f37
update testing code to build log4rs logger for better formatted output
bitfl0wer Mar 1, 2025
ec7c900
Clarify "unsupported" message
bitfl0wer Mar 1, 2025
d47a9cb
mv gen-coverage to scripts dir
bitfl0wer Mar 1, 2025
e8d5f94
mv gen-coverage to scripts dir
bitfl0wer Mar 1, 2025
6198821
fail immediately on test failure
bitfl0wer Mar 1, 2025
4b885e6
i thought it would work; revert log4rs change
bitfl0wer Mar 1, 2025
0d97f0e
Decouple Gateway from any specific impl
bitfl0wer Mar 1, 2025
4d4004b
move async fn allow to top, add disconnect, make fn send async
bitfl0wer Mar 1, 2025
7634b3d
add "impl backendbehavior for tungstenitebackend" with todo!() impls
bitfl0wer Mar 1, 2025
77c4463
Add Error Types and Connection Handling Added Rust dependencies for w…
bitfl0wer Mar 2, 2025
15c32fe
Implement gateway connect method for tungstenite backend
bitfl0wer Mar 2, 2025
0f0ec06
make gatewaybackend type no longer pub
bitfl0wer Mar 2, 2025
b9a4dfa
remove gatewaybackend type
bitfl0wer Mar 2, 2025
94b09c8
mv tungstenite.rs to tungstenite/mod.rs
bitfl0wer Mar 2, 2025
4f6d7fc
add heartbeat.rs
bitfl0wer Mar 2, 2025
8eb709f
mv wasm.rs to wasm/mod.rs
bitfl0wer Mar 2, 2025
3efdcf1
delete heartbeat.rs
bitfl0wer Mar 2, 2025
74514cd
i dont wanna talk about it
bitfl0wer Mar 2, 2025
7d39336
make kill_log_message static
bitfl0wer Mar 2, 2025
e160b6f
make fields of CoreEvent private, impl HasOpcode for AnyEvent and Cor…
bitfl0wer Mar 2, 2025
9592235
commit some initial, unfinished logic for heartbeat spawn
bitfl0wer Mar 2, 2025
06fe532
extend behavior by matching payloads, create handle_heartbeat
bitfl0wer Mar 3, 2025
1687e4d
add fn new() for CoreEvent, add RequestHeartbeat Payload
bitfl0wer Mar 4, 2025
840b4da
test requestheartbeat payload
bitfl0wer Mar 4, 2025
084edc4
add impl display to opcode, fix HasOpcode for Payload, add trace log
bitfl0wer Mar 4, 2025
78003da
fix the fix of HasOpcode for Payload :P
bitfl0wer Mar 4, 2025
fa52a61
add some logging to one of the tests, can't hurt
bitfl0wer Mar 4, 2025
0bc946c
create minified_number_range.rs
bitfl0wer Mar 4, 2025
9383940
continue work on heartbeat handling
bitfl0wer Mar 4, 2025
ef9c27f
add heartbeat to gateway
bitfl0wer Mar 4, 2025
371aa58
add heartbeat to tungstenite backend
bitfl0wer Mar 4, 2025
f9608cb
add try_send_heartbeat, shrink sequences vector 2 save memory, logging
bitfl0wer Mar 4, 2025
193b083
add todo impls (unfinished!)
bitfl0wer Mar 4, 2025
281054f
add indirection to avoid infinitely sized future, .await future
bitfl0wer Mar 4, 2025
6103e25
primitive/naive implementation of From<&Vec<u64>> for MinifiedNumberR…
bitfl0wer Mar 4, 2025
3bea1fe
minifiednumberlist and heartbeat are identical; delete minifiednumber…
bitfl0wer Mar 4, 2025
d3ebab7
add type alias for minified number list
bitfl0wer Mar 4, 2025
a5d75bc
add and document heartbeat::from_sequence_numbers
bitfl0wer Mar 5, 2025
f19353b
fix sleep deprived logic that was almost there but not quite <3
bitfl0wer Mar 5, 2025
827220c
test heartbeat from sequence numbers
bitfl0wer Mar 5, 2025
deac8f7
dedup functions, rename _task_handle
bitfl0wer Mar 5, 2025
1214e0e
fix typo, dedup received_sequences before sending
bitfl0wer Mar 5, 2025
960680d
add deserialize derive to anyevent
bitfl0wer Mar 5, 2025
9814ee5
remove sequence channel, directly process all payload sequence numbers
bitfl0wer Mar 5, 2025
47b3912
remove sequence channel, add some documentation
bitfl0wer Mar 5, 2025
a9bcd64
remove unneeded late init of let binding
bitfl0wer Mar 5, 2025
9308d6c
add documentation
bitfl0wer Mar 5, 2025
9d3e042
adjust BackendBehavior trait methods, impl BackendBehavior for tungst…
bitfl0wer Mar 5, 2025
64afe71
make backends mod pub
bitfl0wer Mar 5, 2025
dc20dfe
rename "unread" variables
bitfl0wer Mar 5, 2025
640aa10
documentation nation
bitfl0wer Mar 5, 2025
2f37bb3
add ws-mock
bitfl0wer Mar 5, 2025
ed13028
replace --all-features with specific feature set
bitfl0wer Mar 5, 2025
acd27fa
add gateway mod, add feature locking
bitfl0wer Mar 5, 2025
7e4ee62
add ws smoke test
bitfl0wer Mar 5, 2025
e3e7f06
wrote a KILLER macro :sunglasses: (no, really)
bitfl0wer Mar 5, 2025
bf146d5
expect hello as first message, replace manual kill_send with kill!() …
bitfl0wer Mar 5, 2025
8224425
add nohello error variant
bitfl0wer Mar 5, 2025
0376d5c
start testing gateway more thoroughly
bitfl0wer Mar 5, 2025
9cd746d
document bug
bitfl0wer Mar 5, 2025
532204d
fix waiting on hello
bitfl0wer Mar 6, 2025
2919518
Fixed strange bug that happened when deserializing values
bitfl0wer Mar 6, 2025
87e2f47
logging ftw, fix attempt != 0 -> > 1
bitfl0wer Mar 6, 2025
54da0e3
test respond_to_manual_heartbeat
bitfl0wer Mar 6, 2025
cc1fc87
test kill macro
bitfl0wer Mar 6, 2025
3695196
remove --example: not present in actions workflow
bitfl0wer Mar 6, 2025
5cc94c5
add tests for wasm
bitfl0wer Mar 6, 2025
b9788ec
add test_close_code_conversions
bitfl0wer Mar 6, 2025
378c554
we cant test "all features"
bitfl0wer Mar 7, 2025
99ae8a3
dont skip clean
bitfl0wer Mar 7, 2025
749dcda
remove logging, hindered coverage :(
bitfl0wer Mar 7, 2025
6849aeb
reformat file
bitfl0wer Mar 7, 2025
38ab7b2
replace macros with test_all_platforms
bitfl0wer Mar 7, 2025
469534d
add more tests to cacheable id cert, achieve ~70% coverage
bitfl0wer Mar 7, 2025
37fea0e
fix clippy warnings
bitfl0wer Mar 7, 2025
91e1cd7
update Resume struct
bitfl0wer Mar 8, 2025
b0f0c48
fix test script
bitfl0wer Mar 8, 2025
714c350
Update README
bitfl0wer Mar 8, 2025
7c9e170
Update README
bitfl0wer Mar 8, 2025
4fcdff3
add gateway feature to default set, bump msrv
bitfl0wer Mar 8, 2025
21815a4
Merge branch 'dev/v0.10' of https://github.com/polyphony-chat/polypro…
bitfl0wer Mar 8, 2025
5915364
Run `cargo fmt` with 2024 edition rules and Rust 1.85.0
bitfl0wer Mar 8, 2025
ba953c0
add rt features for wasm and default
bitfl0wer Mar 8, 2025
6bcd32a
bump version
bitfl0wer Mar 9, 2025
ab0449c
license headers
bitfl0wer Mar 9, 2025
59df080
feature gating changes
bitfl0wer Mar 9, 2025
1819215
Merge branch 'main' into dev/v0.10
bitfl0wer Mar 18, 2025
051b1e7
cleanup
bitfl0wer Mar 18, 2025
192210a
complete merge conflict resolution
bitfl0wer Mar 18, 2025
81bdcce
update actor certificate invalidation event
bitfl0wer Mar 18, 2025
7eedd24
change tests to new actorcertificateinvalidation format
bitfl0wer Mar 19, 2025
fac5bd3
reorganize routes into separate modules
bitfl0wer Mar 20, 2025
8c7e362
move functions to where they belong
bitfl0wer Mar 20, 2025
ef49220
add stubs for missing routes
bitfl0wer Mar 20, 2025
9184d97
add helper function for matching status codes of responses
bitfl0wer Mar 20, 2025
56b01fe
impl delete_rawr_resource
bitfl0wer Mar 20, 2025
3e7a7ac
add StatusCode error type
bitfl0wer Mar 20, 2025
d19e513
add identifier, domainname types + todos
bitfl0wer Mar 20, 2025
8719db4
start work on accesscontrol type
bitfl0wer Mar 20, 2025
0b5a376
fix serialize impl of federationid
bitfl0wer Mar 21, 2025
a95a032
test deserialize, serialize for federationid
bitfl0wer Mar 21, 2025
94f2fea
add ERR_MSG_DOMAIN_NAME_REGEX
bitfl0wer Mar 21, 2025
47091f1
impl deserialize, serialize for domainname
bitfl0wer Mar 21, 2025
a3f2b9d
test deserialize, serialize impl for domain name
bitfl0wer Mar 21, 2025
b223282
Fix regex for domain name, impl serde traits for Identifier
bitfl0wer Mar 21, 2025
91073c3
finish TODO
bitfl0wer Mar 21, 2025
66341d9
test Identifier serde impls
bitfl0wer Mar 21, 2025
a147073
Define ResourceInformation with serde compat
bitfl0wer Mar 21, 2025
35d5f77
impl Resource with reqwest `Form` conversion support
bitfl0wer Mar 21, 2025
492aa7b
add reqwest `multipart` feature for file uploads
bitfl0wer Mar 21, 2025
4d6a1eb
featurelock RequestError
bitfl0wer Mar 21, 2025
ef35634
fix typo
bitfl0wer Mar 21, 2025
9161b4f
add fn request_route
bitfl0wer Mar 21, 2025
dde3626
add fn list_uploaded_rawr_resources, add ordering enum
bitfl0wer Mar 21, 2025
baa86ed
add urlencoding crate
bitfl0wer Mar 21, 2025
d579f78
add note :)
bitfl0wer Mar 21, 2025
d15c8cd
Implement more rawr stuff
bitfl0wer Mar 21, 2025
f457d92
add license header
bitfl0wer Mar 21, 2025
b967c0d
Add get_rawr_resource_by_id
bitfl0wer Mar 22, 2025
f403df4
impl display for odering, fix request building error
bitfl0wer Mar 23, 2025
e03a303
add test "list_uploaded_rawr_resources", add test boilerplate
bitfl0wer Mar 23, 2025
9e7cb64
add test helper function "example_resource_information"
bitfl0wer Mar 23, 2025
0132505
test empty response
bitfl0wer Mar 23, 2025
6d63c1a
handle empty responses gracefully
bitfl0wer Mar 23, 2025
7e0e804
fixes on upload_resource, add test for get resource by id
bitfl0wer Mar 23, 2025
3fae15f
add back wasm tests
bitfl0wer Mar 24, 2025
c3cac9e
re-establish wasm compatibility somewhat
bitfl0wer Mar 24, 2025
d1a372e
fix missing feature locking of serde things
bitfl0wer Mar 24, 2025
3100d0d
fix missing feature locking of types
bitfl0wer Mar 24, 2025
934fb08
fix missing feature locking of reqwest stuff
bitfl0wer Mar 24, 2025
4e45643
fix wasm dev build by not requiring full tokio
bitfl0wer Mar 24, 2025
25fcc04
change test wasm to build wasm
bitfl0wer Mar 24, 2025
dee960d
Re-add successful `wasm` build (#52)
bitfl0wer Mar 24, 2025
a716545
re-add serde_json import to fix failing build
bitfl0wer Mar 24, 2025
6f2bcdb
update notes on wasm
bitfl0wer Mar 24, 2025
15a92f0
feature gate some wasm stuff
bitfl0wer Mar 24, 2025
471e508
update cargo.toml
bitfl0wer Mar 24, 2025
44a2e3f
add test for get_rawr_resource_info_by_id
bitfl0wer Mar 24, 2025
26c98f9
add httptest to test log output
bitfl0wer Mar 24, 2025
c50542d
fix get_rawr_resource_info_by_id request url/path formatting
bitfl0wer Mar 24, 2025
debc929
add half-stub for import_data_to_server
bitfl0wer Mar 24, 2025
63fb859
add stub impl TryFrom<P2Export> for reqwest::multipart::Form, add todos
bitfl0wer Mar 24, 2025
3a63b85
add new P2RequestBuilder for easy... building of requests
bitfl0wer Mar 25, 2025
45e57f5
add docs, add 2 routes
bitfl0wer Mar 25, 2025
aba7118
add derives to stubs
bitfl0wer Mar 25, 2025
f1f70a5
add a bogus test
bitfl0wer Mar 25, 2025
92768e8
fix this dumbass test (im tired of writing routes)
bitfl0wer Mar 25, 2025
760d254
add homeserver() method to requestbuilder, fix url assembling
bitfl0wer Mar 25, 2025
ee4eb6b
fix test
bitfl0wer Mar 25, 2025
d17b6da
implement 3 more routes
bitfl0wer Mar 25, 2025
21e562b
impl From<InvalidInput> for RequestError
bitfl0wer Mar 25, 2025
5628add
add placeholder {fid} to GET_COMPLETED_KEYTRIALS_AND_RESPONSES
bitfl0wer Mar 25, 2025
8c097f5
fix CI by featuregating impl From<InvalidInput> for RequestError behi…
bitfl0wer Mar 25, 2025
fd7134f
add get_messages_to_be_resigned
bitfl0wer Mar 26, 2025
d3eb385
cargo clippy --fix
bitfl0wer Mar 26, 2025
5c1d53e
add route REMOVE_REDIRECT_EXTERN
bitfl0wer Mar 26, 2025
f473467
add missing migration routes
bitfl0wer Mar 26, 2025
fffd68b
gweruiowerioguioh;werghjklbsdfhjklgsdfuiohj;eryuioh;ersdfuiojsdfg
bitfl0wer Mar 26, 2025
a17f0c1
wasm-bindgen setup (#53)
bitfl0wer Mar 27, 2025
30e49a5
toggle working with wasm platforms, add toggle instructions
bitfl0wer Mar 27, 2025
29fbe9b
i think this fits better. idk
bitfl0wer Mar 27, 2025
c34bf34
mark p2_export as under construction + deprecated
bitfl0wer Mar 27, 2025
decbf13
change p2export use
bitfl0wer Mar 27, 2025
ce0ba46
implement keytrial.rs + helper functions
bitfl0wer Mar 27, 2025
6127e76
logging improvements
bitfl0wer Mar 27, 2025
baad1b1
remove todo
bitfl0wer Mar 27, 2025
f558dd9
fix test, add unfinished test with notes, extend test
bitfl0wer Mar 27, 2025
143b43e
add documentation
bitfl0wer Mar 27, 2025
da71e6a
mark some todos as completed
bitfl0wer Mar 27, 2025
5c1a18d
cargo fmt: 2024
bitfl0wer Mar 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/license-check/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"include": ["**/*.rs"],
"license": "./.github/license-check/header-mpl-2.0.txt",
"exclude": ["target/**", "**/"]
},
{
"include": ["target/**", "**/**"]
}
]
3 changes: 3 additions & 0 deletions .github/license-check/header-mpl-2.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
25 changes: 3 additions & 22 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,13 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Install rust toolchain 1.85.1
uses: dtolnay/[email protected]
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
prefix-key: "linux"
- uses: taiki-e/install-action@nextest
- name: nextest run
run: |
cargo nextest run --verbose --all-features --tests --examples

# wasm:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: Swatinem/rust-cache@v2
# with:
# cache-all-crates: "true"
# prefix-key: "macos"
# - name: Run WASM tests with Safari, Firefox, Chrome
# run: |
# rustup target add wasm32-unknown-unknown
# curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
# cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.88" --force
# cargo binstall --no-confirm wasm-pack --force
# wasm-pack test --node -- --features wasm --examples
# wasm-pack test --firefox -- --features wasm --examples
# wasm-pack test --chrome -- --features wasm --examples
# wasm-pack test --node -- --features wasm
# wasm-pack test --firefox -- --features wasm
# wasm-pack test --chrome -- --features wasm
cargo nextest run --features="types,reqwest,gateway" --failure-output final --no-fail-fast
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
if [ -n "${{ secrets.COVERALLS_REPO_TOKEN }}" ]; then
curl -L --proto '=https' --tlsv1.3 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
cargo binstall --no-confirm cargo-tarpaulin --force
cargo tarpaulin --all-features --tests --verbose --skip-clean --coveralls ${{ secrets.COVERALLS_REPO_TOKEN }} --timeout 120
cargo tarpaulin --features="gateway, reqwest, serde, types" --tests --verbose --skip-clean --coveralls ${{ secrets.COVERALLS_REPO_TOKEN }} --timeout 120 --fail-immediately
else
echo "Code Coverage step is skipped on PRs from forks."
fi
17 changes: 17 additions & 0 deletions .github/workflows/license-header.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: License Header Check

on: [push, pull_request]

jobs:
check-license-headers:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Check license headers
uses: viperproject/check-license-header@v2
with:
path: .
config: ./.github/license-check/config.json
strict: true
35 changes: 35 additions & 0 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build and Test (wasm32)

on:
push:
branches: ["main"]
pull_request:
branches: ["*"]

env:
CARGO_TERM_COLOR: always

jobs:
wasm:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Install rust toolchain 1.85.1
uses: dtolnay/[email protected]
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
prefix-key: "wasm"
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
check-latest: true
- name: Compile wasm
run: |
rustup target add wasm32-unknown-unknown
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
cargo binstall --no-confirm wasm-pack --force
wasm-pack build --features=wasm,serde,types --no-default-features
wasm-pack build --features=wasm,types --no-default-features
wasm-pack build --features=wasm --no-default-features
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
cert.csr
cert.der
/firedbg
.vscode/ltex.*
.vscode/ltex.*
pkg/
wasm-pack.log
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
{
"markiscodecoverage.searchCriteria": ".coverage/lcov*.info",
// --- Toggle the below setting using line comments to enable/disable working with wasm platforms ---
"rust-analyzer.cargo.features": ["types", "reqwest", "gateway", "serde"]
// --- Toggle the below settings using line comments to enable/disable working with wasm platforms ---
// "rust-analyzer.cargo.features": [
// "_wasm_bindgen",
// "wasm",
// "types",
// "reqwest",
// "gateway",
// "serde"
// ],
// "rust-analyzer.cargo.noDefaultFeatures": true,
// "rust-analyzer.cargo.target": "wasm32-unknown-unknown"
}
92 changes: 65 additions & 27 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,59 +1,97 @@
[package]
name = "polyproto"
version = "0.9.0"
edition = "2021"
version = "0.10.0"
edition = "2024"
license = "MPL-2.0"
description = "(Generic) Rust types and traits to quickly get a polyproto implementation up and running"
repository = "https://github.com/polyphony-chat/polyproto"
rust-version = "1.71.1"
rust-version = "1.85.0"

[lib]
crate-type = ["rlib", "cdylib", "staticlib"]
crate-type = ["cdylib", "rlib"]

[features]
default = ["types"]
wasm = ["getrandom", "getrandom/js"]
default = ["types", "serde", "gateway", "tokio/net"]
wasm = ["getrandom", "getrandom/js", "dep:ws_stream_wasm"]
getrandom = ["dep:getrandom"]
types = ["dep:http"]
reqwest = ["dep:reqwest", "types", "serde", "dep:url"]
serde = [
"dep:serde",
"dep:serde_json",
"dep:url",
"url/serde",
"dep:serde_with",
]
reqwest = ["dep:reqwest", "types", "serde"]
serde = ["dep:serde", "serde_json", "serde_with", "url/serde"]
serde_with = ["dep:serde_with"]
serde_json = ["dep:serde_json"]
gateway = ["serde", "types"]
_wasm_bindgen = ["wasm", "dep:wasm-bindgen", "dep:js-sys", "dep:wee_alloc"]
__no_wee_alloc = []

[dependencies]
der = { version = "0.7.9", features = ["pem"] }
getrandom = { version = "0.2.15", optional = true }
regex = "1.11.1"
reqwest = { version = "0.12.12", features = ["json", "zstd"], optional = true }
serde = { version = "1.0.217", optional = true, features = ["derive"] }
serde_json = { version = "1.0.137", optional = true }
reqwest = { version = "0.12.15", features = [
"json",
"zstd",
"rustls-tls-webpki-roots",
"charset",
"http2",
"macos-system-configuration",
"multipart",
], optional = true, default-features = false }
serde = { version = "1.0.219", optional = true, features = ["derive"] }
serde_json = { version = "1.0.140", optional = true }
spki = { version = "0.7.3", features = ["pem"] }
thiserror = "2.0.11"
thiserror = "2.0.12"
x509-cert = "0.2.5"
log = "0.4.25"
url = { version = "2.5.4", optional = true }
http = { version = "1.2.0", optional = true }
log = "0.4.27"
url = { version = "2.5.4" }
http = { version = "1.3.1", optional = true }
serde_with = { version = "3.12.0", optional = true }
hex = "0.4.3"
tokio = { version = "1.44.1", features = ["macros", "sync", "time", "rt"] }
webpki-roots = "0.26.8"
futures-util = "0.3.31"
urlencoding = "2.1.3"
ws_stream_wasm = { version = "*", optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = { version = "0.2.100", optional = true }
js-sys = { version = "0.3.77", optional = true }
wee_alloc = { version = "0.4.5", optional = true }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
rustls = "0.23.25"
tokio-tungstenite = { version = "0.26.2", features = [
"rustls-tls-webpki-roots",
"url",
] }

[dev-dependencies]
ed25519-dalek = { version = "2.1.1", features = ["rand_core", "signature"] }
env_logger = "0.11.6"
httptest = "0.16.1"
rand = "0.8.5"
tokio = { version = "1.43.0", features = ["full"] }
serde = { version = "1.0.217", features = ["derive"] }
serde_json = { version = "1.0.137" }
serde = { version = "1.0.219", features = ["derive"] }
serde_json = { version = "1.0.140" }
serde_test = "1.0.177"
polyproto = { path = "./", features = ["types", "reqwest", "serde"] }
env_logger = "0.11.7"

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
ws-mock = "0.3.0"
httptest = "0.16.3"


[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = "0.3.50"
wasm-bindgen = "0.2.100"
# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
# code size when deploying.
console_error_panic_hook = { version = "0.1.7" }

[target.'cfg(target_arch = "wasm32")'.release]
# Tell `rustc` to optimize for small code size.
opt-level = "s"
lto = true
codegen-units = 1
panic = "abort"

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin_include)'] }
36 changes: 29 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ crate.

## Implementing polyproto

Start by implementing the trait [crate::signature::Signature] for a signature algorithm of your
Start by implementing the trait `[crate::signature::Signature]` for a signature algorithm of your
choice. Popular crates for cryptography and signature algorithms supply their own `PublicKey` and
`PrivateKey` types. You should extend upon these types with your own structs and implement the
[crate::key] traits for these new structs.
`[crate::key]` traits for these new structs.

You can then use the [crate::certs] types to build certificates using your implementations of the
You can then use the `[crate::certs]` types to build certificates using your implementations of the
aforementioned traits.

**View the [examples](./examples/)** directory for a simple example on how to implement and use this
Expand Down Expand Up @@ -63,6 +63,10 @@ will have to use the `wasm` feature:
polyproto = { version = "0", features = ["wasm"] }
```

Additionally, you will have to compile the project using the `--no-default-features` flag, to ensure
that `tokio/net` is not pulled in as a feature dependency. The `types`, `serde`, `reqwest` and `gateway`
features all work with WASM.

## HTTP API client through `reqwest`

If the `reqwest` feature is activated, this crate offers a polyproto HTTP API client, using the
Expand All @@ -75,6 +79,28 @@ the `types` and `serde` features. Using these features, you can implement your o
the polyproto crate acting as a single source of truth for request and response types, as well as
request routes and methods through the exported `static` `Route`s.

## WebSocket Gateway client

Since `v0.10`, this crate ships polyproto WebSocket Gateway client functionality, gated behind the `gateway` feature.
The implementation of this feature is super backend-agnostic—though, for now, we have sealed the needed traits, and are only shipping a `tokio-tungstenite` backend for testing.

The gateway handles establishing a connection to the server, sending regular heartbeats at the specified interval and responding to Opcode 11—the manual heartbeat request.

Apart from the Hello payload, library consumers can easily get access to all messages received from the gateway by calling `subscribe()` on the internal `tokio::sync::watch::Sender<GatewayMessage>`. This means that this crate handles only the bare necessities of connecting to the gateway, and that you are free to handle incoming messages however you would like to. Our `GatewayMessage` type is `.into()` and `From::<>`-compatible with `tokio_tungstenite::tungstenite::Message`, so that you are not locked into using our message types, should you not want that.

## Versioning and MSRV

Semver v2.0 is used for the versioning scheme for this crate.

The default feature set of this crate is used to determine, verify and update the MSRV and semver version
of this crate.

## Logo

The polyproto logo was designed by the wonderful [antidoxi](https://antidoxi.carrd.co/).
The polyproto logos provided in this document are not covered by the MPL-2.0 license covering the rest
of this project.

[dev-status]: https://img.shields.io/static/v1?label=Status&message=Alpha&color=blue
[build-shield]: https://img.shields.io/github/actions/workflow/status/polyphony-chat/polyproto-rs/build_and_test.yml?style=flat
[build-url]: https://github.com/polyphony-chat/polyproto-rs/blob/main/.github/workflows/build_and_test.yml
Expand All @@ -85,7 +111,3 @@ request routes and methods through the exported `static` `Route`s.
[crates-link]: https://crates.io/crates/polyproto
[docs]: https://docs.polyphony.chat/Protocol%20Specifications/core/
[overview]: https://docs.polyphony.chat/Overviews/core/

## Logo

The polyproto logo was designed by the wonderful [antidoxi](https://antidoxi.carrd.co/).
10 changes: 9 additions & 1 deletion examples/ed25519_basic.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

// Example implementation of polyproto's signature and key traits for ed25519-dalek.
// This example is not complete and should not be copy-pasted into a production environment without
Expand All @@ -22,6 +22,10 @@ fn main() {
let priv_key = Ed25519PrivateKey::gen_keypair(&mut csprng);
println!("Private Key is: {:?}", priv_key.key.to_bytes());
println!("Public Key is: {:?}", priv_key.public_key.key.to_bytes());
println!(
"Public Key OID is: {:?}",
priv_key.public_key.algorithm_identifier()
);
println!();

// Create and sign a message
Expand Down Expand Up @@ -76,6 +80,10 @@ impl Signature for Ed25519Signature {
// We define the signature type from the ed25519-dalek crate as the associated type.
type Signature = Ed25519DalekSignature;

fn as_bytes(&self) -> Vec<u8> {
self.as_signature().to_vec()
}

// This is straightforward: we return a reference to the signature.
fn as_signature(&self) -> &Self::Signature {
&self.signature
Expand Down
Loading