Class: CleartextMessage

cleartext.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 module:signature.Signature

The detached signature or an empty signature for unsigned messages

Source:

Methods

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

Returns ASCII armored text of cleartext signed message

Source:
Returns:

ASCII armor

Type
String | ReadableStream.<String>

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

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

Source:
Returns:

array of keyid objects

Type
Array.<module:type/keyid>

getText() → {String}

Get cleartext

Source:
Returns:

cleartext of message

Type
String

(async) sign(privateKeys, signature, date, userId) → {Promise.<module:cleartext.CleartextMessage>}

Sign the cleartext message

Parameters:
Name Type Description
privateKeys Array.<module:key.Key>

private keys with decrypted secret key data for signing

signature Signature

(optional) any existing detached signature

date Date

(optional) The creation time of the signature that should be created

userId Object

(optional) user ID to sign with, e.g. { name:'Steve Sender', email:'[email protected]' }

Source:
Returns:

new cleartext message with signed content

Type
Promise.<module:cleartext.CleartextMessage>

(async) signDetached(privateKeys, signature, date, userId) → {Promise.<module:signature.Signature>}

Sign the cleartext message

Parameters:
Name Type Description
privateKeys Array.<module:key.Key>

private keys with decrypted secret key data for signing

signature Signature

(optional) any existing detached signature

date Date

(optional) The creation time of the signature that should be created

userId Object

(optional) user ID to sign with, e.g. { name:'Steve Sender', email:'[email protected]' }

Source:
Returns:

new detached signature of message content

Type
Promise.<module:signature.Signature>

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

Verify signatures of cleartext signed message

Parameters:
Name Type Description
keys Array.<module:key.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

Source:
Returns:

list of signer's keyid and validity of signature

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

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

Verify signatures of cleartext signed message

Parameters:
Name Type Description
keys Array.<module:key.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

Source:
Returns:

list of signer's keyid and validity of signature

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