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

Function tampered_bundle_rejected

nodedb-cluster/src/auth/bundle.rs:112–122  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

110
111 #[test]
112 fn tampered_bundle_rejected() {
113 let secret = [0x3Cu8; 32];
114 let token_hash = [0x4Du8; 32];
115 let mut sealed = seal_bundle(b"real payload".to_vec(), &secret, &token_hash).unwrap();
116 // Flip first byte of bundle
117 sealed.bundle[0] ^= 0xFF;
118 assert_eq!(
119 open_bundle(&sealed, &secret, &token_hash).unwrap_err(),
120 BundleError::MacMismatch
121 );
122 }
123
124 #[test]
125 fn wrong_cluster_secret_rejected() {

Callers

nothing calls this directly

Calls 2

seal_bundleFunction · 0.85
to_vecMethod · 0.45

Tested by

no test coverage detected