I am using react in javascript and I try to encrypt array elements using a loop, then I want to push each result in an element of the new array, I use this code:
var eccrypto = require("eccrypto");
var privateKey= Buffer.from([238, 239, 199, 101, 188, 134, 13, 13,195, 172, 125, 168, 225, 189, 72, 148, 225, 200, 127, 218, 204, 11, 150, 146, 180, 243, 195, 109, 200, 119, 50, 20],'hex');
let array = [2,3,5];
let array2=[];
for (let b of array) {
const a= eccrypto.sign(privateKey,b);
array2.push(a);
}
console.log(array2);
the problem is it rejected in the second and fourth elements.
The result is like this:
and the error message:
I tried to use async/await as a lot of the previous problems solved by using it, but I get the same problem.
I'll appreciate your help, thank you.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…