Refactor src/keyring/*.js to use import & export
This commit is contained in:
parent
acabca9585
commit
444128829a
|
@ -4,5 +4,9 @@
|
|||
* @see module:keyring/keyring
|
||||
* @module keyring
|
||||
*/
|
||||
module.exports = require('./keyring.js');
|
||||
module.exports.localstore = require('./localstore.js');
|
||||
import Keyring from './keyring.js';
|
||||
|
||||
import localstore from './localstore.js';
|
||||
Keyring.localstore = localstore;
|
||||
|
||||
export default Keyring;
|
||||
|
|
|
@ -25,9 +25,8 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
var keyModule = require('../key.js');
|
||||
|
||||
module.exports = Keyring;
|
||||
import keyModule from '../key.js';
|
||||
import LocalStore from './localstore.js';
|
||||
|
||||
/**
|
||||
* Initialization routine for the keyring. This method reads the
|
||||
|
@ -35,8 +34,8 @@ module.exports = Keyring;
|
|||
* @constructor
|
||||
* @param {class} [storeHandler] class implementing load() and store() methods
|
||||
*/
|
||||
function Keyring(storeHandler) {
|
||||
this.storeHandler = storeHandler || new (require('./localstore.js'))();
|
||||
export default function Keyring(storeHandler) {
|
||||
this.storeHandler = storeHandler || new LocalStore();
|
||||
this.publicKeys = new KeyArray(this.storeHandler.loadPublic());
|
||||
this.privateKeys = new KeyArray(this.storeHandler.loadPrivate());
|
||||
}
|
||||
|
|
|
@ -24,13 +24,11 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
module.exports = LocalStore;
|
||||
import config from '../config';
|
||||
import keyModule from '../key.js';
|
||||
import util from '../util.js';
|
||||
|
||||
var config = require('../config'),
|
||||
keyModule = require('../key.js'),
|
||||
util = require('../util.js');
|
||||
|
||||
function LocalStore(prefix) {
|
||||
export default function LocalStore(prefix) {
|
||||
prefix = prefix || 'openpgp-';
|
||||
this.publicKeysItem = prefix + this.publicKeysItem;
|
||||
this.privateKeysItem = prefix + this.privateKeysItem;
|
||||
|
|
Loading…
Reference in New Issue
Block a user