Files: c18b233c6d62741496978cd8dc1f34a093946f8b / keys.js
454 bytesRaw
1 | const Path = require('path') |
2 | const Keys = require('ssb-keys') |
3 | const nest = require('depnest') |
4 | |
5 | exports.needs = nest('config.sync.load', 'first') |
6 | exports.gives = nest('keys.sync.load') |
7 | exports.create = (api) => { |
8 | return nest('keys.sync.load', () => { |
9 | var keys |
10 | if (!keys) { |
11 | const config = api.config.sync.load() |
12 | const keyPath = Path.join(config.path, 'secret') |
13 | keys = Keys.loadOrCreateSync(keyPath) |
14 | } |
15 | return keys |
16 | }) |
17 | } |
18 |
Built with git-ssb-web