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 AMParent: 116e3cd65df60b1fea337b9d5a7932b576aed6a1
Files changed
index.js | changed |
index.js | |||
---|---|---|---|
@@ -314,8 +314,11 @@ | |||
314 | 314 … | return opts(new Error ('user-invites: expected: options *must* be provided.')) | |
315 | 315 … | ||
316 | 316 … | var host_id = opts.id || sbot.id | |
317 | 317 … | getNearbyPubs(opts, function (err, near) { | |
318 … | + if(near.length == 0 && !opts.allowWithoutPubs) | ||
319 … | + return cb(new Error('failed to find any suitable pubs')) | ||
320 … | + | ||
318 | 321 … | var seed = crypto.randomBytes(32).toString('base64') | |
319 | 322 … | sbot.identities.publishAs({ | |
320 | 323 … | id: host_id, | |
321 | 324 … | content: I.createInvite(seed, host_id, opts.reveal, opts.private, caps) | |
@@ -323,9 +326,9 @@ | |||
323 | 326 … | if(err) return cb(err) | |
324 | 327 … | cb(null, { | |
325 | 328 … | seed: seed, | |
326 | 329 … | invite: data.key, | |
327 | - pubs: near, | ||
330 … | + pubs: near.map(function (e) { return e.address }), | ||
328 | 331 … | }) | |
329 | 332 … | }) | |
330 | 333 … | }) | |
331 | 334 … | } | |
@@ -435,5 +438,4 @@ | |||
435 | 438 … | ||
436 | 439 … | return invites | |
437 | 440 … | } | |
438 | 441 … | ||
439 | - |
Built with git-ssb-web