github openpgpjs/openpgpjs v5.0.0-4

latest releases: v6.0.0-beta.0, v5.11.1, v6.0.0-alpha.1...
pre-release2 years ago

This is a prerelease of v5.0.0. The full changelog since OpenPGP.js v4 can be found here. The changelog since v5.0.0-3 is:

  • Fix various signature verification issues (#1302)
  • Uniform casing of subkey(s): rename the SubKey class to Subkey, and key.subKeys to key.subkeys (#1310)
  • CI: Check that JSDoc comments are valid (#1328)
  • CI: Detect unhandled rejections in browser tests (#1333) except in Safari 14.1 (#1371)
  • Require keys in openpgp.sign and make all top-level functions fully async (#1318)
  • Remove primaryKey argument from User methods, and rename User.sign to User.certify (#1329)
  • Always generate RSA keys of exact bit length (#1336)
  • Drop capabilities, keyID args in key.getExpirationTime() and consider direct-key signatures (#1319)
  • Add Signature#getSigningKeyIDs method to get Issuer Key IDs from a Signature (#1331)
  • Always throw on unexpected packets, but ignore Trust and Marker packets on parsing (#1340)
  • TypeScript: make the packets, keyPacket and mainKey properties readonly (#1337)
  • Simplify return value of generateKey, reformatKey and revokeKey and add support for binary output (#1345)
  • Support passing a non-array value to encryption/signingKeyIDs in top-level functions (#1342)
  • Support using key.isPrivate() for type inference, remove key.isPublic() (#1347)
  • Lint: enforce single quotes and do not error on class methods without this (#1341)
  • Remove valid and error from the verification result of openpgp.verify and decrypt, in favor of await verified (#1348)
  • Update README to use openpgp.readPrivateKey() where applicable (#1362)
  • Extend BaseStream<> from AsyncIterable<>, to enable the use of for await (chunk of result) on returned streams in TypeScript (#1373)
  • Replace armor option with format in openpgp.encrypt, sign and encryptSessionKey (#1354, #1377)
    • If format: 'armor' is passed (the default), an armored signed/encrypted message is returned (same as armor: true)
    • If format: 'binary' is passed, a binary signed/encrypted message is returned (same as armor: false in previous v5 prereleases)
    • If format: 'object' is passed, a Message or Signature object is returned (same as armor: false in v4)
  • Github: add issue templates (#1369)
  • Export Subkey class (#1381)
  • Update web-stream-tools, web-streams-polyfill and web-streams-adapter dependencies

Examples

Generate an armored key pair

v5.0.0-3:

import { generateKey } from 'openpgp';
const { privateKeyArmored, publicKeyArmored, revocationCertificate } = await generateKey({ userIDs: [{ name: 'Test', email: 'test@email' }] });

v5.0.0-4:

import { generateKey } from 'openpgp';
const { privateKey, publicKey, revocationCertificate } = await generateKey({ userIDs: [{ name: 'Test', email: 'test@email' }] });
Generate a private key object

v5.0.0-3:

import { generateKey } from 'openpgp';
const { key } = await generateKey({ userIDs: [{ name: 'Test', email: 'test@email' }] });

v5.0.0-4:

import { generateKey } from 'openpgp';
const { key: privateKey } = await generateKey({ userIDs: [{ name: 'Test', email: 'test@email' }], format: 'object' });
Encrypt and sign binary message (binary output)

v5.0.0-3:

import { createMessage, encrypt } from 'openpgp';
const message = await createMessage({ binary: data });
const encrypted = await encrypt({ encryptionKeys: publicKeys, signingKeys: privateKeys, message, armor: false });
console.log(encrypted); // Uint8Array

v5.0.0-4:

import { createMessage, encrypt } from 'openpgp';
const message = await createMessage({ binary: data });
const encrypted = await encrypt({ encryptionKeys: publicKeys, signingKeys: privateKeys, message, format: 'binary' });
console.log(encrypted); // Uint8Array

Don't miss a new openpgpjs release

NewReleases is sending notifications on new releases.