monkey patch base64 IDs to base58 for now

This commit is contained in:
Andre Staltz 2023-07-13 11:14:29 +03:00
parent f2296cfae0
commit 11fa0eba58
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
1 changed files with 8 additions and 6 deletions

View File

@ -1,3 +1,4 @@
const bs58 = require('bs58')
const cat = require('pull-cat')
const Notify = require('pull-notify')
const pull = require('pull-stream')
@ -81,11 +82,12 @@ module.exports = {
return {
attendants() {
const clientId = this.id
if (clientId && clientId !== sstack.id) {
debug('welcome %s', clientId)
if (!attendants.has(clientId)) {
attendants.set(clientId, sstack.peers[clientId][0])
const clientPubkey = bs58.encode(Buffer.from(this.id, 'base64'))
const clientRPC = sstack.peers[this.id][0]
if (clientPubkey && clientPubkey !== sstack.pubkey) {
debug('welcome %s', clientPubkey)
if (!attendants.has(clientPubkey)) {
attendants.set(clientPubkey, clientRPC)
notifyAttendants([...attendants.keys()])
}
}
@ -102,7 +104,7 @@ module.exports = {
if (attendants.has(target)) {
// prettier-ignore
debug('received tunnel request for target %s from %s', target, this.id)
const origin = this.id
const origin = bs58.encode(Buffer.from(this.id, 'base64'))
return attendants.get(target).hubClient.connect(origin, () => {})
} else {
// prettier-ignore