1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! BEAM SEA Session Key Generator
//!
//! Generates a cryptographically random 32-byte master key for session encryption.
//! Output is base64-encoded, ready for the BEAM_SEA_SESSION_KEY environment variable.
//!
//! # Usage
//!
//! ```bash
//! # Generate a key and set it in your environment
//! export BEAM_SEA_SESSION_KEY=$(cargo run --bin beam-sea-keygen 2>/dev/null)
//!
//! # Or for systemd/docker:
//! BEAM_SEA_SESSION_KEY=$(cargo run --quiet --bin beam-sea-keygen)
//! ```
//!
//! # Deployment Checklist
//!
//! 1. Generate key once per deployment environment (dev/staging/prod)
//! 2. Store in secrets manager (e.g. systemd credentials, Docker secrets, Vault)
//! 3. Never commit the key to version control
//! 4. Rotate by clearing session directory and distributing new key
//!
use *;
use RngCore;