我有以下代碼,我正在嘗試生成公私鑰:
const openpgp = require("openpgp")
const generateKeyPair = async () => {
const { publicKeyArmored } = await openpgp.generateKey({
userIds: [
{
name: 'Jon Smith', email: '[email protected]',
comment: 'This key is for public sharing'
}
],
curve: 'ed25519',
passphrase: 'super long and hard to guess secret',
});
console.log(publicKeyArmored);
}
但我收到這個錯誤。任何想法如何解決它:
(node:17380) UnhandledPromiseRejectionWarning: Error: Unknown option: userIds
uj5u.com熱心網友回復:
publicKeyArmored 不是 openpgp.generateKey 嘗試 publicKey 的方法。
const openpgp = require("openpgp")
const generateKeyPair = async () => {
const { publicKey } = await openpgp.generateKey({
curve: 'ed25519',
userIDs: [
{
name: 'Jon Smith', email: '[email protected]',
comment: 'This key is for public sharing'
}
],
passphrase: 'super long and hard to guess secret',
});
console.log(publicKey);
}
generateKeyPair()
輸出---->

轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/376404.html
標籤:javascript 节点.js 打开pgp openpgp.js
上一篇:單擊時背景位置的CSS滑動影片
