()
| 273 | /// wall clock, identical to the CLI path. |
| 274 | #[test] |
| 275 | fn issue_token_with_duration() { |
| 276 | let secret = [0xBBu8; 32]; |
| 277 | let ttl = Duration::from_secs(300); |
| 278 | let now = SystemTime::now() |
| 279 | .duration_since(UNIX_EPOCH) |
| 280 | .unwrap() |
| 281 | .as_secs(); |
| 282 | let expiry = now + ttl.as_secs(); |
| 283 | let hex = issue_token(&secret, 3, expiry).unwrap(); |
| 284 | assert_eq!(hex.len(), TOKEN_HEX_LEN); |
| 285 | let (node, exp) = verify_token(&hex, &secret).unwrap(); |
| 286 | assert_eq!(node, 3); |
| 287 | assert!(exp >= now + ttl.as_secs() - 2); // allow 2s clock slack |
| 288 | } |
| 289 | } |
nothing calls this directly
no test coverage detected