Files: 6fbfd862e4a06d10ffbcf951f549e28ddf9fb345 / test / multi.js
642 bytesRaw
1 | |
2 | var multi = require('../multi') |
3 | |
4 | var ssbKeys = require('../') |
5 | |
6 | var tape = require('tape') |
7 | |
8 | var alice = ssbKeys.generate() |
9 | var bob = ssbKeys.generate() |
10 | |
11 | var keyring = {} |
12 | |
13 | var alice_friends = ssbKeys.randomKey() |
14 | |
15 | keyring[alice.id] = alice_friends |
16 | |
17 | console.log(keyring) |
18 | |
19 | tape('simple', function (t) { |
20 | var ptxt = {type: 'post', text: 'hello secret world'} |
21 | console.log('bob', bob.id) |
22 | var ctxt = multi.box(ptxt, [alice_friends, bob.id]) |
23 | |
24 | t.deepEqual( |
25 | multi.unbox({author: alice.id, content: ctxt}, [alice_friends]), |
26 | ptxt |
27 | ) |
28 | |
29 | t.deepEqual( |
30 | multi.unbox({author: alice.id, content: ctxt}, [bob]), |
31 | ptxt |
32 | ) |
33 | |
34 | t.end() |
35 | |
36 | }) |
37 | |
38 | |
39 | |
40 |
Built with git-ssb-web