Skip to main content

build_auth_token_for

Function build_auth_token_for 

Source
pub fn build_auth_token_for(credential: &Credential) -> Result<SecretString>
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 an error if the private key cannot be decoded, the system clock predates the UNIX epoch, deadline computation or validation fails, or the operating system’s random number source fails.