MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / rejects_wrong_secret

Function rejects_wrong_secret

nodedb-cluster/src/auth/join_token.rs:192–205  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 3

nowFunction · 0.85
issue_tokenFunction · 0.85
duration_sinceMethod · 0.80

Tested by

no test coverage detected