git ssb

2+

cel / ssb-party



Commit 635c2f715e0bf1b5aebc5942197fd316f088c4f7

Fix blobs.add

as done in %EHorri8amugZ4rGlc6XJRgCRzFI7eWaDwPBv3RBr15w=.sha256
cel committed on 6/14/2017, 8:55:23 PM
Parent: 2c522cb552d3787717830c2a5b8dd92a3fcdfbd2

Files changed

index.jschanged
package.jsonchanged
index.jsView
@@ -6,8 +6,10 @@
66 var msShs = require('multiserver/plugins/shs')
77 var msNet = require('multiserver/plugins/net')
88 var muxrpc = require('muxrpc')
99 var pull = require('pull-stream')
10 +var ssbHash = require('pull-hash/ext/ssb')
11 +var multicb = require('multicb')
1012
1113 function toSodiumKeys(keys) {
1214 if(!keys || !keys.public) return null
1315 return {
@@ -15,8 +17,21 @@
1517 secretKey: new Buffer(keys.private.replace('.ed25519', ''), 'base64'),
1618 }
1719 }
1820
21 +function fixAddBlob(add) {
22 + return function (hash, cb) {
23 + if (typeof hash === 'function') cb = hash, hash = null
24 + var done = multicb({ pluck: 1, spread: true })
25 + var sink = pull(
26 + ssbHash(done()),
27 + add(hash, done())
28 + )
29 + done(cb)
30 + return sink
31 + }
32 +}
33 +
1934 module.exports = function (opts, cb) {
2035 if (typeof opts === 'function') cb = opts, opts = null
2136 opts = opts || {}
2237 var config = createConfig(process.env.ssb_appname, opts)
@@ -56,8 +71,9 @@
5671 var manifest = config.manifest
5772 || JSON.parse(fs.readFileSync(config.manifestFile))
5873 var sbot = muxrpc(manifest, false)()
5974 sbot.id = '@'+stream.remote.toString('base64')+'.ed25519'
75 + if (sbot.blobs && sbot.blobs.add) sbot.blobs.add = fixAddBlob(sbot.blobs.add)
6076 pull(stream, sbot.createStream(), stream)
6177 delete config.keys
6278 cb(null, sbot, config)
6379 })
package.jsonView
@@ -11,10 +11,12 @@
1111 "type": "git",
1212 "url": "ssb://%bS/WGqQrhQfH8eoyWieK+9M56DjJ8Q4ulkvb6sXZwPo=.sha256"
1313 },
1414 "dependencies": {
15 + "multicb": "^1.2.1",
1516 "multiserver": "^1.7.6",
1617 "muxrpc": "^6.3.3",
18 + "pull-hash": "^1.0.0",
1719 "pull-stream": "^3.5.0",
1820 "scuttlebot": "^10.0.5",
1921 "ssb-blobs": "^1.1.0",
2022 "ssb-config": "^2.2.0",

Built with git-ssb-web