zwaveip-securedgram

1.0.0 • Public • Published

dtls-node

A partial DTLS 1.0 implementation for Node.js. Unofficial library, not supported by Sigma Designs.

This 'securedgram' library is designed to be a mostly-drop-in replacement for the standard node.js 'dgram' library.

This library supports DTLS 1.0 and the following ciphersuites:

  • TLS_PSK_WITH_AES_128_CBC_SHA
  • TLS_PSK_WITH_AES_256_CBC_SHA

To install the library

npm install zwaveip-securedgram

To import the library

let DtlsSocket = require('zwaveip-securedgram');

To create a socket instance

let dtlsSocket = DtlsSocket.createDtlsSocket(ipAddressFamily, callbackObject, callback);

  • ipAddressFamily options: ['udp4', 'udp6']
  • callbackObject: OPTIONAL object passed in first parameter of callback to tag this socket
  • callback: OPTIONAL callback, called when a message is received

To send a message

dtlsSocket.send(message, offset, length, port, host, pskIdentity, pskPassword, callback);

  • message: buffer containing message to send
  • offset: offset (within buffer)
  • length: length (within buffer)
  • port: port #
  • host: hostname or ip address
  • pskIdentity: PSK "identity" parameter
  • pskPassword: Pre-shared key ("PSK password")
  • callback: OPTIONAL callback

To receive a message (via createDtlsSocket-specified callback)

let onMessage = function(callbackObject, data, rinfo) { // handle message here }

NOTE: the developer must pass this function as the callback parameter when instantiating the DtlsSocket.

Readme

Keywords

Package Sidebar

Install

npm i zwaveip-securedgram

Weekly Downloads

0

Version

1.0.0

License

Apache-2.0

Last publish

Collaborators

  • zwaveiot