New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cobox-crypto

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cobox-crypto

crypto encoding library for use in cobox

  • 1.1.0
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-83.33%
Maintainers
2
Weekly downloads
 
Created
Source

cobox-crypto

The crypto primitives used in cobox, extracted into a separate module

npm install cobox-crypto

Usage

const Crypto = require('cobox-crypto')
const crypto = Crypto()

const accessKey = crypto.accessKey()

API

keyPair = crypto.keyPair()

Returns an ed25519 keypair that can used for tree signing.

const symKey = crypto.symmetricKey()

Returns an ed25519 symmetric key used for shared secret encryption

const accessKey = crypto.accessKey()

// OR

const accessKey = crypto.pack(pubKey, symKey)

Returns an access key, which consists of an ed25519 public key, packed together with an ed25519 symmetric key

const keys = crypto.unpack(key)

Returns an object containing a public key, and a shared secret if accessible. Public key alone is used for blind replication. The shared secret can then be used for decryption.

const valueEncoding = crypto.encoder(encryptionKey, {})

Returns a message encoder used for encrypting messages in hypercore. Can be passed to hypercore doing the following:

const accessKey = crypto.accessKey
const keys = crypto.unpack(accessKey)
var feed = hypercore(storage, keys.publicKey, {
  valueEncoding: crypto.encoder(keys.symmetricKey, { valueEncoding: 'utf-8' })
})

feed.ready(() => {
  feed.append("this is going to be encrypted", (err, seq) => {
    // do other stuff...
  })
})

FAQs

Package last updated on 15 Nov 2019

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