Skip to main content

build_auth_token_for

Function build_auth_token_for 

Source
pub fn build_auth_token_for(credential: &Credential) -> Result<String>
Expand description

Mint an auth token from a crate::common::credential::Credential using the default 7-hour TTL and a fresh CSPRNG nonce.

The token format matches the Go reference’s ConstructAuthToken. The returned string is the value the WebSocket subscribe handshake sends in the auth field of an account_* channel subscription.

§Errors

Returns the underlying crate::common::credential::Credential::private_key failure if the secret cannot be decoded, or any build_auth_token failure (clock-before-epoch or, hypothetically, a deadline-validation breach the helper itself sets).