versa
Module to provide encryption/decryption profiles.
*** Still awaiting a third-party audit! ***
npm install versa
Usage
Programmatically
Encryption/Decryption Profile Examples
var Versa = ; /* If you don't set any options (you don't// have to,) then Versa will fill in what's// necessary. Versa-generated passwords are// 2048 bytes long using the randomBytes// method of the native Crypto module (unless// you specify the 'size', the minimum is 16// bits in size with no ceiling limit.)// Whether you specify the profile or not,// be sure to back it up for future use!*/console;// AES-256-CBC with 2048-bit password:// { algorithm: 'aes-256-cbc',// password: <Buffer 8f 35 a0 40 ... > } console;// AES128 with 2048-bit password:// { algorithm: 'aes128',// password: <Buffer f5 d4 01 97 ... > } console;// AES-256-CBC with 1337-bit password:// { algorithm: 'aes-256-cbc',// password: <Buffer 28 cf 03 6b ... > } console;// AES-256-CBC with 16-bit password:// { algorithm: 'aes-256-cbc',// password: <Buffer bc 99 fa 4b ... > } console;// AES-256-CBC with a String password:// { algorithm: 'aes-256-cbc',// password: 'my application\'s secret code' } console;// AES-256-CBC with a Buffer password:// { algorithm: 'aes-256-cbc',// password: <Buffer 6d 79 20 61 ... > } console;// AES-256-CBC with a JSON-parsed Buffer password:// { algorithm: 'aes-256-cbc',// password: <Buffer 6d 79 20 61 > }
Padding Examples
var Versa = ; /* Using modulus, further obscure your encrypted// payloads by increasing their byte lengths toward// an incremented amount. Versa will serialize your// message within a larger-looking payload of junk// bytes from Crypto's randomBytes method. When// decrypting, Versa will parse out and return your// original message. Because of the serialization and// parsing approaches, Versa will only decrypt it's// own encrypted payloads.*/ var note = ;var message = "Hey!.. here's some information!"; var encrypted = note;// This results with a 32-bit encrypted buffer. While// it is encrypted, it can be guessed that the message// is small.// <Buffer f6 aa 95 19 ... > var hidden = note;// This results with a 528-bit encrypted buffer. Unlike// 'encrypted' above, it eliminates the ability to guess// the size or scale of the original message.// <Buffer 3d 7f 2a 7a ... > console; // Hey!.. here's some information!console; // Hey!.. here's some information!// Both the above decrypt back to the original message,// but by "hiding" the message, the two instead look// unrelated.
Pipe Examples
var FS = ;var Versa = ;var resource = ; /* Here's a simple pipe example, something like// you'd use with the native Crypto module. Once// the pipe is done, we save the encryption/// decryption profile. We won't worry about the// password used to encrypt/decrypt, we back it// and its algorithm up somewhere where we can// access them later. This example writes the// profile locally (alongside the encrypted file)// but you can save it wherever is secure for// you and your application.*/FS;