Skip to main content

compute_token_hmac

Function compute_token_hmac 

Source
pub fn compute_token_hmac(secret_key: &[u8], token_id: &str) -> Vec<u8> ⓘ
Expand description

A delegation token’s HMAC: HmacSHA512 over the token id’s UTF-8 bytes.

The HMAC is keyed with the secret key’s bytes, as Kafka’s DelegationTokenManager.createHmac computes it. The result is 64 bytes, and its base64 is the SCRAM password a client authenticates with. HMAC accepts a key of any length, so this cannot fail.