{"id":16759164,"url":"https://github.com/alcalzone/node-dtls-client","last_synced_at":"2025-03-17T02:31:13.599Z","repository":{"id":20954992,"uuid":"91365703","full_name":"AlCalzone/node-dtls-client","owner":"AlCalzone","description":"clientside UDP wrapper for DTLS v1.2","archived":false,"fork":false,"pushed_at":"2023-05-01T02:57:53.000Z","size":1798,"stargazers_count":24,"open_issues_count":8,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-14T21:54:35.277Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlCalzone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"AlCalzone","patreon":"AlCalzone","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2017-05-15T17:31:41.000Z","updated_at":"2024-06-18T16:52:12.284Z","dependencies_parsed_at":"2024-06-18T16:52:07.060Z","dependency_job_id":"afaac960-8c0d-4647-abda-8fbe698ed99e","html_url":"https://github.com/AlCalzone/node-dtls-client","commit_stats":{"total_commits":588,"total_committers":8,"mean_commits":73.5,"dds":0.695578231292517,"last_synced_commit":"2a463ef4297a230d716544e330c5d308fdc4ec44"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlCalzone%2Fnode-dtls-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlCalzone%2Fnode-dtls-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlCalzone%2Fnode-dtls-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlCalzone%2Fnode-dtls-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlCalzone","download_url":"https://codeload.github.com/AlCalzone/node-dtls-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243837008,"owners_count":20355813,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T04:07:29.675Z","updated_at":"2025-03-17T02:31:13.154Z","avatar_url":"https://github.com/AlCalzone.png","language":"TypeScript","funding_links":["https://github.com/sponsors/AlCalzone","https://patreon.com/AlCalzone"],"categories":[],"sub_categories":[],"readme":"# node-dtls-client\n\n[![node](https://img.shields.io/node/v/node-dtls-client.svg) ![npm](https://img.shields.io/npm/v/node-dtls-client.svg)](https://www.npmjs.com/package/node-dtls-client)\n\n[![Build Status](https://img.shields.io/circleci/project/github/AlCalzone/node-dtls-client.svg)](https://circleci.com/gh/AlCalzone/node-dtls-client)\n[![Coverage Status](https://img.shields.io/coveralls/github/AlCalzone/node-dtls-client.svg)](https://coveralls.io/github/AlCalzone/node-dtls-client)\n\nUSE AT YOUR OWN RISK!\n\n[DTLS](https://en.wikipedia.org/wiki/Datagram_Transport_Layer_Security) protocol implementation for Node.js written in TypeScript. \nThis library provides the missing native DTLS support for Node.js client-side applications. It contains no server-side implementation.\n\nAlthough great care has been taken to properly implement the required encryption and validation, \nthere's no explicit protection against TLS attacks. Thus it is not advised to use it for security-critical applications. \nThis libary's main goal is to allow using protocols that *require* DTLS.\n\n## Usage\n\n### Establish a secure connection:\n```js\nvar dtls = require(\"node-dtls-client\");\n\nconst socket = dtls\n\t// create a socket and initialize the secure connection\n\t.createSocket(options /* DtlsOptions */)\n\t// subscribe events\n\t.on(\"connected\", () =\u003e {/* start sending data */})\n\t.on(\"error\", (e /* Error */) =\u003e { })\n\t.on(\"message\", (msg /* Buffer */) =\u003e { })\n\t.on(\"close\", () =\u003e { })\n\t;\n```\n\nThe `DtlsOptions` object looks as follows:\n```js\n{\n\ttype: \"udp4\",\n\taddress: \"ip or host\",\n\tport: 5684,\n\tpsk: { \"psk_hint\": \"PSK\" },\n\ttimeout: 1000, // in ms, optional, minimum 100, default 1000\n\tciphers: [ /* ... */ ], // optional array of (D)TLS cipher suites, e.g. [\"TLS_PSK_WITH_AES_128_CCM\"]\n\tlistenPort: 2345 // optional local port number to listen at, default: chosen at random\n\tcompat: { // optional compat options\n\t\t/**\n\t\t * The IKEA gateway v1.15.x has a bug where the Server Hello reuses the sequence number of the Hello Verify Request.\n\t\t * This flag can be set to true to work around it.\n\t\t */\n\t\tresetAntiReplayWindowBeforeServerHello: true,\n\t}\n}\n```\n\nThe `ciphers` property allows specifying which cipher suites should be advertised as supported. If this property is not provided, all supported ciphers are used by default. Use this if you want to force specific cipher suites for the communication.  \nThe currently supported cipher suites are limited to those with PSK key exchange:\n\n* `\"TLS_PSK_WITH_3DES_EDE_CBC_SHA\"`\n* `\"TLS_PSK_WITH_AES_128_CBC_SHA\"`\n* `\"TLS_PSK_WITH_AES_256_CBC_SHA\"`\n* `\"TLS_PSK_WITH_AES_128_CBC_SHA256\"`\n* `\"TLS_PSK_WITH_AES_256_CBC_SHA384\"`\n* `\"TLS_PSK_WITH_AES_128_GCM_SHA256\"`\n* `\"TLS_PSK_WITH_AES_256_GCM_SHA384\"`\n* `\"TLS_PSK_WITH_AES_128_CCM_8\"`\n* `\"TLS_PSK_WITH_AES_256_CCM_8\"`\n\n**PRs for other key exchange methods are welcome!**\n\n### Send some data (after the `connected` event was received):\n```js\nsocket.send(data /* Buffer */, [callback]);\n```\n\nThe events are defined as follows:\n- `connected`: A secure connection has been established. Start sending data in the callback\n- `error`: An error has happened. This usually means the handshake was not successful\n- `message`: The socket received some data.\n- `close`: The connection was closed successfully.\n\n\n## Missing features:\n- [x] alert protocol implementation (partially supported)\n- [ ] cipher suites with non-PSK key exchange algorithms: `dhe_dss` | `dhe_rsa` | `rsa` | `dh_dss` | `dh_rsa` | `dhe_psk` | `rsa_psk`\n- [ ] packet retransmission\n- [ ] session renegotiation\n- [ ] other compression algorithms except NULL\n\n**PRs adding support for these are welcome!**\n\n## Changelog\n\u003c!--\n    PLACEHOLDER for next version:\n    ### __WORK IN PROGRESS__\n--\u003e\n### 1.1.1 (2023-01-26)\n* Updated the `node-aead-crypto` dependency for proper Electron support\n\n### 1.0.2 (2023-01-26)\n* Fixed the check for Electron runtime\n\n### 1.0.1 (2021-06-30)\n* Workaround for a bug in IKEA gateway firmware `v1.15.x`\n\n### 1.0.0 (2021-06-19)\n* Require Node.js 12+\n\n### 0.7.0 (2021-03-04)\n* Added the ability to specify the local listen port\n\n### 0.6.0 (2020-02-29)\n* Add support for DTLS 1.3 alerts\n\n### 0.5.6 (2018-11-04)\n* `node-aead-crypto` is now an optional dependency\n* Remove `strictPropertyInitialization` since it doesn't work without `strictNullChecks`\n\n### 0.5.4 (2018-05-01)\n* **Potentially breaking change:** No longer use `node-aead-crypto` on NodeJS 10+\n\n### 0.4.0 (2018-05-01)\n* Check connection options before creating a new socket\n* Improve testing setup, use CircleCI for deployment\n\n### 0.3.2 (2018-04-27)\n* Support NodeJS 10\n\n### 0.3.1 (2018-02-13)\n* Suppress spurious errors from DNS lookup after the connection has already timed out\n\n### 0.3.0 (2018-02-05)\n* Fixed cipher parameters of 3DES and 256-bit AES (AEAD) cipher suites.\n* Added the possibility to limit the cipher suites to use\n\n### 0.2.2 (2017-09-25)\n* Removed possible sources of infinite loops\n\n### 0.2.1 (2017-09-25)\n* Fix error handling while trying to connect to a non-available endpoint\n\n### 0.2.0 (2017-09-21)\n* add partial alert protocol implementation\n\n### 0.1.0 (2017-08-23)\n* publish to npm\n\n### 0.0.3 (2017-08-09)\n* bugfixes\n\n### 0.0.2 (2017-08-01)\n* improved error and timeout handling in the socket wrapper.\n\n### 0.0.1\n* initial release.\n\n## Contributors\n* https://github.com/thoukydides - Thanks for noticing the errors in the 3DES and 256-bit AES (AEAD) cipher suites.\n\n## License\nThe MIT License (MIT)\n\nCopyright (c) 2017-2023 AlCalzone \u003cd.griesel@gmx.net\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falcalzone%2Fnode-dtls-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falcalzone%2Fnode-dtls-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falcalzone%2Fnode-dtls-client/lists"}