Socket
Book a DemoInstallSign in
Socket

ecdsa-wasm

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

ecdsa-wasm

ecdsa/secp256k1 + SHA-256 for Node.js by WebAssembly

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

Build Status

ECSSA/secp256k1 + SHA-256

Abstract

This is a wasm version of mcl/ecdsa.h

News

serialize() supports the format defined at BitCoin

for Node.js

npm test

how to use

const ecdsa = require('ecdsa-wasm')

// create secret key
const sec = new ecdsa.SecretKey()

// initialize sec
sec.setByCSPRNG()

// get public key
const pub = sec.getPublicKey()

// make signature
const sig = sec.sign("abc")

// verify signatpure by pub
> pub.verify(sig, "abc")
true
> pub.verify(sig, "abcd")
false

// create precomputed public key(faster than pub)
const ppub = new ecdsa.PrecomputedPublicKey()
// initialize ppub
ppub.init(pub)

// verify signature by ppub
> ppub.verify(sig, "abc")
true
> ppub.verify(sig, "abcd")
false

// destroy ppub if unnecessary
ppub.destroy()

serialization

  • SecretKey.serialize() return 32-bytes Uint8Array as big-endian
  • PublicKey.serialize() return 65-bytes Uint8Array as 0x04 + x + y
  • PublicKey.serializeCompressed() return 33-bytes Uint8Array as 0x02 (y is even) or 0x03 (y is odd) + x
  • Signature.serialize() return DER-format
  • SecretKey.deserialize(a)
  • PublicKey.deserialize(a)
  • Signature.deserialize(a)
    • take Uint8Array of a and constract the object

how to build ecdsa_c.js

Install emscripten.

git clone --recurse-submodules git@github.com:herumi/ecdsa-wasm
cd ecdsa-wasm
make -C src wasm

License

modified new BSD License http://opensource.org/licenses/BSD-3-Clause

Author

光成滋生 MITSUNARI Shigeo(herumi@nifty.com)

Keywords

elliptic curve

FAQs

Package last updated on 17 Mar 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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.