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

Function encrypt_checkpoint

nodedb-vector/src/collection/checkpoint.rs:44–53  ·  view source on GitHub ↗

Encrypt `plaintext` into the SEGV envelope from [`nodedb_wal::crypto`].

(
    key: &nodedb_wal::crypto::WalEncryptionKey,
    plaintext: &[u8],
)

Source from the content-addressed store, hash-verified

42
43/// Encrypt `plaintext` into the SEGV envelope from [`nodedb_wal::crypto`].
44fn encrypt_checkpoint(
45 key: &nodedb_wal::crypto::WalEncryptionKey,
46 plaintext: &[u8],
47) -> Result<Vec<u8>, VectorError> {
48 nodedb_wal::crypto::encrypt_segment_envelope(key, &SEGV_MAGIC, plaintext).map_err(|e| {
49 VectorError::CheckpointEncryptionError {
50 detail: e.to_string(),
51 }
52 })
53}
54
55/// Decrypt an encrypted checkpoint blob (starting at byte 0, which is `SEGV`).
56fn decrypt_checkpoint(

Callers 1

checkpoint_to_bytesMethod · 0.85

Calls 2

encrypt_segment_envelopeFunction · 0.85
to_stringMethod · 0.80

Tested by

no test coverage detected