A
A
Alexander N2021-02-06 00:27:41
JavaScript
Alexander N, 2021-02-06 00:27:41

Error dataSha256: 32 byte buffer requred, eosjs-ecc. How to decide?

There is a function

const data = ecc.sha256(value)
return ecc.signHash(data, key, 'base64'))


As a result I get

Error: dataSha256: 32 byte buffer requred
    at Function.push../node_modules/eosjs-ecc/lib/signature.js.Signature.signHash (signature.js:239)
    at Object.signHash (api_common.js:136)
    at createSign (KeyUtils.ts:27)
    at AuthService.ts:12


There is a well-known Buffer.alloc(32, 0) command, how to link them?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexandr N, 2021-02-06
@wooly

The output turned out to be a simple btoa(ecc.signHash(ecc.sha256(value), key)) and no buffer needed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question