mirror of
https://github.com/node-ebics/node-ebics-client.git
synced 2025-08-14 03:35:36 +00:00
Add keys generation and code optimization
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const Key = require('./key');
|
||||
const Key = require('./keyRSA');
|
||||
|
||||
const keyOrNull = key => (key ? Key(key) : null);
|
||||
|
||||
@@ -25,15 +25,15 @@ module.exports = class Keys {
|
||||
const keys = {};
|
||||
|
||||
Object.keys({ A006: '', X002: '', E002: '' }).forEach((key) => {
|
||||
keys[key] = Key.generate();
|
||||
keys[key] = Key().generate();
|
||||
});
|
||||
|
||||
return new Keys(keys);
|
||||
}
|
||||
|
||||
setBankKeys(bankKeys) {
|
||||
this.keys.bankX002.importKey(bankKeys.bankX002);
|
||||
this.keys.bankE002.importKey(bankKeys.bankE002);
|
||||
this.keys.bankX002 = Key().importKey(bankKeys.bankX002);
|
||||
this.keys.bankE002 = Key().importKey(bankKeys.bankE002);
|
||||
}
|
||||
|
||||
a() {
|
||||
|
@@ -17,7 +17,10 @@ module.exports = encodedKey => ({
|
||||
},
|
||||
|
||||
importKey({ mod, exp }) {
|
||||
this.key = new NodeRSA();
|
||||
this.key.importKey({ n: mod, e: exp }, 'components-public');
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
n(to = 'buff') {
|
Reference in New Issue
Block a user