fn sign_url(&self, mut url: Url, method: &http::method::Method, body: &[u8]) -> Url {
        let nonce = uuid::Uuid::new_v4(); // use UUID as random and unique nonce

        let timestamp = time::SystemTime::now()
            .duration_since(time::UNIX_EPOCH)
            .expect("SystemTime::duration_since failed")
            .as_secs();

        url.query_pairs_mut()
            .append_pair("apikey", &self.client_id)
            .append_pair("nonce", &format!("{}", nonce))
            .append_pair("timestamp", &format!("{}", timestamp));

        // create signature
        let mut hmac = Hmac::<Sha256>::new_from_slice(&self.client_secret.secret().as_bytes())
            .expect("HMAC can take key of any size");
        hmac.update(method.as_str().as_bytes());
        hmac.update(&[b'\0']);
        hmac.update(url.as_str().as_bytes());
        hmac.update(&[b'\0']);
        hmac.update(body);
        let signature: String = hmac.finalize().into_bytes().encode_hex();

        url.query_pairs_mut().append_pair("signature", &signature);

        url
    }
/// Signs the request based on a random and unique nonce, timestamp, and
/// client id and secret.
///
/// The client id, nonce, timestamp and signature are added to the url's
/// query.
///
/// See http://api-docs.letterboxd.com/#signing.
Signs the request based on a random and unique nonce, timestamp, and
client id and secret.

The client id, nonce, timestamp and signature are added to the url's
query.


Signs the request based on a random and unique nonce timestamp and client id and secret . The client id nonce timestamp and signature are added to the url ' s query .
fn sign_url(&self, mut url: Url, method: &http::method::Method, body: &[u8]) -> Url {
        let nonce = uuid::Uuid::new_v4(); // use UUID as random and unique nonce
        let timestamp = time::SystemTime::now()
            .duration_since(time::UNIX_EPOCH)
            .expect("SystemTime::duration_since failed")
            .as_secs();
        url.query_pairs_mut()
            .append_pair("apikey", &self.client_id)
            .append_pair("nonce", &format!("{}", nonce))
            .append_pair("timestamp", &format!("{}", timestamp));
        // create signature
        let mut hmac = Hmac::<Sha256>::new_from_slice(&self.client_secret.secret().as_bytes())
            .expect("HMAC can take key of any size");
        hmac.update(method.as_str().as_bytes());
        hmac.update(&[b'\0']);
        hmac.update(url.as_str().as_bytes());
        hmac.update(&[b'\0']);
        hmac.update(body);
        let signature: String = hmac.finalize().into_bytes().encode_hex();
        url.query_pairs_mut().append_pair("signature", &signature);
        url
    }
fn sign_url ( & self , mut url : Url , method : & http :: method :: Method , body : & [ u8 ] ) -> Url { let nonce = uuid :: Uuid :: new_v4 ( ) ; // use UUID as random and unique nonce let timestamp = time :: SystemTime :: now ( ) . duration_since ( time :: UNIX_EPOCH ) . expect ( " " ) . as_secs ( ) ; url . query_pairs_mut ( ) . append_pair ( " " , & self . client_id ) . append_pair ( " " , & format ! ( " " nonce ) ) . append_pair ( " " , & format ! ( " " timestamp ) ) ; // create signature let mut hmac = Hmac :: < Sha256 > :: new_from_slice ( & self . client_secret . secret ( ) . as_bytes ( ) ) . expect ( " " ) ; hmac . update ( method . as_str ( ) . as_bytes ( ) ) ; hmac . update ( & [ b'\0' ] ) ; hmac . update ( url . as_str ( ) . as_bytes ( ) ) ; hmac . update ( & [ b'\0' ] ) ; hmac . update ( body ) ; let signature : String = hmac . finalize ( ) . into_bytes ( ) . encode_hex ( ) ; url . query_pairs_mut ( ) . append_pair ( " " , & signature ) ; url }
Signs the request based on a random and unique nonce, timestamp, and
client id and secret.
Signs the request based on a random and unique nonce timestamp and client id and secret .
&self
url
Url
method
&http::method::Method
body
&[u8]
&self
url
Url
method
&http::method::Method
body
&[u8]