Skip to main content

load_or_create_key

Function load_or_create_key 

Source
fn load_or_create_key(path: &Path) -> [u8; 32]
Expand description

Load the fallback encryption key, creating it on first use.

Random rather than derived. A derived key was no more secret — its inputs (hostname, $USER, a hardcoded salt) are readable by anyone who can read the ciphertext — and it silently changed when the machine was renamed or $USER was unset, which read to the user as being signed out for no reason.

If the key cannot be persisted the process still gets a usable key for this run; credentials written under it simply will not be readable next launch, which is the same outcome as today and better than refusing to store a token.

TRACES: UR-012 | IR-014 | UT-014