matcrypt
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

matcrypt

workflow npm npm NPM

Disclaimer

While I've made sure to adhere to all best practices when it comes to AES and WebCrypto, I am not a cryptography professional. This code is not audited. I use this in production, but you should never blindly trust any cryptographic code from the internet.

This library only works in browser environments that support WebCrypto.

About

WebCrypto wrapper that makes AES easy.

This library supports

(AES-256)

  • Random key generation
  • String encryption/decryption (ciphertext is base64 encoded as well for easy storage)
  • Binary data encryption/decryption

(The library handles IV randomization and storage.)

(SHA-512)

  • Compute a base64-encoded hash of binary data

(RSA-OAEP-2048)

  • Random key pair generation
  • String encryption/decryption (ciphertext is base64 encoded as well for easy storage)
  • Binary data encryption/decryption

(The library handles AES secret randomization and storage.)

Code example

import { AES } from 'matcrypt';

async function example() {
  let key = await AES.randomKey();
  let ciphertext = await AES.encryptString(key, testString);
  let plaintext = await AES.decryptString(key, ciphertext);
}

/matcrypt/

    Package Sidebar

    Install

    npm i matcrypt

    Weekly Downloads

    4

    Version

    1.3.0

    License

    BSD-3-Clause-Clear

    Unpacked Size

    199 kB

    Total Files

    30

    Last publish

    Collaborators

    • mat-sz