apiref
@dtinth/encrypted@0.3.1

CipherDecipher  Interface

An 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.

Signature

export interface CipherDecipher 

Remarks

This object is callable. If called directly, it will call the CipherDecipher.decrypt() function.

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==`

Methods

MethodDescription
decrypt(payload)Decrypts the data.
encrypt(data)Encrypts the data.