git ssb

0+

Dominic / ssb-peer-invites



Tree: bbe62fbce9b33aecd11d216692e3de644aa62f80

Files: bbe62fbce9b33aecd11d216692e3de644aa62f80 / test / error-without-pubs.js

1403 bytesRaw
1//WARNING: this test currently only passes
2//if the computer has a network.
3var crypto = require('crypto')
4var I = require('../valid')
5var createClient = require('ssb-client')
6
7
8var ssbKeys = require('ssb-keys')
9var tape = require('tape')
10var pull = require('pull-stream')
11var ref = require('ssb-ref')
12
13var createSbot = require('scuttlebot')
14 .use(require('ssb-links'))
15 .use({
16 name: 'replicate', version: '1.0.0',
17 manifest: { request: 'sync' },
18 init: function () {
19 return { request: function () {} }
20 }
21 })
22 .use(require('ssb-query'))
23 .use(require('ssb-device-address'))
24 .use(require('ssb-identities'))
25 .use(require('ssb-friends'))
26 .use(require('../'))
27
28function all(stream, cb) {
29 return pull(stream, pull.collect(cb))
30}
31
32var caps = {
33 sign: crypto.randomBytes(32),//.toString('base64'),
34 peerInvite: crypto.randomBytes(32),//.toString('base64'),
35 shs: crypto.randomBytes(32),//.toString('base64'),
36}
37
38var alice = createSbot({
39 temp: true,
40 timeout: 1000,
41 port: 12342,
42 keys:ssbKeys.generate(),
43 caps: caps
44})
45
46function toId(msg) {
47 return '%'+ssbKeys.hash(JSON.stringify(msg, null, 2))
48}
49
50tape('create an invite', function (t) {
51
52 var seed = crypto.randomBytes(32)
53
54 //without the pubs option, do not allow creating
55 //an invite.
56 alice.peerInvites.create({}, function (err, invite) {
57 t.ok(err)
58 alice.close()
59 t.end()
60 })
61})
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

Built with git-ssb-web