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 secret cannot be decoded by crate::common::credential::Credential::private_key, or if build_auth_token fails (clock-before-epoch or, hypothetically, a breach caused by its own deadline validation).