1.0.0 • Published 5 months ago

aes256-async v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

AES-256 Async

The aes256-async package allows developers to easily encrypt and decrypt data by making use of the AES-256 specification. It exposes syncrhonous and asynchronous functions to avoid blocking the main thread. Moreover, the secret can be of any size because it is hashed using the Secure Hash Algorithm 2 (SHA-256).

Getting Started

Install the package:

npm install -S aes256-async

Usage

Encrypt and decrypt data asynchronously:

import { encrypt, decrypt } from 'aes256-async';

const secret = 'My.$ecreT';

await encrypt(secret, 'Hello world!')
// OrGfQ/91d7p/1BN6Q07Jly5ZK0/7pyczjk5vgw==

await decrypt(secret, 'OrGfQ/91d7p/1BN6Q07Jly5ZK0/7pyczjk5vgw==')
// 'Hello world!'

Encrypt and decrypt data synchronously (blocking the main thread):

import { encryptSync, decryptSync } from 'aes256-async';

const secret = 'My.$ecreT';

encryptSync(secret, 'Hello world!')
// OrGfQ/91d7p/1BN6Q07Jly5ZK0/7pyczjk5vgw==

decryptSync(secret, 'OrGfQ/91d7p/1BN6Q07Jly5ZK0/7pyczjk5vgw==')
// 'Hello world!'

Built With

  • TypeScript

Acknowledgements

Running the Tests

# integration tests
npm run test:integration

# unit tests
npm run test:unit

License

MIT

Deployment

Install dependencies:

npm install

Build the library:

npm start

Publish to npm:

npm publish