|
@@ -21,55 +21,55 @@ describe('load', (context) => {
|
21
|
21
|
})
|
22
|
22
|
})
|
23
|
23
|
|
24
|
|
-describe('parent_key', (context) => {
|
25
|
|
- context('constructor() - generates and saves new parent_key', (assert, next) => {
|
26
|
|
- var storage = tmp()
|
27
|
|
- var spy = sinon.spy(crypto)
|
28
|
|
- var saveStub = sinon.stub().returns(true)
|
|
24
|
+// describe('parent_key', (context) => {
|
|
25
|
+// context('constructor() - generates and saves new parent_key', (assert, next) => {
|
|
26
|
+// var storage = tmp()
|
|
27
|
+// var spy = sinon.spy(crypto)
|
|
28
|
+// var saveStub = sinon.stub().returns(true)
|
29
|
29
|
|
30
|
|
- var ProxyConfig = proxyquire('../', {
|
31
|
|
- 'cobox-crypto': spy,
|
32
|
|
- './lib/keys': { saveParentKey: saveStub }
|
33
|
|
- })
|
|
30
|
+// var ProxyConfig = proxyquire('../', {
|
|
31
|
+// 'cobox-crypto': spy,
|
|
32
|
+// './lib/keys': { saveParentKey: saveStub }
|
|
33
|
+// })
|
34
|
34
|
|
35
|
|
- var config = ProxyConfig(storage)
|
|
35
|
+// var config = ProxyConfig(storage)
|
36
|
36
|
|
37
|
|
- assert.ok(config, 'config created')
|
|
37
|
+// assert.ok(config, 'config created')
|
38
|
38
|
|
39
|
|
- config.deriveKeyPair(1, 'hello')
|
|
39
|
+// config.deriveKeyPair(1, 'hello')
|
40
|
40
|
|
41
|
|
- assert.ok(spy.masterKey.calledOnce, 'calls crypto.masterKey()')
|
42
|
|
- assert.ok(saveStub.calledOnce, 'saves parent key')
|
|
41
|
+// assert.ok(spy.masterKey.calledOnce, 'calls crypto.masterKey()')
|
|
42
|
+// assert.ok(saveStub.calledOnce, 'saves parent key')
|
43
|
43
|
|
44
|
|
- cleanup(storage, next)
|
45
|
|
- })
|
|
44
|
+// cleanup(storage, next)
|
|
45
|
+// })
|
46
|
46
|
|
47
|
|
- context('constructor() - loads parent_key from path', (assert, next) => {
|
48
|
|
- var storage = tmp()
|
49
|
|
- var address = crypto.address()
|
50
|
|
- var parentKey = crypto.masterKey()
|
|
47
|
+// context('constructor() - loads parent_key from path', (assert, next) => {
|
|
48
|
+// var storage = tmp()
|
|
49
|
+// var address = crypto.address()
|
|
50
|
+// var parentKey = crypto.masterKey()
|
51
|
51
|
|
52
|
|
- var keyPath = path.join(storage, 'parent_key')
|
53
|
|
- mkdirp.sync(path.dirname(keyPath))
|
54
|
|
- fs.writeFileSync(keyPath, parentKey, { mode: fs.constants.S_IRUSR })
|
|
52
|
+// var keyPath = path.join(storage, 'parent_key')
|
|
53
|
+// mkdirp.sync(path.dirname(keyPath))
|
|
54
|
+// fs.writeFileSync(keyPath, parentKey, { mode: fs.constants.S_IRUSR })
|
55
|
55
|
|
56
|
|
- var loadStub = sinon.stub().returns(parentKey)
|
57
|
|
- var saveStub = sinon.stub().returns(true)
|
|
56
|
+// var loadStub = sinon.stub().returns(parentKey)
|
|
57
|
+// var saveStub = sinon.stub().returns(true)
|
58
|
58
|
|
59
|
|
- var ProxyConfig = proxyquire('../', { './lib/keys': {
|
60
|
|
- loadParentKey: loadStub,
|
61
|
|
- saveParentKey: saveStub
|
62
|
|
- }
|
63
|
|
- })
|
|
59
|
+// var ProxyConfig = proxyquire('../', { './lib/keys': {
|
|
60
|
+// loadParentKey: loadStub,
|
|
61
|
+// saveParentKey: saveStub
|
|
62
|
+// }
|
|
63
|
+// })
|
64
|
64
|
|
65
|
|
- var config = ProxyConfig(storage, address)
|
66
|
|
- config.deriveKeyPair(1, 'hello')
|
|
65
|
+// var config = ProxyConfig(storage, address)
|
|
66
|
+// config.deriveKeyPair(1, 'hello')
|
67
|
67
|
|
68
|
|
- assert.ok(loadStub.calledWith(storage), 'key is loaded')
|
69
|
|
- assert.ok(saveStub.calledWith(storage, parentKey), 'key is saved')
|
70
|
|
- cleanup(storage, next)
|
71
|
|
- })
|
72
|
|
-})
|
|
68
|
+// assert.ok(loadStub.calledWith(storage), 'key is loaded')
|
|
69
|
+// assert.ok(saveStub.calledWith(storage, parentKey), 'key is saved')
|
|
70
|
+// cleanup(storage, next)
|
|
71
|
+// })
|
|
72
|
+// })
|
73
|
73
|
|
74
|
74
|
describe('options', (context) => {
|
75
|
75
|
context('reload', (assert, next) => {
|