ssbc / ssb-ref

check if a string is a valid ssb-reference
MIT License
14 stars 10 forks source link

How should parseAddress() be replaced? #31

Open christianbundy opened 5 years ago

christianbundy commented 5 years ago

I've recently noticed a deprecation notice in Scuttlebot, but I'm having a difficult time replacing the deprecated function. I found a reference to multiserver-address, but I don't think ma.decode() is providing { host, port, key } the same way. Here's the error I'm getting when running npm test in the Scuttlebot repo:

/home/christianbundy/src/ssbc/scuttlebot/plugins/gossip/index.js:165
        else throw new Error('must provide id:'+JSON.stringify(addr))
             ^

Error: must provide id:[[{"name":"net","data":["localhost","45451"]},{"name":"shs","data":["QnTycBc1Bm+suBWZmRWEbb7HqlJ/RIsQp/0TFswnHeA="]}]]
    at Object.get (/home/christianbundy/src/ssbc/scuttlebot/plugins/gossip/index.js:165:20)
    at Object.<anonymous> (/home/christianbundy/src/ssbc/scuttlebot/plugins/gossip/index.js:247:24)
    at apply (/home/christianbundy/src/ssbc/scuttlebot/node_modules/muxrpc-validation/index.js:173:15)
    at Object.add (/home/christianbundy/src/ssbc/scuttlebot/node_modules/muxrpc-validation/index.js:62:14)
    at /home/christianbundy/src/ssbc/scuttlebot/plugins/gossip/init.js:12:37
    at Array.forEach (<anonymous>)
    at module.exports (/home/christianbundy/src/ssbc/scuttlebot/plugins/gossip/init.js:12:4)
    at Object.init (/home/christianbundy/src/ssbc/scuttlebot/plugins/gossip/index.js:304:5)
    at /home/christianbundy/src/ssbc/scuttlebot/node_modules/secret-stack/api.js:43:28
    at Array.forEach (<anonymous>)
npm ERR! Test failed.  See above for more details.
christianbundy commented 5 years ago

In case it's useful, I've pushed my [failing] branch to deprecated-parse-address.

cc: @dominictarr

dominictarr commented 5 years ago

look at the stack trace! line 12

https://github.com/ssbc/ssb-server/blob/master/plugins/gossip/init.js#L12

that's coming from the local config. I think some test is using the seeds config to set an old format address, which requires parseAddress.

stale[bot] commented 5 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?