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

Function wrong_lsn_fails

nodedb-wal/src/crypto.rs:498–506  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

496
497 #[test]
498 fn wrong_lsn_fails() {
499 let key = test_key();
500 let epoch = *key.epoch();
501 let header = test_header(1);
502
503 let ciphertext = key.encrypt(1, &header, b"secret").unwrap();
504 // Different LSN = different nonce = decryption fails.
505 assert!(key.decrypt(&epoch, 2, &header, &ciphertext).is_err());
506 }
507
508 #[test]
509 fn tampered_ciphertext_fails() {

Callers

nothing calls this directly

Calls 4

test_headerFunction · 0.85
encryptMethod · 0.80
test_keyFunction · 0.70
epochMethod · 0.45

Tested by

no test coverage detected