Skip to content

@lockisecurity/crypto-core — AES-GCM Encryption for JavaScript & TypeScript

Add AES-GCM encryption to your own JavaScript or TypeScript project. @lockisecurity/crypto-core uses the browser-native WebCrypto API with zero external dependencies — the same engine that powers the Locki extension.

$ npm install @lockisecurity/crypto-core
import { decrypt, encrypt, generateAESKeyHex } from '@lockisecurity/crypto-core';

const key = await generateAESKeyHex(256);
const sealed = await encrypt('db-password', key); // "[LOCKI:v2:…]"
const plain = await decrypt(sealed, key);
  • AES-128 and AES-256 support

    Generate cryptographically secure keys and encrypt or decrypt any string with AES-128-GCM or AES-256-GCM — the same algorithm used by Locki.

  • Zero dependencies

    Built entirely on the WebCrypto API. No third-party cryptography libraries, no native bindings — just the runtime you already have.

  • Full TypeScript support

    Ships with complete type definitions. Works out of the box with TypeScript projects — no additional @types packages needed.

  • Locki-compatible format

    Encrypted output is fully compatible with the Locki extension format. Data encrypted in your app can be decrypted in Locki and vice versa.

  • Secure key generation

    Generate AES keys of any supported length directly in the browser or Node.js environment using the WebCrypto key generation API.