Skip to content

Instantly share code, notes, and snippets.

@desttinghim
Created December 17, 2017 08:16
Show Gist options
  • Save desttinghim/c1cfd6c112e368e67d7d874750945cc5 to your computer and use it in GitHub Desktop.
Save desttinghim/c1cfd6c112e368e67d7d874750945cc5 to your computer and use it in GitHub Desktop.

DESCRIPTION

Denote end-of-message for a message. When verifying, process signatures in order; when signing, compute all signatures. opendkim.eom() is called after the entire body of the message has been passed to the API via zero or more calls to opendkim.body().

For more information: http://www.opendkim.org/libopendkim/dkim_eom.html

ARGUMENTS

Type: undefined

RETURN VALUES

  • Returns opendkim object
  • If passed {testkey: true}, returns a bool indicating if the key is a test key
  • On failure, an exception is thrown that indicates the cause of the problem.

NOTES

  • By default, when verifying, this function processes all signatures, in order. If the DKIM_LIBFLAGS_VERIFYONE flag is set on the library, then processing will stop after one good signature is found. There may be other signatures before or after that one in the message whose evaluation might be meaningful to the calling application. In that case, the calling application should use the final handling callback (see opendkim.set_final() to get an opportunity to process all of the signatures and possibly reorder them as per the application's preference. With the above flag set, this function will use the signatures as reordered by that function (or in arrival order if no reordering is done) and act on the first valid one, or the first one if none are valid.

EXAMPLE

try {
  var opendkim = new OpenDKIM();
  opendkim.verify({
    id: undefined // optional (default: undefined)
  });

  // Adding one header at a time, when finished call opendkim.eoh()
  var header = 'From: <herp@derp.com>';
  opendkim.header({
      header: header,
      length: header.length
  });
  opendkim.eoh();

  // Adding body chunks, when finished call opendkim.eom().  This too
  // can take many chunks.  Do NOT include the terminating DOT.
 var body = 'this is a test';
  opendkim.body({
      body: body,
      length: body.length
  });
  // This does the final validation, and will throw an error if there is one. 
  opendkim.eom();
} catch (err) {
  console.log(err);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment