@@ -267,11 +267,11 @@ impl<Store: SessionStore> SessionMiddleware<Store> {
267
267
}
268
268
269
269
// the following is reused verbatim from
270
- // https://github.com/SergioBenitez/cookie-rs/blob/master/src/secure/signed.rs#L33-L43
270
+ // https://github.com/SergioBenitez/cookie-rs/blob/master/src/secure/signed.rs#L37-46
271
271
/// Signs the cookie's value providing integrity and authenticity.
272
272
fn sign_cookie ( & self , cookie : & mut Cookie < ' _ > ) {
273
273
// Compute HMAC-SHA256 of the cookie's value.
274
- let mut mac = Hmac :: < Sha256 > :: new_varkey ( & self . key . signing ( ) ) . expect ( "good key" ) ;
274
+ let mut mac = Hmac :: < Sha256 > :: new_from_slice ( & self . key . signing ( ) ) . expect ( "good key" ) ;
275
275
mac. update ( cookie. value ( ) . as_bytes ( ) ) ;
276
276
277
277
// Cookie's new value is [MAC | original-value].
@@ -281,7 +281,7 @@ impl<Store: SessionStore> SessionMiddleware<Store> {
281
281
}
282
282
283
283
// the following is reused verbatim from
284
- // https://github.com/SergioBenitez/cookie-rs/blob/master/src/secure/signed.rs#L45-L63
284
+ // https://github.com/SergioBenitez/cookie-rs/blob/master/src/secure/signed.rs#L51-L66
285
285
/// Given a signed value `str` where the signature is prepended to `value`,
286
286
/// verifies the signed value and returns it. If there's a problem, returns
287
287
/// an `Err` with a string describing the issue.
@@ -295,7 +295,7 @@ impl<Store: SessionStore> SessionMiddleware<Store> {
295
295
let digest = base64:: decode ( digest_str) . map_err ( |_| "bad base64 digest" ) ?;
296
296
297
297
// Perform the verification.
298
- let mut mac = Hmac :: < Sha256 > :: new_varkey ( & self . key . signing ( ) ) . expect ( "good key" ) ;
298
+ let mut mac = Hmac :: < Sha256 > :: new_from_slice ( & self . key . signing ( ) ) . expect ( "good key" ) ;
299
299
mac. update ( value. as_bytes ( ) ) ;
300
300
mac. verify ( & digest)
301
301
. map ( |_| value. to_string ( ) )
0 commit comments