Skip to main content

encode_vault_device_cookie

Function encode_vault_device_cookie 

Source
pub fn encode_vault_device_cookie(
    cookie_signing_key: &SigningKey,
    kid: &str,
    pubkey: &[u8; 32],
    exp: i64,
) -> String
Expand description

Encode a __Secure-VaultDevice cookie value.

Format: base64url( kid[8 ASCII bytes] || exp[8 bytes, big-endian i64] || pubkey[32 bytes] || sig[64 bytes] )

kid identifies the rotation slot. exp is a Unix timestamp; the server rejects the cookie when now >= exp without touching the signature. The signed message covers kid || exp || pubkey so expiry cannot be forged.