git ssb

1+

Dominic / ssb-keys



Tree: 6fbfd862e4a06d10ffbcf951f549e28ddf9fb345

Files: 6fbfd862e4a06d10ffbcf951f549e28ddf9fb345 / test / multi.js

642 bytesRaw
1
2var multi = require('../multi')
3
4var ssbKeys = require('../')
5
6var tape = require('tape')
7
8var alice = ssbKeys.generate()
9var bob = ssbKeys.generate()
10
11var keyring = {}
12
13var alice_friends = ssbKeys.randomKey()
14
15keyring[alice.id] = alice_friends
16
17console.log(keyring)
18
19tape('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