@tomsd/ekey
v4.0.0
Published
## Installation ``` sh npm install @tomsd/ekey ```
Downloads
5
Readme
@tomsd/ekey
Installation
npm install @tomsd/ekey
Usage
// with bundler...
import ekey from "@tomsd/ekey";
// node.js
const ekey = require("@tomsd/ekey");
// initialize key with seed string
const testkey1 = ekey.activate("testkey1");
const testkey2 = ekey.activate("testkey2");
const text = "This is a test!";
// encode
const encoded1 = testkey1.encode(text);
const encoded2 = testkey2.encode(text);
console.log(encoded1);
console.log(encoded2);
// decode
const decoded1 = testkey1.decode(encoded1);
const decoded2 = testkey1.decode(encoded2);
console.log(decoded1);
console.log(deccoded2);
// decoding fails if the seeds are different from each other
console.log(testkey2.decode(encoded1));
console.log(testkey1.decode(encoded2));