【发布时间】:2021-10-16 07:42:31
【问题描述】:
我有一个公钥字符串如下
let pk_str = "public key strig here" 我正在使用库 jose 来验证 JWS
(async() => {
const decoder = new TextDecoder();
const jws = vc_proof_value;
const { payload, protectedHeader } = await compactVerify(jws, pk_str);
console.log(protectedHeader)
console.log(decoder.decode(payload))
})();
尝试运行脚本时出现以下错误
(node:75986) UnhandledPromiseRejectionWarning: TypeError: Key must be one of type KeyObject, CryptoKey, or Uint8Array. Received type string
有没有办法构造密钥?
【问题讨论】:
标签: node.js cryptography jose