Module: message

Requires

Classes

Message

Methods

(async, static) createSignaturePackets(literalDataPacket, privateKeys, signature, date, userId) → {Promise.<module:packet.List>}

Create signature packets for the message

Parameters:
Name Type Description
literalDataPacket module:packet.Literal

the literal data packet to sign

privateKeys Array.<module:key.Key>

private keys with decrypted secret key data for signing

signature Signature

(optional) any existing detached signature to append

date Date

(optional) override the creationtime of the signature

userId Object

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

Source:
Returns:

list of signature packets

Type
Promise.<module:packet.List>

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

Create list of objects containing signer's keyid and validity of signature

Parameters:
Name Type Description
signatureList Array.<module:packet.Signature>

array of signature packets

literalDataList Array.<module:packet.Literal>

array of literal data packets

keys Array.<module:key.Key>

array of keys to verify signatures

date Date

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, static) encryptSessionKey(sessionKey, symAlgo, aeadAlgo, publicKeys, passwords, wildcard, date, userId) → {Promise.<Message>}

Encrypt a session key either with public keys, passwords, or both at once.

Parameters:
Name Type Description
sessionKey Uint8Array

session key for encryption

symAlgo String

session key algorithm

aeadAlgo String

(optional) aead algorithm, e.g. 'eax' or 'ocb'

publicKeys Array.<Key>

(optional) public key(s) for message encryption

passwords Array.<String>

(optional) for message encryption

wildcard Boolean

(optional) use a key ID of 0 instead of the public key IDs

date Date

(optional) override the date

userId Object

(optional) user ID to encrypt for, e.g. { name:'Robert Receiver', email:'[email protected]g' }

Source:
Returns:

new message with encrypted content

Type
Promise.<Message>

(static) fromBinary(bytes, filename, date, type) → {module:message.Message}

creates new message object from binary data

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

(optional)

date Date

(optional)

type utf8 | binary | text | mime

(optional) data packet type

Source:
Returns:

new message object

Type
module:message.Message

(static) fromText(text, filename, date, type) → {module:message.Message}

creates new message object from text

Parameters:
Name Type Description
text String | ReadableStream.<String>
filename String

(optional)

date Date

(optional)

type utf8 | binary | text | mime

(optional) data packet type

Source:
Returns:

new message object

Type
module:message.Message

(async, static) read(input, fromStream) → {Promise.<module:message.Message>}

reads an OpenPGP message as byte array and returns a message object

Parameters:
Name Type Description
input Uint8Array | ReadableStream.<Uint8Array>

binary message

fromStream Boolean

whether the message was created from a Stream

Source:
Returns:

new message object

Type
Promise.<module:message.Message>

(async, static) readArmored(armoredText) → {Promise.<module:message.Message>}

reads an OpenPGP armored message and returns a message object

Parameters:
Name Type Description
armoredText String | ReadableStream.<String>

text to be parsed

Source:
Returns:

new message object

Type
Promise.<module:message.Message>

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

Create object containing signer's keyid and validity of signature

Parameters:
Name Type Description
signature module:packet.Signature

signature packets

literalDataList Array.<module:packet.Literal>

array of literal data packets

keys Array.<module:key.Key>

array of keys to verify signatures

date Date

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}>>