Module invite

Module invite 

Source
Expand description

Signed + password-encrypted invite tokens for network access control.

§Design

A BillPouch network is private by default. The only way to join is to receive an invite token from an existing member. The token:

  1. Contains the NetworkMetaKey — the 32-byte random secret that protects file metadata on the network.
  2. Is signed by the inviter’s Ed25519 key so the recipient can verify the invite is authentic.
  3. Is encrypted with a password shared out-of-band (Signal, phone call, etc.). The password is never stored anywhere.

§Wire format

hex(
  salt(16)            — Argon2id salt for password KDF
  || nonce(12)        — ChaCha20-Poly1305 nonce
  || ciphertext       — encrypt(
         payload_len(4, LE u32)
         || payload_json
         || ed25519_signature(64)
     )
)

§Usage

Inviter:

let blob = create_invite(&identity, "amici", None, 24, "shared-password").unwrap();
println!("{blob}");

Invitee:

let payload = redeem_invite("<blob>", "shared-password").unwrap();
save_invite_key(&payload).unwrap();  // writes NetworkMetaKey to disk

Structs§

InvitePayload
The plaintext content of an invite token.

Functions§

create_invite
Generate a signed + password-encrypted invite token for network_id.
redeem_invite
Decrypt, verify and parse an invite token.
save_invite_key
Persist the NetworkMetaKey from a redeemed invite to local storage.