Files
pubky-core/pubky-testnet
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
..
2025-03-17 15:58:58 -04:00
2025-02-20 09:07:38 -04:00
2025-02-13 20:15:12 +03:00

Pubky Testnet

A local test network for developing Pubky Core or applications depending on it.

All resources are ephemeral, databases are in the operating system's temporary directories, and all servers are closed as the testnet dropped.

Usage

Inline testing

use pubky_testnet::Testnet;

#[tokio::main]
async fn main () {
  // Run a new testnet.
  let testnet = Testnet::run().await.unwrap();

  // Optionally create and run a Homeserver.
  let server = testnet.run_homeserver().await.unwrap();

  // Optionally create and run an HTTP Relay.
  let http_relay = testnet.run_http_relay().await.unwrap();

  // Create a Pubky Client from the testnet.
  let client = testnet.client_builder().build().unwrap();
}

Binary (hardcoded testnet, and browser support).

If you need to run the testnet in a separate process, for example to test Pubky Core in browsers, you need to run this binary, which will create these components with hardcoded configurations:

  1. A local DHT with bootstrapping nodes: &["localhost:6881"]
  2. A Pkarr Relay running on port 15411
  3. A Homeserver with address is hardcoded to 8pinxxgqs41n4aididenw5apqp1urfmzdztr8jt4abrkdn435ewo
  4. An HTTP relay running on port 15412