1.0.0 • Published 2 years ago

sqlsimplecipher v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

sqlsimplecipher

Encrypt and decrypt SQLite databases without SQLCipher installed

Based on bssthu/pysqlsimplecipher

Installation

npm install sqlsimplecipher

API

.decrypt

Decrypts an encrypted database contained inside a Buffer

sqlsimplecipher.decrypt(buffer: Buffer, password: string, configuration: SQLCipherConfiguration): Buffer;
sqlsimplecipher.decrypt(buffer: Buffer, key: Buffer, configuration: SQLCipherConfiguration): Buffer;

.decryptFile

Decrypts an encrypted database file and stores it in the file system

sqlsimplecipher.decryptFile(path: string, password: string, configuration: SQLCipherConfiguration): void;
sqlsimplecipher.decryptFile(path: string, key: Buffer, configuration: SQLCipherConfiguration): void;
sqlsimplecipher.decryptFile(inputPath: string, outputPath: string, password: string, configuration: SQLCipherConfiguration): void;
sqlsimplecipher.decryptFile(inputPath: string, outputPath: string, key: Buffer, configuration: SQLCipherConfiguration): void;

.encrypt

Encrypts a database contained inside a Buffer

sqlsimplecipher.encrypt(buffer: Buffer, password: string, configuration: SQLCipherConfiguration): Buffer;
sqlsimplecipher.encrypt(buffer: Buffer, key: Buffer, configuration: SQLCipherConfiguration): Buffer;

.encryptFile

Encrypts a database file and stores it in the file system

sqlsimplecipher.encryptFile(path: string, password: string, configuration: SQLCipherConfiguration): void;
sqlsimplecipher.encryptFile(path: string, key: Buffer, configuration: SQLCipherConfiguration): void;
sqlsimplecipher.encryptFile(inputPath: string, outputPath: string, password: string, configuration: SQLCipherConfiguration): void;
sqlsimplecipher.encryptFile(inputPath: string, outputPath: string, key: Buffer, configuration: SQLCipherConfiguration): void;

SQLCipherConfiguration

{
	kdf_iterations: number,
	kdf_algorithm: "sha1" | "sha256" | "sha512",
	hmac_algorithm: "sha1" | "sha256" | "sha512"
}