From 8daee8c2688b1ff36608b422291d20fbb1791ffd Mon Sep 17 00:00:00 2001 From: Andre Staltz Date: Tue, 9 Jan 2024 10:39:26 +0200 Subject: [PATCH] parse token=none in join command --- lib/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 19aa507..d24cdfa 100644 --- a/lib/index.js +++ b/lib/index.js @@ -68,12 +68,16 @@ function parseJoinCommand(pieces, uri) { throw new Error(`Invalid URI "${uri}" for invite.parse, missing join hub pubkey`) } // TODO: base58 validation for the token, if present at all + if (!token) { + // prettier-ignore + throw new Error(`Invalid URI "${uri}" for invite.parse, missing join hub token`) + } pieces.shift() pieces.shift() pieces.shift() pieces.shift() pieces.shift() - const shse = token ? `shse:${pubkey}:${token}` : `shse:${pubkey}` + const shse = token === 'none' ? `shse:${pubkey}` : `shse:${pubkey}:${token}` const address = `net:${host}:${port}~${shse}` // TODO: add ws address here return { type: 'join', address } }