diff options
-rw-r--r-- | package-lock.json | 5 | ||||
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | public/scripts/chat.js | 7 |
3 files changed, 10 insertions, 3 deletions
diff --git a/package-lock.json b/package-lock.json index 73b880e..9cf8c8d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6951,6 +6951,11 @@ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.0.1.tgz", "integrity": "sha512-k1u2uemjIGsn25zmujKnotgniC/gxQ9sdegdezeDiKdkDW56THUMqlz3urndKCXJxA6yPzSZbXx/QCMe/pxqsA==" }, + "nanoid-dictionary": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/nanoid-dictionary/-/nanoid-dictionary-2.0.0.tgz", + "integrity": "sha512-mjMNB0yg2lH6stvxeZs2sBFhwhMwoYdbevPT5DYMxk8iDTI3vAZ6YAvHm+uBFT4VvGITpPpBX1U0sWVRTlPzOA==" + }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", diff --git a/package.json b/package.json index c16dcb1..9f26dee 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "jquery": "^3.3.1", "morgan": "^1.9.0", "nanoid": "^2.0.1", + "nanoid-dictionary": "^2.0.0", "onchange": "^5.2.0", "openpgp": "^4.4.5", "peer": "^0.2.10", diff --git a/public/scripts/chat.js b/public/scripts/chat.js index 01377bf..711912b 100644 --- a/public/scripts/chat.js +++ b/public/scripts/chat.js @@ -1,10 +1,11 @@ const $ = require('jquery'); const encryption = require('./2_encryption'); -const nanoid = require('nanoid'); +const generate = require('nanoid/generate'); +const nolookalikes = require('nanoid-dictionary/nolookalikes'); let connectedPeers = []; // TODO: Save new peers in array let connectedPeer; -const peerId = nanoid(); +const peerId = generate(nolookalikes, 16); // setup encryption (async () => { @@ -36,7 +37,7 @@ function chat() { * @param id */ function connect(id) { - const connectionId = nanoid(); + const connectionId = generate(nolookalikes, 16); console.log('[LOG] Connecting to', id); console.log('[LOG] Your connection ID is', connectionId); connectedPeer = peer.connect(id, {label: connectionId, reliable: true}); |