Crate self_encryption_nodejs

Crate self_encryption_nodejs 

Source
Expand description

Node.js bindings for self-encryption.

This library provides Node.js bindings for the self-encryption library, which provides convergent encryption on file-based data and produces a DataMap type and several chunks of encrypted data. Each chunk is up to 1MB in size and has an index and a name. This name is the SHA3-256 hash of the content, which allows the chunks to be self-validating.

Storage of the encrypted chunks or DataMap is outside the scope of this library and must be implemented by the user.

Modules§

util

Structs§

ChunkInfo
This is - in effect - a partial decryption key for an encrypted chunk of data.
DataMap
Holds the information that is required to recover the content of the encrypted file. This is held as a vector of ChunkInfo, i.e. a list of the file’s chunk hashes. Only files larger than 3072 bytes (3 * MIN_CHUNK_SIZE) can be self-encrypted. Smaller files will have to be batched together.
EncryptFromFileResult
Result type for the encrypt_from_file function
EncryptResult
Result type for the encrypt function
EncryptedChunk
A JavaScript wrapper for the EncryptedChunk struct.
XorName
A 256-bit number, viewed as a point in XOR space.

Constants§

COMPRESSION_QUALITY
Controls the compression-speed vs compression-density tradeoffs. The higher the quality, the slower the compression. Range is 0 to 11.
MAX_CHUNK_SIZE
The maximum size (before compression) of an individual chunk of a file, defaulting as 1MiB.
MIN_CHUNK_SIZE
The minimum size (before compression) of an individual chunk of a file, defined as 1B.
MIN_ENCRYPTABLE_BYTES
The minimum size (before compression) of data to be self-encrypted, defined as 3B.

Functions§

decrypt
Decrypts data using chunks retrieved from any storage backend via the provided retrieval function.
decrypt_from_storage
Decrypts data using a DataMap and stored chunks.
encrypt
Encrypt raw data into chunks.
encrypt_from_file
Encrypt a file and store its chunks.
streaming_decrypt_from_storage
Decrypts data from storage in a streaming fashion using parallel chunk retrieval.
streaming_encrypt_from_file