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

Function wrong_key_fails

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

Source from the content-addressed store, hash-verified

485
486 #[test]
487 fn wrong_key_fails() {
488 let key1 = WalEncryptionKey::from_bytes(&[0x01; 32]).unwrap();
489 let epoch1 = *key1.epoch();
490 let key2 = WalEncryptionKey::from_bytes(&[0x02; 32]).unwrap();
491 let header = test_header(1);
492
493 let ciphertext = key1.encrypt(1, &header, b"secret").unwrap();
494 assert!(key2.decrypt(&epoch1, 1, &header, &ciphertext).is_err());
495 }
496
497 #[test]
498 fn wrong_lsn_fails() {

Callers

nothing calls this directly

Calls 3

test_headerFunction · 0.85
encryptMethod · 0.80
epochMethod · 0.45

Tested by

no test coverage detected