-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
455 additions
and
87 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Testnet | ||
|
||
Example of using a testnet Homeserver. | ||
|
||
## Usage | ||
|
||
If you have a homeserver running in testnet mode, run: | ||
|
||
```bash | ||
cargo run --bin testnet | ||
``` | ||
|
||
If you want to run a Homeserver in testnet, check the `Testnet` section in the [Homeserver](../../pubky-homeserver/README.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//! Example of using a Testnet configuration in pubky Client | ||
use pubky::PubkyClient; | ||
use pubky_common::crypto::{Keypair, PublicKey}; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
let server_public_key = | ||
PublicKey::try_from("8pinxxgqs41n4aididenw5apqp1urfmzdztr8jt4abrkdn435ewo").unwrap(); | ||
|
||
let client = PubkyClient::testnet(); | ||
|
||
let keypair = Keypair::random(); | ||
|
||
client.signup(&keypair, &server_public_key).await.unwrap(); | ||
|
||
let url = format!("pubky://{}/pub/foo.txt", keypair.public_key()); | ||
let url = url.as_str(); | ||
|
||
client.put(url, &[0, 1, 2, 3, 4]).await.unwrap(); | ||
|
||
let response = client.get(url).await.unwrap().unwrap(); | ||
|
||
assert_eq!(response, bytes::Bytes::from(vec![0, 1, 2, 3, 4])); | ||
|
||
client.delete(url).await.unwrap(); | ||
|
||
let response = client.get(url).await.unwrap(); | ||
|
||
assert_eq!(response, None); | ||
|
||
println!("Successfully performed PUT, GET and DELETE requests to the testnet server") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[package] | ||
name = "pubky_homeserver" | ||
name = "pubky-homeserver" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters