From d61c825a006cfddc4cdfe9d617303b693d884f85 Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Mon, 7 Dec 2020 16:02:50 +0100 Subject: [PATCH] fix: replace shortid with hyperid #565 --- docs/Client.md | 2 +- lib/handlers/connect.js | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/Client.md b/docs/Client.md index 183969ac..a0c11c2f 100644 --- a/docs/Client.md +++ b/docs/Client.md @@ -62,7 +62,7 @@ a read-only flag indicates if client is closed or not. ## client.id -- `` __Default__: `aedes_${shortid()}` +- `` __Default__: `aedes_${hyperid()}` Client unique identifier, specified by CONNECT packet. diff --git a/lib/handlers/connect.js b/lib/handlers/connect.js index bc0fa2a7..0f1a9723 100644 --- a/lib/handlers/connect.js +++ b/lib/handlers/connect.js @@ -6,7 +6,7 @@ const write = require('../write') const QoSPacket = require('../qos-packet') const { through } = require('../utils') const handleSubscribe = require('./subscribe') -const shortid = require('shortid') +const uniqueId = require('hyperid')() function Connack (arg) { this.cmd = 'connack' @@ -75,7 +75,7 @@ function init (client, packet, done) { return } - client.id = clientId || 'aedes_' + shortid() + client.id = clientId || 'aedes_' + uniqueId() client.clean = packet.clean client.version = packet.protocolVersion client._will = packet.will diff --git a/package.json b/package.json index 01ae715a..ea8662c4 100644 --- a/package.json +++ b/package.json @@ -114,12 +114,12 @@ "fastfall": "^1.5.1", "fastparallel": "^2.4.0", "fastseries": "^2.0.0", + "hyperid": "^2.0.5", "mqemitter": "^4.4.0", "mqtt-packet": "^6.6.0", "readable-stream": "^3.6.0", "retimer": "^2.0.0", "reusify": "^1.0.4", - "shortid": "^2.2.16", "uuid": "^8.3.1" } }