Skip to content

Commit

Permalink
Unslab publicKey and remotePublicKey in connect
Browse files Browse the repository at this point in the history
  • Loading branch information
HDegroote committed Jul 29, 2024
1 parent 1a9e452 commit 806e664
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const DebuggingStream = require('debugging-stream')
const { isPrivate, isBogon } = require('bogon')
const safetyCatch = require('safety-catch')
const { getStreamError } = require('streamx')
const unslab = require('unslab')
const Semaphore = require('./semaphore')
const NoiseWrap = require('./noise-wrap')
const SecurePayload = require('./secure-payload')
Expand Down Expand Up @@ -37,10 +38,12 @@ module.exports = function connect (dht, publicKey, opts = {}) {

if (pool && pool.has(publicKey)) return pool.get(publicKey)

publicKey = unslab(publicKey)

const keyPair = opts.keyPair || dht.defaultKeyPair
const relayThrough = selectRelay(opts.relayThrough || null)
const encryptedSocket = (opts.createSecretStream || defaultCreateSecretStream)(true, null, {
publicKey: keyPair.publicKey,
publicKey: unslab(keyPair.publicKey),
remotePublicKey: publicKey,
autoStart: false,
keepAlive: dht.connectionKeepAlive
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"signal-promise": "^1.0.3",
"sodium-universal": "^4.0.0",
"streamx": "^2.16.1",
"unslab": "^1.3.0",
"xache": "^1.1.0"
},
"devDependencies": {
Expand Down

0 comments on commit 806e664

Please sign in to comment.