From 870ffdee9da628ee0638a15a6483a85f32fc6302 Mon Sep 17 00:00:00 2001 From: larabr <7375870+larabr@users.noreply.github.com> Date: Tue, 24 May 2022 19:04:46 +0200 Subject: [PATCH] Rename `Unparsable` to `Unparseable` --- openpgp.d.ts | 4 ++-- src/key/key.js | 10 +++++----- src/packet/index.js | 2 +- src/packet/packet.js | 2 +- src/packet/packetlist.js | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/openpgp.d.ts b/openpgp.d.ts index c88a6be57..34f625274 100644 --- a/openpgp.d.ts +++ b/openpgp.d.ts @@ -527,12 +527,12 @@ export class TrustPacket extends BasePacket { static readonly tag: enums.packet.trust; } -export class UnparsablePacket { +export class UnparseablePacket { tag: enums.packet; write: () => Uint8Array; } -export type AnyPacket = BasePacket | UnparsablePacket; +export type AnyPacket = BasePacket | UnparseablePacket; export type AnySecretKeyPacket = SecretKeyPacket | SecretSubkeyPacket; export type AnyKeyPacket = BasePublicKeyPacket; diff --git a/src/key/key.js b/src/key/key.js index 3c906dea2..130ff3d41 100644 --- a/src/key/key.js +++ b/src/key/key.js @@ -28,7 +28,7 @@ import Subkey from './subkey'; import * as helper from './helper'; import PrivateKey from './private_key'; import PublicKey from './public_key'; -import { UnparsablePacket } from '../packet/packet'; +import { UnparseablePacket } from '../packet/packet'; // A key revocation certificate can contain the following packets const allowedRevocationPackets = /*#__PURE__*/ util.constructAllowedPackets([SignaturePacket]); @@ -61,10 +61,10 @@ class Key { for (const packet of packetlist) { - if (packet instanceof UnparsablePacket) { - const isUnparsableKeyPacket = keyPacketTags.has(packet.tag); - if (isUnparsableKeyPacket && !ignoreUntil){ - // Since non-key packets apply to the preceding key packet, if a (sub)key is unparsable we must + if (packet instanceof UnparseablePacket) { + const isUnparseableKeyPacket = keyPacketTags.has(packet.tag); + if (isUnparseableKeyPacket && !ignoreUntil){ + // Since non-key packets apply to the preceding key packet, if a (sub)key is Unparseable we must // discard all non-key packets that follow, until another (sub)key packet is found. if (mainKeyPacketTags.has(packet.tag)) { ignoreUntil = mainKeyPacketTags; diff --git a/src/packet/index.js b/src/packet/index.js index 82312476b..562b32051 100644 --- a/src/packet/index.js +++ b/src/packet/index.js @@ -1,3 +1,3 @@ export * from './all_packets'; export { default as PacketList } from './packetlist'; -export { UnparsablePacket } from './packet'; +export { UnparseablePacket } from './packet'; diff --git a/src/packet/packet.js b/src/packet/packet.js index 26f7a9e3e..f0c68deb3 100644 --- a/src/packet/packet.js +++ b/src/packet/packet.js @@ -309,7 +309,7 @@ export class UnsupportedError extends Error { } } -export class UnparsablePacket { +export class UnparseablePacket { constructor(tag, rawContent) { this.tag = tag; this.rawContent = rawContent; diff --git a/src/packet/packetlist.js b/src/packet/packetlist.js index 78cacefaf..b16e6a2e4 100644 --- a/src/packet/packetlist.js +++ b/src/packet/packetlist.js @@ -3,7 +3,7 @@ import { readPackets, supportsStreaming, writeTag, writeHeader, writePartialLength, writeSimpleLength, - UnparsablePacket, + UnparseablePacket, UnsupportedError } from './packet'; import util from '../util'; @@ -91,7 +91,7 @@ class PacketList extends Array { // (since we likely cannot process the message without these packets anyway). await writer.abort(e); } else { - const unparsedPacket = new UnparsablePacket(parsed.tag, parsed.packet); + const unparsedPacket = new UnparseablePacket(parsed.tag, parsed.packet); await writer.write(unparsedPacket); } util.printDebugError(e); @@ -133,7 +133,7 @@ class PacketList extends Array { const arr = []; for (let i = 0; i < this.length; i++) { - const tag = this[i] instanceof UnparsablePacket ? this[i].tag : this[i].constructor.tag; + const tag = this[i] instanceof UnparseablePacket ? this[i].tag : this[i].constructor.tag; const packetbytes = this[i].write(); if (util.isStream(packetbytes) && supportsStreaming(this[i].constructor.tag)) { let buffer = [];