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(config) → {String|ReadableStream.<String>}

Returns ASCII armored text of cleartext signed message

Parameters:
Name Type 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, signature, signingKeyIds, date, userIds, config) → {Promise.<CleartextMessage>}

Sign the cleartext message

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

private keys with decrypted secret key data for signing

signature Signature null

(optional) 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
Promise.<CleartextMessage>

(async) signDetached(privateKeys, signature, signingKeyIds, date, userIds, config) → {Promise.<Signature>}

Sign the cleartext message

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

private keys with decrypted secret key data for signing

signature Signature null

(optional) 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
Promise.<Signature>

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

Verify signatures of cleartext signed message

Parameters:
Name Type 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
Promise.<Array.<{keyid: module:type/keyid~Keyid, valid: Boolean}>>

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

Verify signatures of cleartext signed message

Parameters:
Name Type 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
Promise.<Array.<{keyid: module:type/keyid~Keyid, valid: Boolean}>>