1.0.19 • Published 3 years ago

denote-ui v1.0.19

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

Denote User Identity

Instruction

We take care about your privacy, instead of username/password/email we offer you a new way to identify yourself without harm to your privacy.

Features

  • We using BIP39 to help you store remember your key pair.
  • Your user's ID is digest of your public key
  • Message will be signed/verified by using ECDSA in this case we use secp256k1

Installation

npm i denote-ui

Example

Create a new key pair by call DenoteUserIdentity.createNewUser() or recover from a mnemonic words DenoteUserIdentity.fromMnemonic(...).

import DenoteUserIdentity from 'denote-ui';
const dui = new DenoteUserIdentity();
console.log('Mnemonic:\t', dui.getMnemonic());
console.log('User ID:\t', dui.getUserID());

Sign message:

const message = Buffer.from('Hello! this is example message');
const signedMessage = dui.sign(message);
console.log('Signed Message:\t', signedMessage.toString('base64'));

Recover user ID from signed message:

const recoveredUserID = DenoteUserIdentity.recoverUserID(signedMessage);
console.log('Recovered ID:\t', recoveredUserID);
const signedObj = dui.signObject({
  name: 'Chiro Hiro',
  age: 32,
  data: 'Hello',
});

Sign and recover object:

console.log('Singed object:\t', signedObj);
console.log('Recovered object:\t', JSON.stringify(DenoteUserIdentity.recoverObject(signedObj)));

License

This software was licensed under MIT License