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

@browser-network/crypto

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@browser-network/crypto

A wrapper around eccrypto designed for use in the browser-network ecosystem

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

Browser Network Crypto

This package is just a wrapper around eccrypto. It's meant to be used with the browser network and accompanying browser network apps. It's only for convenience. If you're looking to bring cryptography into your non browser network application, you should probably use eccrypto or another cryptography library directly instead of using this.

Installation

npm install @browser-network/crypto

or

<script src="//unpkg.com/@browser-network/network/umd/crypto.min.js"></script>

Usage

import * as bnc from 'browser-network/crypto'

// Generate a secret (private key) as used by browser-network
const secret = bnc.generateSecret()

// Get the public key mathematically derived from a given secret
const pubKey = bnc.derivePubKey(secret)

// Turn a given string into a `Uint8Array` buffer that eccrypto uses.
const buf = bnc.stob("Serena's ol bus")

// Turn the `Uint8Array` buffer that eccrypto uses into a string for export
const str = bnc.btos(buf) // "Serena's ol bus"

// Create a hash from an object
const has = bnc.hash({ some: 'object' }) // => `Uint8Array`

// Take an object and create a signature for it based on a given private key.
const signature = bnc.sign(secret, { some: 'object' })

// Ensure a signature of object by a pubKey comes from that pubKey's associated secret
const isValid = bnc.verifySignature({ some: 'object' }, signature, pubKey) // true

Keywords

FAQs

Package last updated on 02 Sep 2022

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