Class: PacketList

PacketList()

This class represents a list of openpgp packets. Take care when iterating over it - the packets themselves are stored as numerical indices.

Constructor

new PacketList()

Source:

Extends

  • Array

Methods

(async, static) fromBinary(bytes, allowedPackets, configopt) → {PacketList}

Parses the given binary data and returns a list of packets. Equivalent to calling read on an empty PacketList instance.

Parameters:
Name Type Attributes Description
bytes Uint8Array | ReadableStream.<Uint8Array>

binary data to parse

allowedPackets Object

mapping where keys are allowed packet tags, pointing to their Packet class

config Object <optional>

full configuration, defaults to openpgp.config

Source:
Throws:

on parsing errors

Returns:

parsed list of packets

Type
PacketList

filterByTag(…tags) → {PacketList}

Creates a new PacketList with all packets matching the given tag(s)

Parameters:
Name Type Attributes Description
tags module:enums.packet <repeatable>

packet tags to look for

Source:
Returns:
Type
PacketList

findPacket(tag) → {Packet|undefined}

Traverses packet list and returns first packet with matching tag

Parameters:
Name Type Description
tag module:enums.packet

The packet tag

Source:
Returns:
Type
Packet | undefined

indexOfTag(…tags) → {Array.<Integer>}

Find indices of packets with the given tag(s)

Parameters:
Name Type Attributes Description
tags module:enums.packet <repeatable>

packet tags to look for

Source:
Returns:

packet indices

Type
Array.<Integer>

(async) read(bytes, allowedPackets, configopt)

Reads a stream of binary data and interprets it as a list of packets.

Parameters:
Name Type Attributes Description
bytes Uint8Array | ReadableStream.<Uint8Array>

binary data to parse

allowedPackets Object

mapping where keys are allowed packet tags, pointing to their Packet class

config Object <optional>

full configuration, defaults to openpgp.config

Source:
Throws:

on parsing errors

write() → {Uint8Array}

Creates a binary representation of openpgp objects contained within the class instance.

Source:
Returns:

A Uint8Array containing valid openpgp packets.

Type
Uint8Array