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

@burstjs/crypto

Package Overview
Dependencies
Maintainers
2
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@burstjs/crypto

Cryptographic functions for building Burstcoin apps.

  • 0.0.12
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
27
increased by35%
Maintainers
2
Weekly downloads
 
Created
Source

@burstjs/crypto

Cryptographic functions for building Burstcoin apps.

Installation

Install using npm:

npm install @burstjs/crypto

or using yarn:

yarn add @burstjs/crypto

API Reference

Members

BN

Original work Copyright (c) 2018 PoC-Consortium
Modified work Copyright (c) 2019 Burst Apps Team

Functions

decryptAES(encryptedBase64, key)

Decrypt an encrypted message

generateMasterKeys(passPhrase)

Generate the Master Public Key and Master Private Key for a new passphrase

generateSignature(messageHex, privateKey)

Generate a signature for the transaction

Method:

 s = sign(sha256(sha256(transactionHex)_keygen(sha256(sha256(transactionHex)_privateKey)).publicKey),
         sha256(sha256(transactionHex)_privateKey),
         privateKey)
 p = sha256(sha256(transactionHex)_keygen(sha256(transactionHex_privateKey)).publicKey)
generateSignedTransactionBytes(unsignedTransactionHex, signature)

Generates a signed message digest

getAccountIdFromPublicKey(publicKey)

Convert hex string of the public key to the account id

verifySignature(signature, messageHex, publicKey)

Verify a signature for given message

  • Method:
    * h1 = sha256(sha256(transactionHex)_keygen(sha256(transactionHex_privateKey)).publicKey)
    ==
    sha256(sha256(transactionHex)_verify(v, h1, publickey)) = h2

BN

Original work Copyright (c) 2018 PoC-Consortium
Modified work Copyright (c) 2019 Burst Apps Team

Kind: global variable

decryptAES(encryptedBase64, key) ⇒

Decrypt an encrypted message

Kind: global function
Returns:

The decrypted content

ParamDescription
encryptedBase64

encryprts data in base64 format

key

The secret key

generateMasterKeys(passPhrase) ⇒

Generate the Master Public Key and Master Private Key for a new passphrase

Kind: global function
Returns:

EC-KCDSA sign key pair + agreement key

ParamDescription
passPhrase

The passphrase

generateSignature(messageHex, privateKey)

Generate a signature for the transaction

Method:

 s = sign(sha256(sha256(transactionHex)_keygen(sha256(sha256(transactionHex)_privateKey)).publicKey),
         sha256(sha256(transactionHex)_privateKey),
         privateKey)
 p = sha256(sha256(transactionHex)_keygen(sha256(transactionHex_privateKey)).publicKey)

Kind: global function

ParamDescription
messageHex

The data in hexadecimal representation

privateKey

The private key for signing

generateSignedTransactionBytes(unsignedTransactionHex, signature) ⇒

Generates a signed message digest

Kind: global function
Returns:

The signed message digest

ParamDescription
unsignedTransactionHex

The unsigned message

signature

The signature

getAccountIdFromPublicKey(publicKey) ⇒

Convert hex string of the public key to the account id

Kind: global function
Returns:

The numeric account Id

ParamDescription
publicKey

The public key

verifySignature(signature, messageHex, publicKey)

Verify a signature for given message

  • Method:
    * h1 = sha256(sha256(transactionHex)_keygen(sha256(transactionHex_privateKey)).publicKey)
    ==
    sha256(sha256(transactionHex)_verify(v, h1, publickey)) = h2

Kind: global function

ParamDescription
signature

The signature to be verified

messageHex

The message data in hexadecimal representation

publicKey

The public key

FAQs

Package last updated on 04 Feb 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