UNPKG

@provenanceio/wallet-utils

Version:

Typescript Utilities for Provenance Blockchain Wallet

17 lines (14 loc) 584 B
import { ecdsaSign as secp256k1EcdsaSign } from 'secp256k1'; import { sha256 } from './sha256'; /** * sha256 encrypted, ECDSA signed version of the given byte array * @param bytes byte array (Uint8Array) to encrypt and sign * @param privateKey private key to sign with * @returns a sha256 encrypted, ECDSA signed version of the given byte array */ export var signBytes = function signBytes(bytes, privateKey) { var hash = sha256(bytes); var _secp256k1EcdsaSign = secp256k1EcdsaSign(hash, privateKey), signature = _secp256k1EcdsaSign.signature; return signature; };