Skip to content

Commit

Permalink
Rename Unparsable to Unparseable
Browse files Browse the repository at this point in the history
  • Loading branch information
larabr committed May 24, 2022
1 parent 7b2a157 commit 870ffde
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions openpgp.d.ts
Expand Up @@ -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;

Expand Down
10 changes: 5 additions & 5 deletions src/key/key.js
Expand Up @@ -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]);
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion 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';
2 changes: 1 addition & 1 deletion src/packet/packet.js
Expand Up @@ -309,7 +309,7 @@ export class UnsupportedError extends Error {
}
}

export class UnparsablePacket {
export class UnparseablePacket {
constructor(tag, rawContent) {
this.tag = tag;
this.rawContent = rawContent;
Expand Down
6 changes: 3 additions & 3 deletions src/packet/packetlist.js
Expand Up @@ -3,7 +3,7 @@ import {
readPackets, supportsStreaming,
writeTag, writeHeader,
writePartialLength, writeSimpleLength,
UnparsablePacket,
UnparseablePacket,
UnsupportedError
} from './packet';
import util from '../util';
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 = [];
Expand Down

0 comments on commit 870ffde

Please sign in to comment.