openpgpjs/src/packet/trust.js
larabr aeddac438e
Make PacketList a valid subtype of Array and update Packet.tag types (#1289)
Changes:
- Implementation:
  - Remove `PacketList.prototype.concat` and `push`
    (we solely rely on `Array.push` instead)
  - Fix https://github.com/openpgpjs/openpgpjs/issues/907 by
    correctly handling result of `filterByTag`
  - Implement `write()` method for `Trust` and `Marker` packets,
    to make them compatible with the `BasePacket` interface
- Types:
  - Simplify and updated `PacketList` type definitions
  - Fix types for `Packet.tag`, which is `static` since
    https://github.com/openpgpjs/openpgpjs/pull/1268
  - Prevent passing SubkeyPackets where KeyPackets are expected,
    and vice versa
2021-04-29 17:18:39 +02:00

39 lines
1.2 KiB
JavaScript

/* eslint class-methods-use-this: ["error", { "exceptMethods": ["read"] }] */
import enums from '../enums';
/**
* Implementation of the Trust Packet (Tag 12)
*
* {@link https://tools.ietf.org/html/rfc4880#section-5.10|RFC4880 5.10}:
* The Trust packet is used only within keyrings and is not normally
* exported. Trust packets contain data that record the user's
* specifications of which key holders are trustworthy introducers,
* along with other information that implementing software uses for
* trust information. The format of Trust packets is defined by a given
* implementation.
*
* Trust packets SHOULD NOT be emitted to output streams that are
* transferred to other users, and they SHOULD be ignored on any input
* other than local keyring files.
*/
class TrustPacket {
static get tag() {
return enums.packet.trust;
}
/**
* Parsing function for a trust packet (tag 12).
* Currently not implemented as we ignore trust packets
* @param {String} byptes - Payload of a tag 12 packet
*/
read() {} // TODO
// eslint-disable-next-line class-methods-use-this
write() {
throw new Error('Trust packets are not supported');
}
}
export default TrustPacket;