()
| 190 | |
| 191 | #[test] |
| 192 | fn rejects_wrong_secret() { |
| 193 | let secret = [0x11u8; 32]; |
| 194 | let expiry = SystemTime::now() |
| 195 | .duration_since(UNIX_EPOCH) |
| 196 | .unwrap() |
| 197 | .as_secs() |
| 198 | + 60; |
| 199 | let hex = issue_token(&secret, 5, expiry).unwrap(); |
| 200 | let other = [0x22u8; 32]; |
| 201 | assert_eq!( |
| 202 | verify_token(&hex, &other).unwrap_err(), |
| 203 | TokenError::InvalidMac |
| 204 | ); |
| 205 | } |
| 206 | |
| 207 | #[test] |
| 208 | fn rejects_expired() { |
nothing calls this directly
no test coverage detected