UNPKG

@provenanceio/wallet-utils

Version:

Typescript Utilities for Provenance Blockchain Wallet

27 lines (20 loc) 709 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.signBytes = void 0; var _secp256k = require("secp256k1"); var _sha = require("./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 */ var signBytes = function signBytes(bytes, privateKey) { var hash = (0, _sha.sha256)(bytes); var _secp256k1EcdsaSign = (0, _secp256k.ecdsaSign)(hash, privateKey), signature = _secp256k1EcdsaSign.signature; return signature; }; exports.signBytes = signBytes;