Refactor src/encoding/*.js and src/hkp/*.js to use import
This commit is contained in:
parent
509d6c67ee
commit
8559cd2bff
|
@ -24,9 +24,9 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var base64 = require('./base64.js'),
|
import base64 from './base64.js';
|
||||||
enums = require('../enums.js'),
|
import enums from '../enums.js';
|
||||||
config = require('../config');
|
import config from '../config';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds out which Ascii Armoring type is used. Throws error if unknown type.
|
* Finds out which Ascii Armoring type is used. Throws error if unknown type.
|
||||||
|
|
|
@ -22,9 +22,8 @@
|
||||||
* in order to lookup and upload keys on standard public key servers.
|
* in order to lookup and upload keys on standard public key servers.
|
||||||
* @module hkp/hkp
|
* @module hkp/hkp
|
||||||
*/
|
*/
|
||||||
module.exports = HKP;
|
|
||||||
|
|
||||||
var config = require('../config');
|
import config from '../config';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the HKP client and configure it with the key server url and fetch function.
|
* Initialize the HKP client and configure it with the key server url and fetch function.
|
||||||
|
@ -32,7 +31,7 @@ var config = require('../config');
|
||||||
* @param {String} keyServerBaseUrl (optional) The HKP key server base url including
|
* @param {String} keyServerBaseUrl (optional) The HKP key server base url including
|
||||||
* the protocol to use e.g. https://pgp.mit.edu
|
* the protocol to use e.g. https://pgp.mit.edu
|
||||||
*/
|
*/
|
||||||
function HKP(keyServerBaseUrl) {
|
export default function HKP(keyServerBaseUrl) {
|
||||||
this._baseUrl = keyServerBaseUrl ? keyServerBaseUrl : config.keyserver;
|
this._baseUrl = keyServerBaseUrl ? keyServerBaseUrl : config.keyserver;
|
||||||
this._fetch = typeof window !== 'undefined' ? window.fetch : require('node-fetch');
|
this._fetch = typeof window !== 'undefined' ? window.fetch : require('node-fetch');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user