git ssb

2+

mixmix / ticktack



Tree: a712df77a26a0ced340c16b0f754794049f19fe2

Files: a712df77a26a0ced340c16b0f754794049f19fe2 / backup / async / importIdentity.js

683 bytesRaw
1const nest = require('depnest')
2const { onceTrue } = require('mutant')
3const path = require('path')
4const fs = require('fs')
5const os = require('os')
6const config = require('../../config').create().config.sync.load()
7const peersFile = path.join(config.path, "gossip.json")
8const secretFile = path.join(config.path, "secret")
9
10// TODO: files should take into account env vars
11
12exports.gives = nest('backup.async.importIdentity')
13
14exports.create = function (api) {
15 return nest('backup.async.importIdentity', (importData, cb) => {
16
17 fs.writeFileSync(peersFile, JSON.stringify(importData.peers), "utf8")
18 fs.writeFileSync(secretFile, importData.secret, "utf8")
19
20 cb()
21
22 })
23}
24

Built with git-ssb-web