5454 }
5555
5656 fn sign ( & self , header : & str , claims : & str ) -> Result < String , Error > {
57- let hmac = get_hmac_with_data ( & self , header, claims) ;
57+ let hmac = get_hmac_with_data ( self , header, claims) ;
5858 let mac_result = hmac. finalize ( ) ;
5959 let code = mac_result. into_bytes ( ) ;
6060 Ok ( base64:: encode_config ( & code, base64:: URL_SAFE_NO_PAD ) )
7979
8080 fn verify_bytes ( & self , header : & str , claims : & str , signature : & [ u8 ] ) -> Result < bool , Error > {
8181 let hmac = get_hmac_with_data ( self , header, claims) ;
82- hmac. verify_slice ( & signature) ?;
82+ hmac. verify_slice ( signature) ?;
8383 Ok ( true )
8484 }
8585}
@@ -119,7 +119,7 @@ mod tests {
119119 let expected_signature = "TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ" ;
120120
121121 let signer: Hmac < Sha256 > = Hmac :: new_from_slice ( b"secret" ) ?;
122- let computed_signature = SigningAlgorithm :: sign ( & signer, & header, & claims) ?;
122+ let computed_signature = SigningAlgorithm :: sign ( & signer, header, claims) ?;
123123
124124 assert_eq ! ( computed_signature, expected_signature) ;
125125 Ok ( ( ) )
@@ -133,7 +133,7 @@ mod tests {
133133
134134 let verifier: Hmac < Sha256 > = Hmac :: new_from_slice ( b"secret" ) ?;
135135 assert ! ( VerifyingAlgorithm :: verify(
136- & verifier, & header, & claims, & signature
136+ & verifier, header, claims, signature
137137 ) ?) ;
138138 Ok ( ( ) )
139139 }
0 commit comments