Commit Graph

467 Commits

Author SHA1 Message Date
Severin Alexander Bühler
44eb42dd9a Fix: Rate limit - can not extract user limit key & memory leak (#127)
* before ThrottledBody

* added upload rate limiting

* before dynamic rate limiting

* flexible rate limiter + config

* fixed tests

* fmt and clippy

* reset auth.js e2e

* more cleaning up

* improved code and added comments

* limit downloads too

* fmt and clippy

* improved sample comments

* fixed comment

* removed http dependency in favour of axum:http

* parse speed units as lowercase

* replaced regex with glob

* clippy and fmt

* fix: user rate limiting finding limit key

* fmt

* turn **/* patterns into **

* improved cleanup task
2025-05-14 10:05:01 +03:00
SHAcollision
1be8bf5e9e Fix(homeserver): session expired on browser restart (#125)
* fix: session expired on browser restart

* expire at 1 year

* Update pubky-homeserver/src/core/routes/auth.rs

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>

---------

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>
2025-05-13 11:39:16 +02:00
Severin Alexander Bühler
8a0cec71ef feat: Flexible endpoint rate limiting (#124)
* before ThrottledBody

* added upload rate limiting

* before dynamic rate limiting

* flexible rate limiter + config

* fixed tests

* fmt and clippy

* reset auth.js e2e

* more cleaning up

* improved code and added comments

* limit downloads too

* fmt and clippy

* improved sample comments

* fixed comment

* removed http dependency in favour of axum:http

* parse speed units as lowercase

* replaced regex with glob

* clippy and fmt
2025-05-13 11:06:23 +03:00
SHAcollision
00aafb2163 fix(client): signup-publish-retry-flexible (#120)
* feat(client): signup-publish-retry-flexible

* fix wasm

* Retry on known query errors fixed 3 attemps 1s

* simplify
2025-05-08 13:27:11 +02:00
SHAcollision
64d003c235 feat(homeserver): add info endpoint (#118)
* feat(homeserver): add info endpoint

* fix clippy
2025-05-05 09:47:07 +02:00
SHAcollision
d3b9cf0f69 chore(homeserver): unify source of default config (#116)
* chore(homeserver): unify source of default configs

* add docstring

* introduce serde toml merge

* Fix defaults to be None

* simplify remove once cell

* add sample config

* fix and validate sample config

* Update pubky-homeserver/src/data_directory/config_toml.rs

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>

* Update pubky-homeserver/src/data_directory/config_toml.rs

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>

* Update pubky-homeserver/src/data_directory/persistent_data_dir.rs

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>

* fix

---------

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>
2025-05-02 11:46:59 +02:00
Severin Alexander Bühler
ec40609d11 fix (homeserver): disable relays when republishing user keys to avoid rate limiting (#117) 2025-05-01 15:15:54 +03:00
Severin Alexander Bühler
639eec4d26 fix(homeserver): move exposed admin endpoints behind pw protection (#115)
* move exposed admin endpoints behind pw protection

* removed /admin path

* fmt

* fixed tests

* fmt

* fixed singuptoken url in js client
2025-04-29 17:25:46 +03:00
SHAcollision
b3c134c73e feat(homeserver): add user disk quota (#108)
* Add user disk quotas

* fix extract helpers

* Add tests

* improve err message

* pr review fixes

* small fixes

* PR fixes

* fix unnecesary clone

* fix default user bug
2025-04-29 10:10:49 +02:00
Severin Alexander Bühler
1613c625ea feat(homeserver): Admin delete entry + ban user endpoints (#110)
* moved changes over from feat/moderation

* fixed test

* changed label for webapi

* small fixes

* fixed delete_entry status code

* use axum statuscodes

* tested events

* fmt

* valid /pub in handler, not route path

* added used_bytes to migration

* fmt

* fixed tests
2025-04-29 09:42:55 +03:00
Severin Alexander Bühler
bafa89f395 feat(homeserver): Set default icann_domain to localhost (#112) 2025-04-28 09:59:40 +03:00
Severin Alexander Bühler
8c6e3caf17 feat: Make config headers optional (#106)
* make config headers optional

* fmt and clippy
2025-04-23 13:24:00 +03:00
Severin Alexander Bühler
d4d44f7898 feat: add ability to configure hs config with statictestnet (#104) 2025-04-21 13:38:01 +03:00
Severin Alexander Bühler
f6f2ce6203 fix: trim secret when reading (#105) 2025-04-21 10:54:23 +03:00
SHAcollision
606ee5feb7 Bump to next release candidate 2025-04-18 10:29:07 +02:00
Severin Alexander Bühler
55d52ec4b8 chore(homeserver): Refactor Core (#96)
* first draft

* config2 for the time being

* more refactoring

* write default config if it doesnt exist

* added relays to config

* some refactor

* proper bootstrap nodes and relay config validation

* small comments

* rename module

* renamings

* turn listen_ports to listen_socket

* connected config with homeserver

* cleaned up old config

* cleaned up config_old

* removed old config.example.toml

* cleanup tryfrom conversions

* removed dirs-next

* review cleanup

* extracted default config to its own toml file

* use hostname_validator for rfc1123 domain verification

* Domain struct

* fmt

* small config restructure

* use SignupMode in config and moved it to config dir

* moved and simplified lmdb

* save to switch branches

* lots done already

* missin lock file

* pkarr config

* constants

* app context

* used context in more places

* made homeserver independant

* testing feature

* added datadirmock

* getting the hang about testing

* fixed homeserver core tests

* added HandleHolder

* make the homeserver tasks stop when its dropped

* make server handles optional

* properly cleanup all background tasks

* moved logs

* fixed config default toml

* fmt, clippy

* moved stuff around

* lots of moving and readme

* fixed pkarr republisher tests

* removed docs from include

* fixed and refactored testnet

* make simple_testnet work

* httprelay shutdown

* different testnets

* fixing tests1

* fixing tests

* fixing more tests

* unified pkarr versions

* fixed config with bootstrap nodes and relays

* split up test_republish_on_signin to prevent timing issues

* fixed all tests in e2e?

* fixed multi publisher tests

* fixed pubky-client readme

* fixed testnet readme

* added better errors

* admin error

* fixed tests

* format

* clippy

* cllippy

* fixed testnet ports

* fixed client future issue

* improved testnet

* fixed cache_size pkarr relay issue

* small improvements

* fixed low prio dns record

* removed fixed testnet test due to port conflicts

* fixed browserify issues

* fmt

* clippy

* changed wait for testnet hs admin

* fixed docs clippy issues

* added comments

* moved icann_domain

* renamed datadirs

* implemented default for MockDataDir

* renamed run() to start()

* removed unwraps

* fmt

* fixed rename test

* cleaned up admin trace

* added santity values for periodic backup conf and user keys republisher

* fmt

* fmt

* fixed readme lint

* removed println

* fixed admin server edge to anyhow

* added ipv6 support

* removed unnecessary expects

* renamed testnet

* fmt

* renamed me

* changed import

* fmt
2025-04-18 10:00:43 +03:00
Severin Alexander Bühler
6ad1509263 fix(homeserver): simplified config with serde(default) (#95)
* simplified config with serde(default)

* removed signupmode display
2025-03-26 17:07:26 +02:00
SHAcollision
283a38e9cc feat(homeserver): fallback missing pubky-host header to query param (#94)
* feat(homeserver): fallback missing pubky-host header to query param

* fix: host and overwrite with pubky-host

* add query pubky-host test
2025-03-26 09:33:40 -04:00
SHAcollision
8b0094ae6a fix(docs): legacy microseconds on record age docstring 2025-03-25 10:07:25 -04:00
SHAcollision
a021813f18 fix(docs): fix cache action (#93) 2025-03-25 08:21:59 -04:00
SHAcollision
2363089ef4 feat(homeserver): add backup service (#92)
* feat(homeserver): add backup service

* Fix PR review

* fix: make lmdb backup interval a config

* fix change default backup to disabled
2025-03-25 08:13:49 -04:00
Severin Alexander Bühler
5eb61d589b chore(homeserver): Refactor config (#91)
* first draft

* config2 for the time being

* more refactoring

* write default config if it doesnt exist

* added relays to config

* some refactor

* proper bootstrap nodes and relay config validation

* small comments

* rename module

* renamings

* turn listen_ports to listen_socket

* connected config with homeserver

* cleaned up old config

* cleaned up config_old

* removed old config.example.toml

* cleanup tryfrom conversions

* removed dirs-next

* review cleanup

* extracted default config to its own toml file

* use hostname_validator for rfc1123 domain verification

* Domain struct

* fmt

* small config restructure

* use SignupMode in config and moved it to config dir
2025-03-25 09:44:05 +02:00
Severin Alexander Bühler
6f94333101 chore: Renamed pubky member dir to pubky-client (#90)
* chore: Renamed pubky member dir to pubky-client

* fixed paths

* fixed wasm test workflow
2025-03-21 14:24:34 +02:00
Severin Alexander Bühler
ca0995cb23 chore: Moved e2e tests / Fixes circular dependency (#88)
* moved e2e tests

* moved e2e tests to its own workspace member

* fmt
2025-03-21 13:15:33 +02:00
SHAcollision
8e1056c397 chore: prepare release 2025-03-20 15:23:18 -04:00
Severin Alexander Bühler
6c4821fe7a fix (pkarr-republisher): Include in Github workflow (#89) 2025-03-20 13:08:28 +02:00
Severin Alexander Bühler
3e761720de Feat(client): getHomeserver (#86)
* added method

* added wasm rust analyzer section

* getHomeserver wasm

* updated readme

* getHomeserver js test

* correct js typing

* fixed js getHomeserver call

* fmt and clippy

* Update pubky/README.md

Co-authored-by: SHAcollision <127778313+SHAcollision@users.noreply.github.com>

* moved get_homeserver from internal to auth

* reuse extract_host_from_packet

* removed unused imports

* removed version from testnet

* fixed tests

---------

Co-authored-by: SHAcollision <127778313+SHAcollision@users.noreply.github.com>
2025-03-19 11:17:13 +02:00
Severin Alexander Bühler
5393b4575a feat: Pkarr republisher for user and homeserver keys (#85)
* added bin folder

* removed published_secrets.txt

* added single key publisher

* read and republish

* some changes

* made everything nice

* added RetrySettings

* added resilient client

* fmt

* renamed package

* readme

* added user key republisher

* fmt

* extracted DB and homeserver core from mod

* homeserver packet republish periodically

* small changes

* with final message

* conditional republish

* fmt

* clippy

* moved bin to examples

* improved readme

* handle relay only clients

* handled no dht available

* ignore corrupt users

* handle heed entry errors

* improved unwraps

* fixes

* fixes

* added republish interval to config

* use warn when some keys are missing

* removed old todo

* fixes

* fmt

* fix relays

* use resilient client in homeserverkeyrepublisher

* moved some news to default

* more defaults

* fixed tests

* fmt

* test

* removed resilient client for homeserver publish again

* clippy

* made code simpler

* refactored code

* added .vscode to gitingore

* resutlt match
2025-03-18 17:07:07 +02:00
SHAcollision
6386f1ae43 feat: signup tokens (#80)
* Add admin and signup config

* Add signup tokens API, db, admin endpoint

* Add client api for signup codes

* Add tests and fixes

* Fix wasm build

* Lint

* enable and use same admin pswd on all test homeservers

* fix pr review comments

* Add nodejs and browser signup token to tests

* update signup example

* admin authing as layer

* Update pubky-homeserver/src/core/routes/auth.rs

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>

* Update pubky-homeserver/src/core/routes/auth.rs

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>

* rename getSignupToken util

* add is_used() SignupToken method

---------

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>
2025-03-17 15:58:58 -04:00
SHAcollision
b685f8a085 feat: client api for pkarr record republishing (#79)
* feat: add public method to repub homeserver and repub on signin

* Add extract host unit test

* refactor and expose to wasm

* lint

* Fixes add republish tests

* Use pubky timestamp

* Fix wasm spawn

* update republish min time

* fix wasm build

* fix: change republish wasm apii to expect public key

* Update pubky/src/native/internal/pkarr.rs

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>

* Update pubky/src/native/internal/pkarr.rs

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>

* r record to s signed_packet

* clean up determine host

* fix max_record_age api and change to 1h

---------

Co-authored-by: Severin Alexander Bühler <8782386+SeverinAlexB@users.noreply.github.com>
2025-03-17 10:46:33 -04:00
SHAcollision
3407a90756 chore(tests): add wasm tests to CI (#83)
* ci: add WASM testing workflow to GitHub Actions

* ci: enhance WASM testing workflow with testnet startup and cleanup

* ci: enhance testnet setup and testing workflow with improved logging and connectivity checks

* trying something different

* fix: skip testing browser

---------

Co-authored-by: Miguel Medeiros <miguel@miguelmedeiros.com.br>
2025-02-28 19:57:10 -03:00
SHAcollision
bb310d46d1 fix: improve start up times in some environments (#76) 2025-02-22 18:37:37 -04:00
SHAcollision
00fbd47cb8 chore: add doctests to CI (#77) 2025-02-22 15:48:14 -03:00
Miguel Medeiros
a74dc347b4 ci: split workflows and improve CI efficiency (#75)
* feat: add parallel PR check workflow

* fix: remove branch restriction for PR check workflow

* fix: suppress clippy warnings for needless lifetimes in CI workflows

* refactor: consolidate Clippy checks and streamline test workflows

* feat: add documentation workflow and remove legacy Rust CI workflow

* feat: trigger PR check workflow on push to main branch

* fix: update test command to use CI profile in PR check workflow

* fix: enhance test command with partitioning and retries for improved performance

* fix: remove partitioning from test command in PR check workflow

* fix: update test job to use matrix strategy for multiple crates

* fix: enhance test command with additional options for better output and error handling

* fix: remove silent mode from test command for clearer output

* fix: add check for existing tests before running in PR check workflow

* fix: add missing fi statement to close if condition in PR check workflow

* fix: improve test command logic to handle no tests found scenario
2025-02-21 16:51:00 -04:00
SHAcollision
bc7c723439 fix(tests): update apis on docs (#73) 2025-02-21 06:39:54 -04:00
SHAcollision
2f42481e4f chore: release 2025-02-20 09:07:38 -04:00
SHAcollision
c7f4292519 chore(deps): bump pkarr to 3.3.3 (#72) 2025-02-20 08:53:42 -04:00
SHAcollision
3489a88ed5 chore(deps): bump testnet pkarr relay to latest (#70)
* chore(deps): bump testnet pkarr relay to latest

* Pin commit height
2025-02-19 07:38:35 -04:00
SHAcollision
7e87e02ae9 chore(deps): bump pkarr to v3.3.1 pkarr-relay to v0.5.6 (#69)
* chore(deps): bump pkarr to v3.3.1 pkarr-relay to v0.5.6

* deps(testnet): force deps from workspace members
2025-02-18 07:00:39 -04:00
James
16fc27126d Merge pull request #67 from pubky/catch-21/dockerfile-testnet
fix: Dockerfile build pubky-testnet
2025-02-13 18:11:26 +00:00
nazeh
d98fb8e04d chore: fix lint issue 2025-02-13 21:06:11 +03:00
nazeh
2c8682e3a9 chore: Release 2025-02-13 21:00:47 +03:00
nazeh
7ef1020a41 chore(testnet): prepare for release 2025-02-13 20:59:55 +03:00
nazeh
49108e21d8 chore(js): publish @synonymdev/pubky@0.4.0 2025-02-13 20:57:00 +03:00
nazeh
f1d4125d29 chore: Release 2025-02-13 20:49:11 +03:00
nazeh
304f73dbc2 chore(homeserver): update Cargo.toml 2025-02-13 20:29:38 +03:00
nazeh
d5ff45127d chore(homeserver): prepare for release 2025-02-13 20:18:58 +03:00
nazeh
44ae44c2b2 chore(testnet): prepare for release 2025-02-13 20:15:12 +03:00
James Browning
98e51b4389 fix: dockerfile builds either pubky-homeserver or pubky-testnet 2025-02-13 17:13:21 +00:00
nazeh
1435fe8686 chore(homeserver): prepare for release 2025-02-13 19:13:40 +03:00