Encryption
AdonisJs provider to encrypt and decrypt values
![license-image](https://img.shields.io/aur/license/pac.svg?style=for-the-badge)
This module is used by AdonisJs to encrypt/decrypt values using a secret key.
Table of contents
Usage
Install the package from npm registry as follows:
npm i @adonisjs/encryption
yarn add @adonisjs/encryption
and then use it as follows:
import { Encryption } from '@adonisjs/encryption/build/standalone'
const encryption = new Encryption('verylongandrandom32characterskey', {})
const encryptedValue = encryption.encrypt('hello-world')
encryption.decrypt(encryptedValue)
Using with AdonisJs
The @adonisjs/core
module includes this module by default. However, here's how you can set it up manually.
const providers = [
'@adonisjs/encryption/build/providers/EncryptionProvider'
]
And then also register the typings file inside tsconfig.json
file.
{
"files": ["./node_modules/@adonisjs/encryption/build/adonis-typings/encryption.d.ts"]
}
And use it as follows:
import Encryption from '@ioc:Adonis/Core/Encryption'
Encryption.encrypt('password')
API Docs
Following are the autogenerated files via Typedoc
Maintainers
Harminder virk