Neapolitan Pizza Margherita

    @pubkeeper/crypto-cjs-aes-cbc
    TypeScript icon, indicating that this package has built-in type declarations

    4.0.1 • Public • Published

    Pubkeeper AES-CBC Crypto Plugin

    This package provides AES-CBC encryption for the JavaScript pubkeeper client, via crypto‑js

    Installation

    In a browser:

    <script src="pubkeeper-crypto-aes-cbc.js"></script>

    Using npm:

    $ npm install --save @pubkeeper/crypto-cjs-aes-cbc

    Then, load using ES5 require() syntax…

    var PubkeeperAesCbcCrypto =
      require('@pubkeeper/crypto-cjs-aes-cbc').PubkeeperAesCbcCrypto;

    …or with ES2015+ import syntax:

    import { PubkeeperAesCbcCrypto } from '@pubkeeper/crypto-cjs-aes-cbc';

    Basic Syntax

    Registering as a supported cipher in a PubkeeperClient…

    const client = new PubkeeperClient({
      crypto: new Map([
        PubkeeperAesCbcCrypto,
      ]),
    })

    Registering as the default cipher in a PubkeeperClient…

    const client = new PubkeeperClient({
      crypto: new Map([
        PubkeeperClient.setDefaultCrypto(PubkeeperAesCbcCrypto),
        PubkeeperAesCbcCrypto,
      ]),
    })

    Using the cipher function directly.

    const [,cipher] = PubkeeperAesCbcCrypto;
    const key = new TextEncoder().encode('averyinsecurekey');
    const c = cipher(key)
    const ptext = new TextEncoder().encode('my message');
    const ctext = c.encrypt(ptext)
    const result = c.decrypt(ctext);
    console.log(new TextDecoder().decode(result)); // "my message"

    Keywords

    none

    Install

    npm i @pubkeeper/crypto-cjs-aes-cbc

    DownloadsWeekly Downloads

    0

    Version

    4.0.1

    License

    UNLICENSED

    Unpacked Size

    310 kB

    Total Files

    21

    Last publish

    Collaborators

    • 32bitkid
    • mattdodge