Typescript node module for data encryption
The wmt-encryption module provides aes-256-gcm encryption for JavaScript applications.
- git clone git@bitbucket.org:wmtp/wmt-encryption.git
- cd wmt-encryption
- npm install
The module uses Typescript compiler (TSC) to compile the source code.
To build the project run the following command:
- npm run build
You can install the module into your own JavaScript project as a dependency.
After you clone the module you can install using the following command:
- npm install /absolute/path/to/wmt-encryption
- i.e. -> npm install /Users/wmt/Documents/projects/npm/wmt-encryption
Use the following command to install from npm:
- npm install wmt-encryption
Once you have the module installed you can import exported functions into your code like so:
``javascript`
import {generateKeyFromString, encrypt, decrypt} from "wmt-encryption";
Example of using the module:
`javascript
// import the module
import {generateKeyFromString, encrypt, decrypt} from "wmt-encryption";
// create something
let somePlainText = "some plain text";
// generate key from some pin
let key = generateKeyFromString("1234");
// encrypt data
let encryptedText = encrypt(somePlainText, key); // encryptedText: "6dd34283b31adfa7fd5ec507d72e33b9"
// decrypt data
let decryptedText = decrypt(encryptedText, key); // decryptedText: "some plain text"
`
- Tests can be ran with the npm test` command.
- Tests are ran using Jest - More information about getting started with Jest can be found here.
Here you can find the API docs that detail all functions of this module:
https://wmtp.bitbucket.io/TypescriptModules/docs/wmt-encryption/docs
https://bitbucket.org/wmtp/wmt-encryption
Here is where the module is currently published:
https://www.npmjs.com/package/wmt-encryption
This project is licensed under the MIT License.