pub struct TokenRequest {
pub key_name: String,
pub ttl: Option<i64>,
pub capability: Option<String>,
pub client_id: Option<String>,
pub timestamp: i64,
pub nonce: String,
pub mac: String,
}Expand description
TokenRequest : A signed token request. The mac is HMAC-SHA256 (base64) over the newline-joined fields keyName, ttl, capability, clientId, timestamp, nonce (each followed by a newline, empty fields included) using the API key secret. A signed request needs no Authorization header.
Fields§
§key_name: StringThe API key name (appId.keyId) that signed this request.
ttl: Option<i64>Requested time-to-live in milliseconds.
capability: Option<String>A capability document as a JSON string (a stringified object mapping resource-name patterns to arrays of operations, e.g. {\"my-room\":[\"publish\",\"history\"]}). For a signed TokenRequest this string must be canonicalized (resource keys and operation arrays sorted, no whitespace) because it is part of the HMAC-signed text. See SPEC §13.
client_id: Option<String>The identity to bind the token to.
timestamp: i64Milliseconds since the Unix epoch when the request was created. Must be within ~2 minutes of Ably server time (see GET /time).
nonce: StringAn opaque, cryptographically-random string of at least 16 characters, unique per request (replay protection).
mac: StringBase64 HMAC-SHA256 signature over the canonical request text.
Implementations§
Source§impl TokenRequest
impl TokenRequest
Sourcepub fn new(
key_name: String,
timestamp: i64,
nonce: String,
mac: String,
) -> TokenRequest
pub fn new( key_name: String, timestamp: i64, nonce: String, mac: String, ) -> TokenRequest
A signed token request. The mac is HMAC-SHA256 (base64) over the newline-joined fields keyName, ttl, capability, clientId, timestamp, nonce (each followed by a newline, empty fields included) using the API key secret. A signed request needs no Authorization header.
Trait Implementations§
Source§impl Clone for TokenRequest
impl Clone for TokenRequest
Source§fn clone(&self) -> TokenRequest
fn clone(&self) -> TokenRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more