What it is
Peer-to-peer networking for applications that keep their own data. The application brings its own request and response types, its own storage and its own policy; the crate brings the wire.
Every identifier on the wire or under a signature comes from a Profile. WEIRDNET is the default (/weirdnet/net/1, wnet-x1-offer:, port 4747 and so on). Key cryptography is not here: every derivation, seal and open goes through weirdnet-keys.
What is in it
node: aNode<Q, R>over TCP and QUIC (or an in-memory transport for tests) with Noise and Yamux, mDNS, Kademlia, identify, ping, a relay client and an opt-in relay server, DCUtR hole punching and AutoNAT. The swarm runs on its own thread; the handle is blocking. Requests are the application’sQ, answers itsR(CBOR).exchange: signed offers and answers (Ed25519 node keys, fresh X25519 keys), the derived exchange key, a ten-digit short code and a fingerprint to compare out of band, tokens and links, scopes with an expiry, sealed messages bound to the exchange and direction.sealed: send a sealed request through the application’s envelope and open the answer (call), and answer one only for the exchange’s own, Noise-authenticated peer (serve).invite: invitation automation: connect, offers answered on the spot or kept for the owner, poll and settle, crossing offers settled on one exchange, trust on first use and impostor warnings.identity,user,sync,shard,addr: node identities, user certificates, revocations, cards and link grants, the linked-node sync key, dark-shard blobs and address helpers.
Example
use weirdnet_net::{WEIRDNET, Keypair, exchange::Token, profile::invite_scope};
let (anna, ben) = (Keypair::generate_ed25519(), Keypair::generate_ed25519());
let p = &WEIRDNET;
let (offer, secret) = p.offer(&anna, "anna", vec![], invite_scope("garden", "member"), 0, 60_000).unwrap();
let link = p.link(&p.offer_token(&offer).unwrap());
let Token::Offer(seen) = p.parse_token(&link).unwrap() else { unreachable!() };
p.verify_offer(&seen, 1).unwrap();
let (answer, on_ben) = p.answer(&ben, &seen, "ben", vec![], 1).unwrap();
let on_anna = p.complete(&answer, &offer, &secret[..]).unwrap();
assert_eq!(on_anna.short_code, on_ben.short_code);Where it fits
- Builds on weirdnet-keys.
- Used by Morph, Muninn, weirdnet-relay.
- Extracted from Muninn.
- License: BSD-3-Clause.
Not audited. Tested over libp2p’s in-memory transport with real Noise, Yamux and request-response. See
SECURITY.md in the repository for what the crate enforces and what it leaves to the application.