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§
Structs§
- Chunk
Info - 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. - Encrypt
From File Result - Result type for the encrypt_from_file function
- Encrypt
Result - Result type for the encrypt function
- Encrypted
Chunk - 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