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

blind-signature

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blind-signature

Implementation of Chaum's blind signatures

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Blind Signature

Node.js implementation of Chaum's blind signatures

This is based on the JSBN library for BigNumbers. It doesn't handle the generation of RSA keys but expects them in the normal format of:

export interface PublicRSAKey {
  n: BigInteger,
  e: number
}

export interface PrivateRSAKey extends PublicRSAKey {
  p: BigInteger
  q: BigInteger
  d: BigInteger
  dmp1: BigInteger
  dmq1: BigInteger
  coeff: BigInteger
}

The RSA key you use for this library should be used only for these blind signatures! If you use it for encryption or other signatures too, it opens up serious vulnerabilities. This is a pretty low level blind signatures library so make sure you understand the underlying cryptography and the potential vulnerabilities.

Messages are hashed before they are signed. For maximum safety, a hash function is used with the same bitlength as the RSA key's modulus. We accomplish this by hmac'ing the message with 1, then 2, and so on, concatenating the outputs together until we get the desired length.

Usage Example

import {
  hashAndBlindMessage,
  signBlindedMessageHash,
  unblindSignature,
  verifySignature
} from 'blind-signature'

// this happens on client
const publicKey = // ...
const message = 'hello world'
const { blindedMessageHash, blindingFactor } =
  hashAndBlindMessage(publicKey, message)

// this happens on server/signer
const privateKey = // ...
const blindSignature =
  signBlindedMessageHash(privateKey, blindedMessageHash)

// this happens on client
const signature =
  unblindSignature(publicKey, blindSignature, blindingFactor)

// verification can be done by the signer or client at any time
const isVerified = verifySignature(publicKey, message, signature)

FAQs

Package last updated on 19 Dec 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