git ssb

1+

Dominic / secure-scuttlebutt



Commit 6b125d3850c2ca89b9f10f3b93829450bec6e3f5

don't stick injectables onto options object, infact remove injectable crypto (until there is a better library than nacl!)

Dominic Tarr committed on 10/4/2016, 7:33:21 PM
Parent: 14d29328fdb291bbc31d7df12b6820044c9bf379

Files changed

test/feed.jschanged
test/latest.jschanged
test/links.jschanged
test/log.jschanged
test/msg-encoding.jschanged
test/feed.jsView
@@ -15,11 +15,11 @@
1515 }))
1616
1717 var ssb = require('../')(db, opts)
1818
19-// var feed = createFeed(ssb, opts.generate(), opts)
19 +// var feed = createFeed(ssb, ssbKeys.generate(), opts)
2020
21- var feed = ssb.createFeed(opts.generate())
21 + var feed = ssb.createFeed(ssbKeys.generate())
2222
2323 feed.add('msg', 'hello there!', function (err, msg) {
2424 if(err) throw err
2525 t.assert(!!msg)
@@ -46,9 +46,9 @@
4646 }))
4747
4848 var ssb = require('../')(db, opts)
4949
50- var feed = createFeed(ssb, opts.generate(), opts)
50 + var feed = createFeed(ssb, ssbKeys.generate(), opts)
5151
5252 console.log('add 1'); console.log('add 2');
5353 var nDrains = 0, nAdds = 2;
5454 feed.add('msg', 'hello there!', function (err, msg1) {
@@ -93,9 +93,9 @@
9393 }))
9494
9595 var ssb = require('../')(db, opts)
9696
97- var feed = createFeed(ssb, opts.generate(), opts)
97 + var feed = createFeed(ssb, ssbKeys.generate(), opts)
9898
9999 console.log('add 1'); console.log('add 2');
100100 var nDrains = 0, nAdds = 2, l = 7
101101 feed.add('msg', 'hello there!', function (err, msg1) {
@@ -138,9 +138,9 @@
138138 var db = sublevel(level('test-ssb-feed5', {
139139 valueEncoding: opts.codec
140140 }))
141141 var ssb = require('../')(db, opts)
142- var feed = createFeed(ssb, opts.generate(), opts)
142 + var feed = createFeed(ssb, ssbKeys.generate(), opts)
143143
144144 feed.add('msg', 'hello there!', function (err, msg) {
145145 if(err) throw err
146146 t.assert(!!msg)
@@ -161,9 +161,9 @@
161161 var db = sublevel(level('test-ssb-feed6', {
162162 valueEncoding: opts.codec
163163 }))
164164 var ssb = require('../')(db, opts)
165- var feed = createFeed(ssb, opts.generate(), opts)
165 + var feed = createFeed(ssb, ssbKeys.generate(), opts)
166166
167167 feed.add('msg', 'hello there!', function (err, msg) {
168168 if(err) throw err
169169 t.assert(!!msg)
test/latest.jsView
@@ -16,11 +16,11 @@
1616 sublevel(level('test-ssb-feed', { valueEncoding: opts.codec })),
1717 opts
1818 )
1919
20-var alice = db.createFeed(opts.generate())
21-var bob = db.createFeed(opts.generate())
22-var carol = db.createFeed(opts.generate())
20 +var alice = db.createFeed()
21 +var bob = db.createFeed()
22 +var carol = db.createFeed()
2323
2424 var start = Date.now()
2525
2626 tape('latest', function (t) {
test/links.jsView
@@ -25,10 +25,10 @@
2525 }))
2626
2727 var db = require('../')(db, opts)
2828
29- var alice = db.createFeed(opts.generate())
30- var bob = db.createFeed(opts.generate())
29 + var alice = db.createFeed()
30 + var bob = db.createFeed()
3131
3232 var msgs = []
3333
3434 var from_alice = []
test/log.jsView
@@ -6,8 +6,10 @@
66 var timestamp = require('monotonic-timestamp')
77 var ssbKeys = require('ssb-keys')
88 var createFeed = require('ssb-feed')
99
10 +var generate = ssbKeys.generate
11 +
1012 module.exports = function (opts) {
1113
1214 tape('simple', function (t) {
1315
@@ -16,9 +18,9 @@
1618 }))
1719
1820 var ssb = require('../')(db, opts)
1921
20- var feed = createFeed(ssb, opts.generate(), opts)
22 + var feed = createFeed(ssb, generate(), opts)
2123
2224 feed.add('msg', 'hello there!', function (err, msg) {
2325 if(err) throw err
2426 pull(
@@ -43,9 +45,9 @@
4345 }))
4446
4547 var ssb = require('../')(db, opts)
4648
47- var feed = createFeed(ssb, opts.generate(), opts)
49 + var feed = createFeed(ssb, generate(), opts)
4850
4951 feed.add('msg', 'hello there!', function (err, msg) {
5052 if(err) throw err
5153 var start = timestamp()
@@ -72,9 +74,9 @@
7274 }))
7375
7476 var ssb = require('../')(db, opts)
7577
76- var feed = createFeed(ssb, opts.generate(), opts)
78 + var feed = createFeed(ssb, generate(), opts)
7779
7880 feed.add('msg', 'hello there!', function (err, msg) {
7981 if(err) throw err
8082 pull(
@@ -97,9 +99,9 @@
9799 }))
98100
99101 var ssb = require('../')(db, opts)
100102
101- var feed = createFeed(ssb, opts.generate(), opts)
103 + var feed = createFeed(ssb, generate(), opts)
102104
103105 feed.add('msg', 'hello there!', function (err, msg) {
104106 if(err) throw err
105107 pull(
@@ -123,9 +125,9 @@
123125 }))
124126
125127 var ssb = require('../')(db, opts)
126128
127- var feed = createFeed(ssb, opts.generate(), opts)
129 + var feed = createFeed(ssb, generate(), opts)
128130
129131 feed.add('msg', 'hello there!', function (err, msg) {
130132 if(err) throw err
131133 pull(
@@ -150,9 +152,9 @@
150152 }))
151153
152154 var ssb = require('../')(db, opts)
153155
154- var feed = createFeed(ssb, opts.generate(), opts)
156 + var feed = createFeed(ssb, generate(), opts)
155157
156158 var ts = Date.now()
157159
158160 pull(
test/msg-encoding.jsView
@@ -4,11 +4,13 @@
44 var sublevel = require('level-sublevel/bytewise')
55 var pull = require('pull-stream')
66 var ssbKeys = require('ssb-keys')
77 var createFeed = require('ssb-feed')
8-
98 var hexpp = require('hexpp')
109
10 +var generate = ssbKeys.generate
11 +var hash = ssbKeys.hash
12 +
1113 module.exports = function (opts) {
1214
1315 var codec = opts.codec
1416
@@ -27,10 +29,10 @@
2729 }
2830 }
2931
3032 var msg = {
31- author: opts.hash('TEST_AUTHOR'),
32- previous: opts.hash('TEST_PREVIOUS'),
33 + author: hash('TEST_AUTHOR'),
34 + previous: hash('TEST_PREVIOUS'),
3335 timestamp: Date.now(),
3436 sequence: 10,
3537 content: content
3638 }
@@ -65,9 +67,9 @@
6567 var db = sublevel(level('test-ssb-encoding', {
6668 valueEncoding: codec
6769 }))
6870 var ssb = require('../')(db, opts)
69- var feed = createFeed(ssb, opts.generate(), opts)
71 + var feed = createFeed(ssb, generate(), opts)
7072
7173 feed.add(content, function (err, msg) {
7274 if(err) throw err
7375 t.assert(!!msg)
@@ -89,4 +91,6 @@
8991
9092
9193 if(!module.parent)
9294 module.exports(require('../defaults'))
95 +
96 +

Built with git-ssb-web