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

2.0.1 • Public • Published

Pubkeeper NOOP Crypto Plugin

This package provides the 'NONE' encryption for the JavaScript pubkeeper client.

Installation

In a browser:

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

Using npm:

$ npm install --save @pubkeeper/crypto-cjs-none

Then, load using ES5 require() syntax…

var PubkeeperNoneCrypto =
  require('@pubkeeper/crypto-cjs-none').PubkeeperNoneCrypto;

…or with ES2015+ import syntax:

import { PubkeeperNoneCrypto } from '@pubkeeper/crypto-cjs-none';

Basic Syntax

Registering as a supported cipher in a PubkeeperClient…

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

Registering as the default cipher in a PubkeeperClient…

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

Using the cipher function directly.

const [,cipher] = PubkeeperNoneCrypto;
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"

/@pubkeeper/crypto-none/

    Package Sidebar

    Install

    npm i @pubkeeper/crypto-none

    Weekly Downloads

    0

    Version

    2.0.1

    License

    UNLICENSED

    Unpacked Size

    40.9 kB

    Total Files

    30

    Last publish

    Collaborators

    • 32bitkid
    • mattdodge