我有以下代码,并试图生成公共私钥:
const openpgp = require("openpgp")
const generateKeyPair = async () => {
const { publicKeyArmored } = await openpgp.generateKey({
userIds: [
{
name: 'Jon Smith', email: 'jon@example.com',
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发布于 2021-12-08 08:40:07
publicKeyArmored不是openpgp.generateKey try publicKey的方法。
const openpgp = require("openpgp")
const generateKeyPair = async () => {
const { publicKey } = await openpgp.generateKey({
curve: 'ed25519',
userIDs: [
{
name: 'Jon Smith', email: 'jon@example.com',
comment: 'This key is for public sharing'
}
],
passphrase: 'super long and hard to guess secret',
});
console.log(publicKey);
}
generateKeyPair()输出->

https://stackoverflow.com/questions/70271516
复制相似问题