2.0.1 • Published 5 years ago
@pubkeeper/crypto-none v2.0.1
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"
2.1.0
5 years ago
2.0.1
5 years ago
2.0.0
5 years ago
2.0.0-rc.5
5 years ago
2.0.0-rc.4
5 years ago
2.0.0-rc.3
5 years ago
2.0.0-rc.2
5 years ago
2.0.0-rc.1
5 years ago
2.0.0-rc.0
5 years ago
1.0.1
6 years ago
1.0.0
7 years ago