从 openpgp 生成 public 个私钥
Generating public private keys from openpgp
我有以下代码,我正在尝试生成 public-私钥:
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
publicKeyArmored 不是 openpgp.generateKey 尝试 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()
输出---->
我有以下代码,我正在尝试生成 public-私钥:
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
publicKeyArmored 不是 openpgp.generateKey 尝试 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()
输出---->