git ssb

0+

Dominic / ssb-peer-invites



Commit 1bf6749fd49324f237521f3e779c58fb5e03dfe8

invite contains pub addresses, without extra metadata, and errors if no pubs where found, unless you explicitly asked for no pubs

Dominic Tarr committed on 12/21/2018, 1:08:10 AM
Parent: 116e3cd65df60b1fea337b9d5a7932b576aed6a1

Files changed

index.jschanged
index.jsView
@@ -314,8 +314,11 @@
314314 return opts(new Error ('user-invites: expected: options *must* be provided.'))
315315
316316 var host_id = opts.id || sbot.id
317317 getNearbyPubs(opts, function (err, near) {
318 + if(near.length == 0 && !opts.allowWithoutPubs)
319 + return cb(new Error('failed to find any suitable pubs'))
320 +
318321 var seed = crypto.randomBytes(32).toString('base64')
319322 sbot.identities.publishAs({
320323 id: host_id,
321324 content: I.createInvite(seed, host_id, opts.reveal, opts.private, caps)
@@ -323,9 +326,9 @@
323326 if(err) return cb(err)
324327 cb(null, {
325328 seed: seed,
326329 invite: data.key,
327- pubs: near,
330 + pubs: near.map(function (e) { return e.address }),
328331 })
329332 })
330333 })
331334 }
@@ -435,5 +438,4 @@
435438
436439 return invites
437440 }
438441
439-

Built with git-ssb-web