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

Function encrypt_file

nodedb/src/engine/timeseries/columnar_segment/encrypt.rs:19–22  ·  view source on GitHub ↗

Encrypt `plaintext` (a raw file body) and return the SEGT envelope.

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

Source from the content-addressed store, hash-verified

17
18/// Encrypt `plaintext` (a raw file body) and return the SEGT envelope.
19pub fn encrypt_file(key: &WalEncryptionKey, plaintext: &[u8]) -> Result<Vec<u8>, SegmentError> {
20 encrypt_segment_envelope(key, &SEGT_MAGIC, plaintext)
21 .map_err(|e| SegmentError::EncryptionFailed(e.to_string()))
22}
23
24/// Decrypt an encrypted columnar segment file blob (first bytes = `SEGT`).
25pub fn decrypt_file(key: &WalEncryptionKey, blob: &[u8]) -> Result<Vec<u8>, SegmentError> {

Callers 2

write_packedFunction · 0.85
maybe_encryptFunction · 0.85

Calls 2

encrypt_segment_envelopeFunction · 0.85
to_stringMethod · 0.80

Tested by

no test coverage detected