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

Function encrypt_segment

nodedb-columnar/src/encrypt.rs:24–30  ·  view source on GitHub ↗

Encrypt `plaintext` (a complete plaintext segment buffer) and return the SEGC envelope.

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

Source from the content-addressed store, hash-verified

22/// Encrypt `plaintext` (a complete plaintext segment buffer) and return the
23/// SEGC envelope.
24pub(crate) fn encrypt_segment(
25 key: &WalEncryptionKey,
26 plaintext: &[u8],
27) -> Result<Vec<u8>, ColumnarError> {
28 encrypt_segment_envelope(key, &SEGC_MAGIC, plaintext)
29 .map_err(|e| ColumnarError::EncryptionFailed(e.to_string()))
30}
31
32/// Decrypt an encrypted columnar segment blob (starting at byte 0 = `SEGC`).
33///

Callers 1

write_segmentMethod · 0.50

Calls 2

encrypt_segment_envelopeFunction · 0.85
to_stringMethod · 0.80

Tested by

no test coverage detected