Skip to main content

Module entropy

Module entropy 

Source
Expand description

The entropy port: where idempotency nonces, agent tokens and identity seeds come from.

§Why a port for randomness

Three values a launch mints are random by requirement, and each has a different reason:

  • the clientToken nonce must never repeat across attempts, because a replayed token wedges an image in CREATING for fifteen hours (TRAP-1, crate::control::token);
  • the agent token is a bearer credential, so it must be unguessable;
  • the identity seeds are x25519 secrets.

Drawing them through Entropy rather than calling the OS pool inline keeps the use cases free of that I/O, and lets a test pin exactly which draw became which value.

§No weak default

Every production control plane gets OsEntropy (in microvms-edges) unless a caller swaps it, including one built over a caller’s transport. A plane with a deterministic source would mint repeating client tokens, which is the exact failure TRAP-1 exists to prevent, so the only way to get one is to ask for it by name.

Traits§

Entropy
A source of random bytes.

Functions§

launch_identity
A launch identity from two fresh seeds drawn from entropy.