# Class: Message

## message~ Message

Class that represents an OpenPGP message. Can be an encrypted message, signed message, compressed message or literal message

#### new Message(packetlist)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `packetlist` | module:packet/packetlist | The packets that form this message See http://tools.ietf.org/html/rfc4880#section-11.3

  Source:
    - message.js, line 35

### Methods

#### armor() → {String}

  Returns ASCII armored text of message
  Source:
    - message.js, line 256

  ##### Returns:

  ASCII armor
  Type
    String

#### decrypt(privateKey) → {Array.<module:message~Message>}

  Decrypt the message

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `privateKey` | module:key~Key | private key with decrypted secret data

  Source:
    - message.js, line 82

  ##### Returns:

  new message with decrypted content
  Type
    Array.<module:message~Message>

#### encrypt(keys) → {Array.<module:message~Message>}

  Encrypt the message

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `keys` | Array.<module:key~Key> | array of keys, used to encrypt the message

  Source:
    - message.js, line 136

  ##### Returns:

  new message with encrypted content
  Type
    Array.<module:message~Message>

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

  Returns the key IDs of the keys to which the session key is encrypted
  Source:
    - message.js, line 46

  ##### Returns:

  array of keyid objects
  Type
    Array.<module:type/keyid>

#### getLiteralData() → {String|null}

  Get literal data that is the body of the message
  Source:
    - message.js, line 113

  ##### Returns:

  literal body of the message as string
  Type
    String | null

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

  Returns the key IDs of the keys that signed the message
  Source:
    - message.js, line 59

  ##### Returns:

  array of keyid objects
  Type
    Array.<module:type/keyid>

#### getText() → {String|null}

  Get literal data as text
  Source:
    - message.js, line 122

  ##### Returns:

  literal body of the message interpreted as text
  Type
    String | null

#### sign(privateKey) → {module:message~Message}

  Sign the message (the literal data packet of the message)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `privateKey` | Array.<module:key~Key> | private keys with decrypted secret key data for signing

  Source:
    - message.js, line 173

  ##### Returns:

  new message with signed content
  Type
    module:message~Message

#### unwrapCompressed() → {module:message~Message}

  Unwrap compressed message
  Source:
    - message.js, line 243

  ##### Returns:

  message Content of compressed message
  Type
    module:message~Message

#### verify(publicKeys) → {Array.<({keyid: module:type/keyid, valid: Boolean})>}

  Verify message signatures

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `publicKeys` | Array.<module:key~Key> | public keys to verify signatures

  Source:
    - message.js, line 218

  ##### Returns:

  list of signer's keyid and validity of signature
  Type
    Array.<({keyid: module:type/keyid, valid: Boolean})>