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

Function array_segment_encrypted_at_rest

nodedb-array/src/segment/writer.rs:225–236  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

223
224 #[test]
225 fn array_segment_encrypted_at_rest() {
226 let s = schema();
227 let mut w = SegmentWriter::new(0xCAFE);
228 w.append_sparse(TileId::snapshot(1), &sparse_tile(&s))
229 .unwrap();
230 let kek = test_kek();
231 let bytes = w.finish(Some(&kek)).unwrap();
232 // Output must start with SEGA, not NDAS.
233 assert_eq!(&bytes[..4], b"SEGA");
234 // Must not start with plaintext NDAS magic.
235 assert_ne!(&bytes[..4], b"NDAS");
236 }
237
238 #[test]
239 fn array_segment_refuses_plaintext_with_kek() {

Callers

nothing calls this directly

Calls 6

snapshotFunction · 0.85
sparse_tileFunction · 0.85
append_sparseMethod · 0.80
schemaFunction · 0.70
test_kekFunction · 0.70
finishMethod · 0.45

Tested by

no test coverage detected