Files: 7c9bf5c52715e63fa7ec858e0b747dbabe1c5a22 / 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