pub fn user_hash(key: &str) -> StringExpand description
Compute the per-user directory name for ~/.trustee/users/{hash}/.
Single definition of the user→hash mapping: SHA-256 of key, first 8
bytes interpreted big-endian, formatted as 16 lowercase hex chars.
Two input domains feed this one function:
- Web/API path: the authenticated
user_key(JWTsubclaim, ordev:emailin dev mode) — seetrustee-api’sServerState. - CLI path: the OS username (
$USER/$USERNAME, falling back to"unknown") — see thetrusteebinary’scompute_user_hash.
The two domains intentionally produce different hashes for the same directory tree; consolidating the algorithm here guarantees they cannot drift apart.