apiref
@dtinth/encrypted@0.3.1

@dtinth/encrypted  EntryPoint

A convenient module to let you store keys directly inside source code in encrypted form.

Remarks

This package comes with a CLI to let you easily encrypt things from the command line. For more information, please check out the project documentation at https://docs.dt.in.th/encrypted/.

Note: This module trades security for convenience. Please exercise caution when using this module.

Example

Using the this package to store keys directly inside source code in encrypted form:

const encrypted = require('@dtinth/encrypted')()
const accessKeyId = encrypted`H7WwoocLJnbDgKk1+5vH47JvLp49FQZn.0KlZf2igr
h8hzoKG9zGv1t9rmrUZ4PYftuOy3lV96ygthjpFBlQ=`
const secretAccessKey = encrypted`pg2ozvrK9nun1TGuycfCAV50qgjdgc3Y.WSweW
kty/OSqppfOcbTEGn0jmdoHy+6fCkV0cnij9S7UVC0rihIygjFZ5S8TBYd8+Rl8LEKLDDuSF
A==`

The encryption keys will be loaded from the environment variable ENCRYPTION_SECRET.

Functions

FunctionDescription
Encrypted(psk)Creates a CipherDecipher instance.

Interfaces

InterfaceDescription
CipherDecipherAn object generated by the Encrypted() function that can be used to encrypt and decrypt any JSON-serializable data. This object has already been configured with a key when it was created.