Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@notabene/crypto

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@notabene/crypto

Encryption Library for Notabene Services

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

notabene-crypto

Build Status License npm GitHub last commit codecov

Documentation: https://notabene-id.github.io/notabene-crypto/

Description

Encryption Library for Notabene Services

Installation

yarn

yarn add @notabene/crypto

npm

npm install @notabene/crypto

Usage

const {
  createEncriptionKeyPair,
  serializeKey,
  deserializeKey,
  encrypt,
  decrypt,
} = require("@notabene/crypto");

//Create pair of keys
const alice = createEncriptionKeyPair();
console.log(serializeKey(alice));
/*
 {
  publicKeyB64: '...',
  secretKeyB64: '...'
 }
*/

//Get bob key
const bobSerializedKeys = {
  publicKeyB64: "vBTvb1MGLOahUPgzAJJB/fPqi6GOG4kcaaNAqD3SDzU=",
  secretKeyB64: "iKVZwIFyONUNga0dKlZqD1mlVRBVUmVnsiFICkTY9Vk=",
};
console.log(bobSerializedKeys);

const bob = deserializeKey(bobSerializedKeys);

//Encrypt a message from alice to bob
encrypt(alice, bob.publicKey, "sensitive data").then(enc => {
  console.log(enc);
  /*
    {
    ciphertext: '...',
    nonce: '...',
    fromPublicKey: '...',
    toPublicKey: 'vBTvb1MGLOahUPgzAJJB/fPqi6GOG4kcaaNAqD3SDzU=',
    version: 'x25519-xsalsa20-poly1305'
    }
  */

  //Decrypt message with bob secretKey
  const message = decrypt(bob.secretKey, enc);
  console.log(message);
  /*
    "sensitive data"
  */
});

Development

Instal dependencies

$ npm install

Build

$ npm run build

Test

$ npm test

To publish to NPM:

$ pika publish

To publish dosc:

$ npm run docs

Contributing

Contributions are welcome!

Want to file a bug, request a feature or contribute some code?

  • Check out the Code of Conduct
  • Check that there is no existing issue corresponding to your bug or feature
  • Before implementing a new feature, discuss your changes in an issue first!

License

MIT © Notabene

Keywords

FAQs

Package last updated on 29 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc