git ssb

1+

kieran / horcrux-schemas-and-thoughts



Commit 68c5144682ae892eea922813d3a9926745a0dda3

Begin writing tests

Kieran committed on 4/16/2018, 3:14:14 AM
Parent: 2a4663559da41aea3a92b628fe87770d76aca78f

Files changed

index.jschanged
package.jsonchanged
test/index.jsadded
index.jsView
@@ -130,6 +130,4 @@
130130 }
131131 }
132132
133133
134-// secrets.invites.get(rootId, callback)
135-// secrets.responses.get(rootId, callback)
package.jsonView
@@ -8,8 +8,9 @@
88 "dependencies": {
99 "flumeview-reduce": "^1.3.13",
1010 "lodash": "^4.17.5",
1111 "pull-stream": "^3.6.2",
12 + "ssb-private": "^0.1.4",
1213 "xtend": "^4.0.1"
1314 },
1415 "devDependencies": {
1516 "pryjs": "^1.0.3",
test/index.jsView
@@ -1,0 +1,43 @@
1 +const Server = require('scuttle-testbot')
2 +const Keys = require('ssb-keys')
3 +const test = require('tape')
4 +const get = require('lodash/get')
5 +const pry = require('pryjs')
6 +
7 +Server
8 + .use(require('ssb-private'))
9 + .use(require('../index.js'))
10 +
11 +const alice = Keys.generate()
12 +const bob = Keys.generate()
13 +
14 +console.log("*** Generating Keys ***", "\n")
15 +console.log("Alice: ", alice, "\n")
16 +console.log("Bob: ", bob, "\n")
17 +
18 +console.log("*** Starting Alice's Server ***", "\n")
19 +const aliceConfig = { name: "alicetestbot", keys: alice }
20 +const aliceServer = Server(aliceConfig)
21 +console.log(aliceServer)
22 +
23 +test("it should publish an encrypted secret root", t => {
24 + aliceServer.private.publish({
25 + module: "secret",
26 + type: "root"
27 + }, [
28 + aliceConfig.keys.id
29 + ], (err, msg) => {
30 + var { author, content } = msg.value
31 + var decrypt = aliceServer.private.unbox(content, alice.private)
32 +
33 + t.equal(author, alice.id)
34 + t.equal("secret", decrypt.module)
35 + t.equal("root", decrypt.type)
36 + t.end()
37 + })
38 +})
39 +
40 +test("it should return a collection of root IDs", t => {
41 + t.equal(0, 0)
42 + t.end()
43 +})

Built with git-ssb-web