mirror of
https://github.com/node-ebics/node-ebics-client.git
synced 2025-12-17 00:52:46 +00:00
feat: use new Key in Keys manager
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
const Key = require('./keyRSA');
|
||||
// const Key = require('./keyRSA');
|
||||
const Key = require('./Key');
|
||||
|
||||
const keyOrNull = key => (key ? Key(key) : null);
|
||||
const keyOrNull = (key) => {
|
||||
if (key instanceof Key)
|
||||
return key;
|
||||
|
||||
return key ? new Key({ pem: key }) : null;
|
||||
};
|
||||
|
||||
module.exports = class Keys {
|
||||
constructor({
|
||||
@@ -25,15 +31,15 @@ module.exports = class Keys {
|
||||
const keys = {};
|
||||
|
||||
Object.keys({ A006: '', X002: '', E002: '' }).forEach((key) => {
|
||||
keys[key] = Key().generate();
|
||||
keys[key] = Key.generate(); // Key().generate();
|
||||
});
|
||||
|
||||
return new Keys(keys);
|
||||
}
|
||||
|
||||
setBankKeys(bankKeys) {
|
||||
this.keys.bankX002 = Key().importKey(bankKeys.bankX002);
|
||||
this.keys.bankE002 = Key().importKey(bankKeys.bankE002);
|
||||
this.keys.bankX002 = new Key(bankKeys.bankX002); // Key().importKey(bankKeys.bankX002);
|
||||
this.keys.bankE002 = new Key(bankKeys.bankE002); // Key().importKey(bankKeys.bankE002);
|
||||
}
|
||||
|
||||
a() {
|
||||
|
||||
Reference in New Issue
Block a user