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

eos-ecc

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eos-ecc

A universal JavaScript package for elliptic curve cryptography on the EOSIO blockchain.

  • 0.0.1-rc
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-80%
Maintainers
1
Weekly downloads
 
Created
Source

eos ecc logo

EOS-ECC

NPM Package CI status License: MIT

A universal JavaScript package for elliptic curve cryptography, operations for the EOSIO blockchain.

Features

  • Signature generation & validation
  • Public key from private key
  • Generate cryptographic random key pair

Built from isomorphic-secp256k1 which has developed strategies to mitigate various side channel attacks.

Support

We support all browsers that can handle WebAssembly.

  • Node.js ^12.20.1 || >= 13.2
  • Browser defaults, no IE 11

NB For testing purposes you will need webcrypto a Node.js v15 feature.

API

Table of contents

function generate_eos_signature

Generate an EOS encoded signature.

ParameterTypeDescription
argobjectArgument.
arg.hexstringMessage digest sha256 to sign.
arg.wif_private_keystringAn EOS wallet import format private key.

Returns: string — EOS encoded signature.

Examples

Ways to import.

import { generate_eos_signature } from 'eos-ecc'
import generate_eos_signature from 'eos-ecc/public/generate_eos_signature.js'

Ways to require.

const { generate_eos_signature } = require('eos-ecc')
const generate_eos_signature = require('eos-ecc/public/generate_eos_signature.js')

Usage of generate_eos_signature.

import crypto from 'crypto'

const message = 'hello'
const hex = new Uint8Array(
  crypto.createHash('sha256').update(message).digest()
)
generate_eos_signature({
  hex,
  wif_private_key: '5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3'
}).then(console.log)

The logged output will be SIG_K1_JxMN(…)NJ.


function new_eos_keys

Generate a new cryptographically random EOS key pair.

Returns: KeyPair — Key pair.

Examples

Ways to import.

import { new_eos_keys } from 'eos-ecc'
import new_eos_keys from 'eos-ecc/public/new_eos_keys.js'

Ways to require.

const { new_eos_keys } = require('eos-ecc')
const new_eos_keys = require('eos-ecc/public/new_eos_keys.js')

Usage new_eos_keys.

new_eos_keys().then(console.log)

The logged output will be an object containing EOS wif public & private keys.


function public_key_from_private

Convert an EOS WIF private key to a WIF public key.

ParameterTypeDescription
wif_private_keystringEOS wallet import format key.

Returns: string — EOS wallet import format public key.

Examples

Ways to import.

import { public_key_from_private } from 'eos-ecc'
import public_key_from_private from 'eos-ecc/public/public_key_from_private.js'

Ways to require.

const { public_key_from_private } = require('eos-ecc')
const public_key_from_private = require('eos-ecc/public/public_key_from_private.js')

Usage public_key_from_private.

public_key_from_private(
  '5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3'
).then(console.log)

The logged output will be EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV.


function verify_eos_signature

Validates and EOS signature from the message digest and public key.

ParameterTypeDescription
argobjectArgument.
arg.wif_public_keystringEOS public key.
arg.signaturestringEOS encoded signature.
arg.hashstringThe sha256 message digest.

Returns: boolena — Will be true & false for valid & invalid signatures respectively.

Examples

Ways to import.

import { verify_eos_signature } from 'eos-ecc'
import verify_eos_signature from 'eos-ecc/public/verify_eos_signature.js'

Ways to require.

const { verify_eos_signature } = require('eos-ecc')
const verify_eos_signature = require('eos-ecc/public/verify_eos_signature.js')

Usage verify_eos_signature.

const signature = 'SIG_K1_JxMNpqjt…yNJ'
const wif_public_key = 'EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV'
const hash = new Uint8Array(
  crypto.createHash('sha256').update('hello').digest()
)

verify_eos_signature({ wif_public_key, signature, hash })

The logged output will return true.


type KeyPair

An EOS wallet import formatted (WIF) public & private key pair.

PropertyTypeDescription
public_keystringEOS WIF public key.
private_keystringEOS WIF private key.

Keywords

FAQs

Package last updated on 23 Jan 2021

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