Class: CleartextMessage

CleartextMessage(text, signature)

Class that represents an OpenPGP cleartext signed message. See https://tools.ietf.org/html/rfc4880#section-7

Constructor

new CleartextMessage(text, signature)

Parameters:
Name Type Description
text String

The cleartext of the signed message

signature Signature

The detached signature or an empty signature for unsigned messages

Source:

Classes

CleartextMessage

Methods

(static) fromText(text)

Creates a new CleartextMessage object from text

Parameters:
Name Type Description
text String
Source:

armor(configopt) → {String|ReadableStream.<String>}

Returns ASCII armored text of cleartext signed message

Parameters:
Name Type Attributes Description
config Object <optional>

Full configuration, defaults to openpgp.config

Source:
Returns:

ASCII armor.

Type
String | ReadableStream.<String>

getSigningKeyIds() → {Array.<module:type/keyid~Keyid>}

Returns the key IDs of the keys that signed the cleartext message

Source:
Returns:

Array of keyid objects.

Type
Array.<module:type/keyid~Keyid>

getText() → {String}

Get cleartext

Source:
Returns:

Cleartext of message.

Type
String

(async) sign(privateKeys, signatureopt, signingKeyIdsopt, dateopt, userIdsopt, configopt) → {CleartextMessage}

Sign the cleartext message

Parameters:
Name Type Attributes Default Description
privateKeys Array.<Key>

private keys with decrypted secret key data for signing

signature Signature <optional>
null

Any existing detached signature

signingKeyIds Array.<module:type/keyid~Keyid> <optional>

Array of key IDs to use for signing. Each signingKeyIds[i] corresponds to privateKeys[i]

date Date <optional>

The creation time of the signature that should be created

userIds Array <optional>

User IDs to sign with, e.g. [{ name:'Steve Sender', email:'steve@openpgp.org' }]

config Object <optional>

Full configuration, defaults to openpgp.config

Source:
Returns:

New cleartext message with signed content.

Type
CleartextMessage

(async) signDetached(privateKeys, signatureopt, signingKeyIdsopt, dateopt, userIdsopt, configopt) → {Signature}

Sign the cleartext message

Parameters:
Name Type Attributes Default Description
privateKeys Array.<Key>

private keys with decrypted secret key data for signing

signature Signature <optional>
null

Any existing detached signature

signingKeyIds Array.<module:type/keyid~Keyid> <optional>

Array of key IDs to use for signing. Each signingKeyIds[i] corresponds to privateKeys[i]

date Date <optional>

The creation time of the signature that should be created

userIds Array <optional>

User IDs to sign with, e.g. [{ name:'Steve Sender', email:'steve@openpgp.org' }]

config Object <optional>

Full configuration, defaults to openpgp.config

Source:
Returns:

New detached signature of message content.

Type
Signature

(async) verify(keys, dateopt, configopt) → {Array.<{keyid: module:type/keyid~Keyid, valid: Boolean}>}

Verify signatures of cleartext signed message

Parameters:
Name Type Attributes Description
keys Array.<Key>

Array of keys to verify signatures

date Date <optional>

Verify the signature against the given date, i.e. check signature creation time < date < expiration time

config Object <optional>

Full configuration, defaults to openpgp.config

Source:
Returns:

List of signer's keyid and validity of signature.

Type
Array.<{keyid: module:type/keyid~Keyid, valid: Boolean}>

(async) verifyDetached(keys, dateopt, configopt) → {Array.<{keyid: module:type/keyid~Keyid, valid: Boolean}>}

Verify signatures of cleartext signed message

Parameters:
Name Type Attributes Description
keys Array.<Key>

Array of keys to verify signatures

date Date <optional>

Verify the signature against the given date, i.e. check signature creation time < date < expiration time

config Object <optional>

Full configuration, defaults to openpgp.config

Source:
Returns:

List of signer's keyid and validity of signature.

Type
Array.<{keyid: module:type/keyid~Keyid, valid: Boolean}>