我正在尝试对字符串进行加密以获取此错误。
代码:
const crypto = require('crypto');
const secret = 'abcdefg';
const hash = crypto.createHmac('sha256', secret)
.update('I love cupcakes')
.digest('hex');
console.log(hash);
const cert = require('crypto').Certificate();
try{
const spkac = getSpkacSomehow();
const challenge = cert.exportChallenge(spkac);
console.log(challenge.toString('utf8'));
}
catch(err){
console.log('error'+err);
}
我得到的错误:
errorReferenceError: getSpkacSomehow is not defined