Skip to content

Commit

Permalink
fix(pkarr): add rand in wasm target
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuhvi committed Sep 22, 2024
1 parent 60fb3a1 commit d0be233
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkarr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ tracing = "0.1.40"
dyn-clone = "1.0.17"
lru = { version = "0.12.3", default-features = false }
serde = { version = "1.0.209", features = ["derive"], optional = true }
rand = { version = "0.8.5", optional = true }

document-features = "0.2.8"

Expand All @@ -27,7 +28,6 @@ document-features = "0.2.8"
mainline = { version = "2.0.1", optional = true }
flume = { version = "0.11.0", features = ["select", "eventual-fairness", "async"], default-features = false , optional = true }
tokio = { version = "1.40.0", optional = true }
rand = { version = "0.8.5", optional = true }
reqwest = { version = "0.12.7", features = ["rustls-tls"], optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
Expand Down
7 changes: 7 additions & 0 deletions pkarr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ Publish and resolve DNS packets over Mainline DHT.
## Get started

Check the [Examples](https://github.com/Nuhvi/pkarr/tree/main/pkarr/examples).

## WebAssembly support

This version of Pkarr assumes that you are running Wasm in a JavaScript environment,
and using the Relays clients, so you can't use it in Wasi for example, nor can you
use some Wasi bindings to use the DHT directly. If you really need Wasi support, please
open an issue on `https://git.pkarr.org`.
2 changes: 0 additions & 2 deletions pkarr/src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
use crate::{Error, Result};
use ed25519_dalek::{SecretKey, Signature, Signer, SigningKey, Verifier, VerifyingKey};
#[cfg(not(target_arch = "wasm32"))]
#[cfg(feature = "rand")]
use rand::rngs::OsRng;
use std::{
Expand All @@ -18,7 +17,6 @@ use serde::{Deserialize, Serialize};
pub struct Keypair(SigningKey);

impl Keypair {
#[cfg(not(target_arch = "wasm32"))]
#[cfg(feature = "rand")]
pub fn random() -> Keypair {
let mut csprng = OsRng;
Expand Down

0 comments on commit d0be233

Please sign in to comment.