Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
//! Associated data for ciphertext to bind it to the slot it belongs in.
/// The Account Key under the KEK.
pub const ACCOUNT_KEY: &[u8] = b"aliasvault/v1/account-key";
/// The personal manifest's VEK under the Account Key.
pub const PERSONAL_VEK: &[u8] = b"aliasvault/v1/vek";
/// The account RSA private key under the Account Key.
pub const ACCOUNT_PRIVATE_KEY: &[u8] = b"aliasvault/v1/account-private-key";
/// The account Ed25519 signing private key under the Account Key.
pub const ACCOUNT_SIGNING_PRIVATE_KEY: &[u8] = b"aliasvault/v1/account-signing-private-key";
/// The RSA-OAEP label of the Account Key a mobile app encrypts for a mobile login request's one-off public key.
pub const MOBILE_LOGIN_ACCOUNT_KEY: &[u8] = b"aliasvault/v1/mobile-login/account-key";
/// The RSA-OAEP label of the session payload key the server encrypts for a mobile login request's one-off public key.
pub const MOBILE_LOGIN_PAYLOAD_KEY: &[u8] = b"aliasvault/v1/mobile-login/payload-key";
/// A manifest payload under its manifest's VEK.
pub fn manifest(manifest_id: &str) -> Vec<u8> {
format!("aliasvault/v1/manifest/{}", normalize(manifest_id)).into_bytes()
}
/// A data bucket payload under its manifest's VEK.
pub fn bucket(manifest_id: &str, category: &str) -> Vec<u8> {
format!("aliasvault/v1/bucket/{}/{}", normalize(manifest_id), category).into_bytes()
}
/// A shared manifest's name under its manifest's VEK.
pub fn manifest_name(manifest_id: &str) -> Vec<u8> {
format!("aliasvault/v1/manifest-name/{}", normalize(manifest_id)).into_bytes()
}
/// A blob's bytes under its own blob key.
pub fn blob_data(manifest_id: &str, hash: &str) -> Vec<u8> {
format!("aliasvault/v1/blob/{}/{}", normalize(manifest_id), normalize(hash)).into_bytes()
}
/// A blob key under its manifest's VEK.
pub fn blob_key(manifest_id: &str, hash: &str) -> Vec<u8> {
format!("aliasvault/v1/blob-key/{}/{}", normalize(manifest_id), normalize(hash)).into_bytes()
}
/// The RSA-OAEP label of a grant: a manifest's VEK encrypted for one recipient key.
pub fn grant(manifest_id: &str) -> Vec<u8> {
format!("aliasvault/v1/grant/{}", normalize(manifest_id)).into_bytes()
}
/// The RSA-OAEP label of a shared manifest's name encrypted into an invitation for its recipient.
pub fn invitation_name(manifest_id: &str) -> Vec<u8> {
format!("aliasvault/v1/invitation-name/{}", normalize(manifest_id)).into_bytes()
}
/// An id as it appears in a label: lowercased, as the server prints a GUID.
pub(crate) fn normalize(id: &str) -> String {
id.to_ascii_lowercase()
}