0.1.0 • Published 7 years ago

node-opendkim v0.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

NPM

Codefresh build status

node-opendkim

node.js native language binding to libopendkim

Install/Test Locally (from source)

git clone git@github.com:godsflaw/node-opendkim.git
cd node-opendkim
npm install
npm test -- --verbose

Install Locally (npm)

npm install --save node-opendkim

Install Globally (npm)

npm install --global node-opendkim

Compile (Development)

node-gyp rebuild

Usage

Verify (async/await)

const OpenDKIM = require('node-opendkim');

async function verify(message) {
  var opendkim = new OpenDKIM();

  try {
    await opendkim.verify({id: undefined});
    await opendkim.chunk({
      message: message,
      length: message.length
    });
    await opendkim.chunk_end();
  } catch (err) {
    console.log(opendkim.sig_geterrorstr(opendkim.sig_geterror()));
    console.log(err);
  }
}

Verify (sync)

const OpenDKIM = require('node-opendkim');

function verify_sync(message) {
  var opendkim = new OpenDKIM();

  try {
    opendkim.verify_sync({id: undefined});
    opendkim.chunk_sync({
      message: message,
      length: message.length
    });
    opendkim.chunk_end_sync();
  } catch (err) {
    console.log(opendkim.sig_geterrorstr(opendkim.sig_geterror()));
    console.log(err);
  }
}

Verify (errback)

const OpenDKIM = require('node-opendkim');

function verify(opendkim, message, callback) {
  opendkim.verify({id: undefined}, function (err, result) {
    if (err) {
      return callback(err, result);
    }

    var options = {
      message: message,
      length: message.length
    };

    opendkim.chunk(options, function (err, result) {
      if (err) {
        return callback(err, result);
      }

      opendkim.chunk_end(function (err, result) {
        if (err) {
          return callback(err, result);
        }

        return callback(err, result);
      });
    });
  });
}

var opendkim = new OpenDKIM();

verify(opendkim, message, function (err, result) {
  if (err) {
    return console.log(opendkim.sig_geterrorstr(opendkim.sig_geterror()));
  }

  // success
});

API Administration

API Processing

API Signing

API Utility

API Verifying


License

MIT © Christopher Mooney

0.1.0

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago

0.0.0

7 years ago