pub fn recover_file_key(
amk: &Amk,
core: &ManifestCore,
) -> Result<[u8; 32], CryptoError>Expand description
Recover the file key of the original a manifest describes, honouring its key_mode.
amk is the AMK of the epoch the manifest was written under (core.amk_version); the
caller resolves it, because where the epoch keys live differs per reader (a workspace’s
album, a backup artifact’s ledger, a share link’s album grant). A derived original
re-derives HKDF(AMK, file_id ‖ nonce_prefix); a wrapped one — an adopted web-upload
drop, whose key a guest chose and nobody can derive — unwraps wrapped_file_key under the
AMK. Every reader that recovers an original’s key goes through here, so no reader can
silently assume derived.
Fail-closed: a wrapped manifest without a wrapped_file_key is
CryptoError::Malformed; a key that does not open is CryptoError::Auth.