Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
feat: create the keychain on init #1135
Browse files Browse the repository at this point in the history
  • Loading branch information
richardschneider committed Dec 24, 2017
1 parent 211c73c commit 75b83c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/core/components/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ module.exports = function init (self) {
if (opts.pass) {
self.log('creating keychain')
const keychainOptions = Object.assign({passPhrase: opts.pass}, config.Keychain)
const keychain = new Keychain(self._repo.keys, keychainOptions)
keychain.importPeer('self', { privKey: privateKey }, cb)
self._keychain = new Keychain(self._repo.keys, keychainOptions)
self._keychain.importPeer('self', { privKey: privateKey }, cb)
} else {
cb(null, true)
}
Expand Down
4 changes: 3 additions & 1 deletion src/core/components/pre-start.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ module.exports = function preStart (self) {
(cb) => self._repo.config.get(cb),
(config, cb) => {
const pass = self._options.pass
if (pass) {
if (self._keychain) {
// most likely an init has happened
} else if (pass) {
const keychainOptions = Object.assign({passPhrase: pass}, config.Keychain)
self._keychain = new Keychain(self._repo.keys, keychainOptions)
self.log('keychain constructed')
Expand Down

0 comments on commit 75b83c8

Please sign in to comment.