Fix signature verification examples in the README (#1058)

This commit is contained in:
chenlhlinux 2020-03-13 03:13:22 +08:00 committed by GitHub
parent 66d83db51b
commit b76c67aba8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -460,7 +460,7 @@ Using the private key:
});
console.log(cleartext); // '-----BEGIN PGP SIGNED MESSAGE ... END PGP SIGNATURE-----'
const { signatures } = await openpgp.verify({
const verified = await openpgp.verify({
message: await openpgp.cleartext.readArmored(cleartext), // parse armored message
publicKeys: (await openpgp.key.readArmored(publicKeyArmored)).keys // for verification
});
@ -495,7 +495,7 @@ Using the private key:
});
console.log(detachedSignature);
const { signatures } = await openpgp.verify({
const verified = await openpgp.verify({
message: openpgp.cleartext.fromText('Hello, World!'), // CleartextMessage or Message object
signature: await openpgp.signature.readArmored(detachedSignature), // parse detached signature
publicKeys: (await openpgp.key.readArmored(publicKeyArmored)).keys // for verification
@ -537,7 +537,7 @@ Using the private key:
});
console.log(signatureArmored); // ReadableStream containing '-----BEGIN PGP MESSAGE ... END PGP MESSAGE-----'
const { signatures } = await openpgp.verify({
const verified = await openpgp.verify({
message: await openpgp.message.readArmored(signatureArmored), // parse armored signature
publicKeys: (await openpgp.key.readArmored(publicKeyArmored)).keys // for verification
});