mirror of
https://github.com/node-ebics/node-ebics-client.git
synced 2025-08-15 04:05:35 +00:00
Compare commits
39 Commits
chore/test
...
feat/drop-
Author | SHA1 | Date | |
---|---|---|---|
|
6d601f4186 | ||
|
2d05bf88f9 | ||
|
10e0d602bd | ||
|
eea0a49130 | ||
|
3e95478b3b | ||
|
4496cbf560 | ||
|
0efc46b014 | ||
|
eafe2f9f55 | ||
|
24afdeb257 | ||
|
34051f0a9f | ||
|
14779088f1 | ||
|
aad0bd97c8 | ||
|
429e807994 | ||
|
bb8d1cfaa0 | ||
|
cda36bfcb3 | ||
|
d21d89fb36 | ||
|
df9c330411 | ||
|
2a17ff6056 | ||
|
33ac6ac60f | ||
|
e9f7c11bbb | ||
|
9aabe933e9 | ||
|
dc5f52198b | ||
|
bb5e551057 | ||
|
0a3a4631df | ||
|
3ffa323264 | ||
|
e56dc082d0 | ||
|
0c01420c1e | ||
|
0964992164 | ||
|
5c419630c1 | ||
|
594f2a2623 | ||
|
104ec67f8c | ||
|
e8a80932e1 | ||
|
ce6cd02e58 | ||
|
836ec0ebf3 | ||
|
59a281c895 | ||
|
61ada747f3 | ||
|
f15e09840a | ||
|
4149c01695 | ||
|
1c1f112ff5 |
27
.gitignore
vendored
27
.gitignore
vendored
@@ -1,14 +1,19 @@
|
|||||||
npm-debug.log
|
# mac shit
|
||||||
node_modules
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.local.json5
|
|
||||||
yarn.lock
|
# nyc test coverage
|
||||||
/project.sublime-workspace
|
.nyc_output
|
||||||
/public/css/style.css.map
|
|
||||||
/.idea
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
npm-debug.log
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# vscode
|
||||||
/.vscode
|
/.vscode
|
||||||
*.pid
|
*.pid
|
||||||
/coverage
|
|
||||||
package-lock.json
|
|
||||||
*.key
|
|
||||||
*.html
|
|
||||||
|
7
.travis.yml
Normal file
7
.travis.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- "8"
|
||||||
|
- "9"
|
||||||
|
- "10"
|
||||||
|
- "11"
|
||||||
|
- "12"
|
14
README.md
14
README.md
@@ -1,5 +1,14 @@
|
|||||||
# node-ebics-client
|
# node-ebics-client
|
||||||
---
|
<p align="center">
|
||||||
|
<a href="https://travis-ci.org/eCollect/node-ebics-client" title="Build Status"><img src="https://travis-ci.org/eCollect/node-ebics-client.svg?branch=master" alt="Build Status" /></a>
|
||||||
|
<a href="https://www.npmjs.com/package/ebics-client" title="Build Status">
|
||||||
|
<img alt="ebics-client" src="https://img.shields.io/npm/v/ebics-client">
|
||||||
|
</a>
|
||||||
|
<a href="https://snyk.io/test/github/ecollect/node-ebics-client" title="Known Vulnerabilities">
|
||||||
|
<img src="https://snyk.io/test/github/ecollect/node-ebics-client/badge.svg" alt="Known Vulnerabilities">
|
||||||
|
</a>
|
||||||
|
<a href="/eCollect/node-ebics-client/blob/master/LICENSE" title="GPL-3.0"><img alt="GPL-3.0" src="https://img.shields.io/github/license/eCollect/node-ebics-client"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
Pure node.js ( >=8 ) implementation of [EBICS](https://en.wikipedia.org/wiki/Electronic_Banking_Internet_Communication_Standard) ( Electronic Banking Internet Communication ).
|
Pure node.js ( >=8 ) implementation of [EBICS](https://en.wikipedia.org/wiki/Electronic_Banking_Internet_Communication_Standard) ( Electronic Banking Internet Communication ).
|
||||||
|
|
||||||
@@ -12,6 +21,7 @@ The client is currently tested and verified to work with the following banks:
|
|||||||
* [Credit Suisse (Schweiz) AG](https://www.credit-suisse.com/ch/en.html)
|
* [Credit Suisse (Schweiz) AG](https://www.credit-suisse.com/ch/en.html)
|
||||||
* [Zürcher Kantonalbank](https://www.zkb.ch/en/lg/ew.html)
|
* [Zürcher Kantonalbank](https://www.zkb.ch/en/lg/ew.html)
|
||||||
* [Raiffeisen Schweiz](https://www.raiffeisen.ch/rch/de.html)
|
* [Raiffeisen Schweiz](https://www.raiffeisen.ch/rch/de.html)
|
||||||
|
* [BW Bank](https://www.bw-bank.de/de/home.html)
|
||||||
|
|
||||||
|
|
||||||
## Inspiration
|
## Inspiration
|
||||||
@@ -22,3 +32,5 @@ The basic concept of this library was inspired by the [EPICS](https://github.com
|
|||||||
## Copyright
|
## Copyright
|
||||||
|
|
||||||
Copyright: eCollect AG, 2018-9.
|
Copyright: eCollect AG, 2018-9.
|
||||||
|
Licensed under the [GPLv3](LICENSE) license.
|
||||||
|
|
||||||
|
@@ -2,21 +2,18 @@
|
|||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
const moment = require('moment');
|
|
||||||
const handlebars = require('handlebars');
|
const handlebars = require('handlebars');
|
||||||
const Crypto = require('./crypto/Crypto');
|
const Crypto = require('./crypto/Crypto');
|
||||||
// const BN = require('bn.js');
|
const { date } = require('./utils.js');
|
||||||
|
|
||||||
const registerHelpers = () => {
|
const registerHelpers = () => {
|
||||||
handlebars.registerHelper('today', () => moment().format('DD.MM.YYYY'));
|
handlebars.registerHelper('today', () => date.toISODate(Date.now(), false));
|
||||||
|
|
||||||
handlebars.registerHelper('now', () => moment().format('HH:mm:ss'));
|
handlebars.registerHelper('now', () => date.toISOTime(Date.now(), false));
|
||||||
|
|
||||||
handlebars.registerHelper('keyExponentBits', k => Buffer.byteLength(k.e()) * 8);
|
handlebars.registerHelper('keyExponentBits', k => Buffer.byteLength(k.e()) * 8);
|
||||||
// handlebars.registerHelper('keyExponentBits', k => Buffer.byteLength(new BN(k.key.keyPair.e).toBuffer()) * 8);
|
|
||||||
|
|
||||||
handlebars.registerHelper('keyModulusBits', k => k.key.getKeySize());
|
handlebars.registerHelper('keyModulusBits', k => k.size());
|
||||||
// return Buffer.byteLength(new BN(k.key.keyPair.e).toBuffer()) * 8;
|
|
||||||
|
|
||||||
handlebars.registerHelper('keyExponent', k => k.e('hex'));
|
handlebars.registerHelper('keyExponent', k => k.e('hex'));
|
||||||
|
|
||||||
@@ -24,8 +21,6 @@ const registerHelpers = () => {
|
|||||||
|
|
||||||
handlebars.registerHelper('sha256', (k) => {
|
handlebars.registerHelper('sha256', (k) => {
|
||||||
const digest = Buffer.from(Crypto.digestPublicKey(k), 'base64').toString('HEX');
|
const digest = Buffer.from(Crypto.digestPublicKey(k), 'base64').toString('HEX');
|
||||||
// const digest = Buffer.from(k.publicDigest(), 'base64').toString('HEX');
|
|
||||||
|
|
||||||
return digest.toUpperCase().match(/.{1,2}/g).join(' ');
|
return digest.toUpperCase().match(/.{1,2}/g).join(' ');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const packageJson = require('../package.json');
|
const { version } = require('../package.json');
|
||||||
|
|
||||||
const name = 'Node Ebics Client';
|
const name = 'Node Ebics Client';
|
||||||
const { version } = packageJson;
|
|
||||||
const orderOperations = {
|
const orderOperations = {
|
||||||
ini: 'INI',
|
ini: 'INI',
|
||||||
upload: 'UPLOAD',
|
upload: 'UPLOAD',
|
||||||
|
66
lib/crypto/BigNumber.js
Normal file
66
lib/crypto/BigNumber.js
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { jsbn: { BigInteger } } = require('node-forge');
|
||||||
|
|
||||||
|
class BigNumber {
|
||||||
|
constructor(value, radix = 10) {
|
||||||
|
if (value === null || value === undefined)
|
||||||
|
throw new Error('value is missing.');
|
||||||
|
|
||||||
|
this._n = new BigInteger(null);
|
||||||
|
|
||||||
|
if (value instanceof BigNumber)
|
||||||
|
this._n = value._n;
|
||||||
|
else if (value instanceof BigInteger)
|
||||||
|
this._n = value;
|
||||||
|
else if (typeof value === 'number')
|
||||||
|
this._n.fromInt(value);
|
||||||
|
else if (typeof value === 'string')
|
||||||
|
this._n.fromString(value, radix);
|
||||||
|
else if (Buffer.isBuffer(value))
|
||||||
|
this._n.fromString(value.toString('hex'), 16);
|
||||||
|
else if (Array.isArray(value))
|
||||||
|
this._n.fromString(Buffer.from(value).toString('hex'), 16);
|
||||||
|
else
|
||||||
|
throw new TypeError('Unsupported value type.');
|
||||||
|
}
|
||||||
|
|
||||||
|
toBEBuffer(length) {
|
||||||
|
const arr = this._n.toByteArray();
|
||||||
|
if (length === undefined)
|
||||||
|
return Buffer.from(arr);
|
||||||
|
|
||||||
|
if (arr.length > length)
|
||||||
|
throw new Error('Number out of range.');
|
||||||
|
|
||||||
|
while (arr.length < length)
|
||||||
|
arr.unshift(0);
|
||||||
|
|
||||||
|
return Buffer.from(arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
toString(radix = 10) {
|
||||||
|
const result = this._n.toString(radix);
|
||||||
|
if (radix === 16)
|
||||||
|
return result.padStart(2, '0');
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
and(num) {
|
||||||
|
return new BigNumber(this._n.and(new BigNumber(num)._n));
|
||||||
|
}
|
||||||
|
|
||||||
|
mul(num) {
|
||||||
|
return new BigNumber(this._n.multiply(new BigNumber(num)._n));
|
||||||
|
}
|
||||||
|
|
||||||
|
mod(num) {
|
||||||
|
return new BigNumber(this._n.mod(new BigNumber(num)._n));
|
||||||
|
}
|
||||||
|
|
||||||
|
shrn(num) {
|
||||||
|
return new BigNumber(this._n.shiftRight(new BigNumber(num)._n));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = BigNumber;
|
@@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
|
|
||||||
const BN = require('bn.js');
|
const BigNumber = require('./BigNumber.js');
|
||||||
|
|
||||||
const mgf1 = require('./MGF1');
|
const mgf1 = require('./MGF1');
|
||||||
|
|
||||||
const modPow = (base, power, mod) => {
|
const modPow = (base, power, mod) => {
|
||||||
let result = new BN(1);
|
let result = new BigNumber(1);
|
||||||
|
|
||||||
while (power > 0) {
|
while (power > 0) {
|
||||||
result = power.and(new BN(1)) == 1 ? (result.mul(base)).mod(mod) : result; // eslint-disable-line
|
result = power.and(new BigNumber(1)) == 1 ? (result.mul(base)).mod(mod) : result; // eslint-disable-line
|
||||||
base = (base.mul(base)).mod(mod);
|
base = (base.mul(base)).mod(mod);
|
||||||
power = power.shrn(1);
|
power = power.shrn(1);
|
||||||
}
|
}
|
||||||
@@ -28,10 +27,13 @@ const emsaPSS = (msg, salt) => {
|
|||||||
const dbMask = mgf1.generate(mTickHash, db.length);
|
const dbMask = mgf1.generate(mTickHash, db.length);
|
||||||
const maskedDb = mgf1.xor(db, dbMask);
|
const maskedDb = mgf1.xor(db, dbMask);
|
||||||
|
|
||||||
let maskedDbMsb = mgf1.rjust(new BN(maskedDb.slice(0, 1), 2).toString(2), 8, '0');
|
let maskedDbMsb = mgf1.rjust(new BigNumber(maskedDb.slice(0, 1)).toString(2), 8, '0');
|
||||||
|
|
||||||
|
|
||||||
maskedDbMsb = `0${maskedDbMsb.substr(1)}`;
|
maskedDbMsb = `0${maskedDbMsb.substr(1)}`;
|
||||||
maskedDb[0] = (new BN(maskedDbMsb, 2).toBuffer())[0]; // eslint-disable-line
|
// console.log((new BN(maskedDbMsb, 2).toBuffer())[0], new BigNumber(maskedDbMsb, 2).toBuffer()[0]);
|
||||||
|
// maskedDb[0] = (new BN(maskedDbMsb, 2).toBuffer())[0]; // eslint-disable-line
|
||||||
|
maskedDb[0] = new BigNumber(maskedDbMsb, 2).toBEBuffer()[0]; // eslint-disable-line
|
||||||
|
|
||||||
return Buffer.concat([maskedDb, mTickHash, Buffer.from('BC', 'hex')]);
|
return Buffer.concat([maskedDb, mTickHash, Buffer.from('BC', 'hex')]);
|
||||||
};
|
};
|
||||||
@@ -65,11 +67,12 @@ module.exports = class Crypto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static sign(key, msg, salt = crypto.randomBytes(32)) {
|
static sign(key, msg, salt = crypto.randomBytes(32)) {
|
||||||
const base = new BN(emsaPSS(msg, salt));
|
// console.log(key.d());
|
||||||
const power = new BN(key.d());
|
const base = new BigNumber(emsaPSS(msg, salt));
|
||||||
const mod = new BN(key.n());
|
const power = new BigNumber(key.d());
|
||||||
|
const mod = new BigNumber(key.n());
|
||||||
|
|
||||||
return (modPow(base, power, mod)).toBuffer().toString('base64');
|
return (modPow(base, power, mod)).toBEBuffer().toString('base64');
|
||||||
}
|
}
|
||||||
|
|
||||||
static pad(d) {
|
static pad(d) {
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const BN = require('bn.js');
|
|
||||||
|
const BigNumber = require('./BigNumber.js');
|
||||||
|
|
||||||
const MFG_LEN = 32;
|
const MFG_LEN = 32;
|
||||||
|
|
||||||
const divceil = (a, b) => ~~(((a + b) - 1) / b); // eslint-disable-line no-bitwise
|
const divceil = (a, b) => ~~(((a + b) - 1) / b); // eslint-disable-line no-bitwise
|
||||||
const rjust = (string, width, padding) => {
|
const rjust = (string, width, padding = ' ') => {
|
||||||
padding = padding || ' ';
|
|
||||||
padding = padding.substr(0, 1);
|
padding = padding.substr(0, 1);
|
||||||
if (string.length < width)
|
if (string.length < width)
|
||||||
return padding.repeat(width - string.length) + string;
|
return padding.repeat(width - string.length) + string;
|
||||||
@@ -26,7 +26,7 @@ const i2osp = (x, len) => {
|
|||||||
if (x >= 256 ** len)
|
if (x >= 256 ** len)
|
||||||
throw new Error('Integer too large');
|
throw new Error('Integer too large');
|
||||||
|
|
||||||
return Buffer.from(rjust((Buffer.from((new BN(x)).toArray('be', 4)).toString()).replace(/\x00/gi, ''), len, '\x00')); // eslint-disable-line no-control-regex
|
return Buffer.from(rjust(new BigNumber(x).toBEBuffer(4).toString().replace(/\x00/gi, ''), len, '\x00')); // eslint-disable-line no-control-regex
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
138
lib/keymanagers/Key.js
Normal file
138
lib/keymanagers/Key.js
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const {
|
||||||
|
pki: {
|
||||||
|
rsa,
|
||||||
|
publicKeyToPem,
|
||||||
|
privateKeyToPem,
|
||||||
|
publicKeyFromPem,
|
||||||
|
privateKeyFromPem,
|
||||||
|
},
|
||||||
|
jsbn: {
|
||||||
|
BigInteger,
|
||||||
|
},
|
||||||
|
} = require('node-forge');
|
||||||
|
|
||||||
|
const getKeyType = (str) => {
|
||||||
|
const matches = str.match(/(PRIVATE|PUBLIC) KEY/);
|
||||||
|
if (!matches)
|
||||||
|
return null;
|
||||||
|
return matches[1].toLowerCase();
|
||||||
|
};
|
||||||
|
|
||||||
|
const keyFromPem = (pem) => {
|
||||||
|
const type = getKeyType(pem);
|
||||||
|
const isPublic = type === 'public';
|
||||||
|
const key = isPublic ? publicKeyFromPem(pem) : privateKeyFromPem(pem);
|
||||||
|
|
||||||
|
return {
|
||||||
|
isPublic,
|
||||||
|
key,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a public key from modulus and exponent
|
||||||
|
* @param {Buffer} mod - the modulus
|
||||||
|
* @param {Buffer} exp - the exponent
|
||||||
|
*/
|
||||||
|
const keyFromModAndExp = (mod, exp) => {
|
||||||
|
const bnMod = new BigInteger(mod.toString('hex'), 16);
|
||||||
|
const bnExp = new BigInteger(exp.toString('hex'), 16);
|
||||||
|
|
||||||
|
return {
|
||||||
|
key: rsa.setPublicKey(bnMod, bnExp),
|
||||||
|
isPublic: true,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = class Key {
|
||||||
|
constructor({
|
||||||
|
pem = null, mod = null, exp = null, size = 2048,
|
||||||
|
} = {}) {
|
||||||
|
// generate new private key
|
||||||
|
if (!pem && !mod && !exp) {
|
||||||
|
const keyPair = rsa.generateKeyPair(size);
|
||||||
|
|
||||||
|
this.keyIsPublic = false;
|
||||||
|
this.privateKey = keyPair.privateKey;
|
||||||
|
this.publicKey = keyPair.publicKey;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// new key from pem string
|
||||||
|
if (pem) {
|
||||||
|
const { key, isPublic } = keyFromPem(pem);
|
||||||
|
|
||||||
|
this.keyIsPublic = isPublic;
|
||||||
|
this.privateKey = isPublic ? null : key;
|
||||||
|
this.publicKey = isPublic ? key : null;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// new key from mod and exp
|
||||||
|
if (mod && exp) {
|
||||||
|
const { key, isPublic } = keyFromModAndExp(mod, exp);
|
||||||
|
|
||||||
|
this.keyIsPublic = isPublic;
|
||||||
|
this.privateKey = isPublic ? null : key;
|
||||||
|
this.publicKey = isPublic ? key : null;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// not good
|
||||||
|
throw new Error(`Can not create key without ${!mod ? 'modulus' : 'exponent'}.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
static generate(size = 2048) {
|
||||||
|
return new Key({ size });
|
||||||
|
}
|
||||||
|
|
||||||
|
static importKey({ mod, exp }) {
|
||||||
|
return new Key({ mod, exp });
|
||||||
|
}
|
||||||
|
|
||||||
|
n(to = 'buff') {
|
||||||
|
const key = this.keyIsPublic ? this.publicKey : this.privateKey;
|
||||||
|
const keyN = Buffer.from(key.n.toByteArray());
|
||||||
|
|
||||||
|
return to === 'hex' ? keyN.toString('hex', 1) : keyN;
|
||||||
|
}
|
||||||
|
|
||||||
|
e(to = 'buff') {
|
||||||
|
const key = this.keyIsPublic ? this.publicKey : this.privateKey;
|
||||||
|
const eKey = Buffer.from(key.e.toByteArray());
|
||||||
|
|
||||||
|
return to === 'hex' ? eKey.toString('hex') : eKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
d() {
|
||||||
|
if (this.keyIsPublic)
|
||||||
|
throw new Error('Can not get d component out of public key.');
|
||||||
|
|
||||||
|
return Buffer.from(this.privateKey.d.toByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
isPrivate() {
|
||||||
|
return !this.keyIsPublic;
|
||||||
|
}
|
||||||
|
|
||||||
|
isPublic() {
|
||||||
|
return this.keyIsPublic;
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line class-methods-use-this
|
||||||
|
size() {
|
||||||
|
const keyN = this.n('hex');
|
||||||
|
const bn = new BigInteger(keyN, 16);
|
||||||
|
|
||||||
|
return bn.bitLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
toPem() {
|
||||||
|
return this.keyIsPublic ? publicKeyToPem(this.publicKey) : privateKeyToPem(this.privateKey);
|
||||||
|
}
|
||||||
|
};
|
@@ -1,8 +1,13 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
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 {
|
module.exports = class Keys {
|
||||||
constructor({
|
constructor({
|
||||||
@@ -25,15 +30,15 @@ module.exports = class Keys {
|
|||||||
const keys = {};
|
const keys = {};
|
||||||
|
|
||||||
Object.keys({ A006: '', X002: '', E002: '' }).forEach((key) => {
|
Object.keys({ A006: '', X002: '', E002: '' }).forEach((key) => {
|
||||||
keys[key] = Key().generate();
|
keys[key] = Key.generate(); // Key().generate();
|
||||||
});
|
});
|
||||||
|
|
||||||
return new Keys(keys);
|
return new Keys(keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
setBankKeys(bankKeys) {
|
setBankKeys(bankKeys) {
|
||||||
this.keys.bankX002 = Key().importKey(bankKeys.bankX002);
|
this.keys.bankX002 = new Key(bankKeys.bankX002); // Key().importKey(bankKeys.bankX002);
|
||||||
this.keys.bankE002 = Key().importKey(bankKeys.bankE002);
|
this.keys.bankE002 = new Key(bankKeys.bankE002); // Key().importKey(bankKeys.bankE002);
|
||||||
}
|
}
|
||||||
|
|
||||||
a() {
|
a() {
|
||||||
|
@@ -1,49 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const BN = require('bn.js');
|
|
||||||
const NodeRSA = require('node-rsa');
|
|
||||||
|
|
||||||
const keyOrNull = (encodedKey) => {
|
|
||||||
if (encodedKey === null) return new NodeRSA();
|
|
||||||
|
|
||||||
return (encodedKey instanceof NodeRSA) ? encodedKey : new NodeRSA(encodedKey);
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = encodedKey => ({
|
|
||||||
key: keyOrNull(encodedKey),
|
|
||||||
|
|
||||||
generate(keySize = 2048) {
|
|
||||||
return new NodeRSA({ b: keySize });
|
|
||||||
},
|
|
||||||
|
|
||||||
importKey({ mod, exp }) {
|
|
||||||
this.key = new NodeRSA();
|
|
||||||
this.key.importKey({ n: mod, e: exp }, 'components-public');
|
|
||||||
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
n(to = 'buff') {
|
|
||||||
const keyN = Buffer.from(this.key.exportKey('components-public').n);
|
|
||||||
|
|
||||||
return to === 'hex'
|
|
||||||
? keyN.toString('hex', 1)
|
|
||||||
: keyN;
|
|
||||||
},
|
|
||||||
|
|
||||||
e(to = 'buff') {
|
|
||||||
const eKey = new BN(this.key.exportKey('components-public').e).toBuffer();
|
|
||||||
|
|
||||||
return to === 'hex'
|
|
||||||
? eKey.toString('hex')
|
|
||||||
: eKey;
|
|
||||||
},
|
|
||||||
|
|
||||||
d() {
|
|
||||||
return this.key.keyPair.d.toBuffer();
|
|
||||||
},
|
|
||||||
|
|
||||||
toPem() {
|
|
||||||
return this.key.isPrivate() ? this.key.exportKey('pkcs1-private-pem') : this.key.exportKey('pkcs8-public-pem');
|
|
||||||
},
|
|
||||||
});
|
|
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
const zlib = require('zlib');
|
const zlib = require('zlib');
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const BN = require('bn.js');
|
|
||||||
|
|
||||||
const Crypto = require('../../crypto/Crypto');
|
const Crypto = require('../../crypto/Crypto');
|
||||||
|
|
||||||
@@ -127,10 +126,12 @@ module.exports = (xml, keys) => ({
|
|||||||
const modulus = xpath.select(".//*[local-name(.)='Modulus']", keyNodes[i])[0].textContent;
|
const modulus = xpath.select(".//*[local-name(.)='Modulus']", keyNodes[i])[0].textContent;
|
||||||
const exponent = xpath.select(".//*[local-name(.)='Exponent']", keyNodes[i])[0].textContent;
|
const exponent = xpath.select(".//*[local-name(.)='Exponent']", keyNodes[i])[0].textContent;
|
||||||
|
|
||||||
const mod = new BN(Buffer.from(modulus, 'base64'), 2).toBuffer();
|
const mod = Buffer.from(modulus, 'base64');
|
||||||
const exp = new BN(Buffer.from(exponent, 'base64')).toNumber();
|
const exp = Buffer.from(exponent, 'base64');
|
||||||
|
bankKeys[`bank${type}`] = {
|
||||||
bankKeys[`bank${type}`] = { mod, exp };
|
mod,
|
||||||
|
exp,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return bankKeys;
|
return bankKeys;
|
||||||
|
34
lib/utils.js
34
lib/utils.js
@@ -1,18 +1,46 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const prefixNumber = (n) => {
|
||||||
|
if (n < 10)
|
||||||
|
return `0${n}`;
|
||||||
|
return n.toString();
|
||||||
|
};
|
||||||
|
|
||||||
|
const date = {
|
||||||
|
getDateObject(d = Date.now()) {
|
||||||
|
const dateObject = new Date(d);
|
||||||
|
// eslint-disable-next-line no-restricted-globals
|
||||||
|
if (isNaN(dateObject))
|
||||||
|
throw new Error(`${d} is invalid date.`);
|
||||||
|
return dateObject;
|
||||||
|
},
|
||||||
|
toISODate(d = Date.now(), utc = true) {
|
||||||
|
const t = date.getDateObject(d);
|
||||||
|
if (utc)
|
||||||
|
return `${t.getUTCFullYear()}-${prefixNumber(t.getUTCMonth() + 1)}-${prefixNumber(t.getUTCDate())}`;
|
||||||
|
return `${t.getFullYear()}-${prefixNumber(t.getMonth() + 1)}-${prefixNumber(t.getDate())}`;
|
||||||
|
},
|
||||||
|
toISOTime(d = Date.now(), utc = true) {
|
||||||
|
const t = date.getDateObject(d);
|
||||||
|
if (utc)
|
||||||
|
return `${prefixNumber(t.getUTCHours())}:${prefixNumber(t.getUTCMinutes())}:${prefixNumber(t.getUTCSeconds())}`;
|
||||||
|
return `${prefixNumber(t.getHours())}:${prefixNumber(t.getMinutes())}:${prefixNumber(t.getSeconds())}`;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const dateRange = (start, end) => {
|
const dateRange = (start, end) => {
|
||||||
if (start && end)
|
if (start && end)
|
||||||
return {
|
return {
|
||||||
DateRange: {
|
DateRange: {
|
||||||
Start: start,
|
Start: date.toISODate(start),
|
||||||
End: end,
|
End: date.toISODate(end),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
dateRange,
|
dateRange,
|
||||||
|
date,
|
||||||
};
|
};
|
||||||
|
3761
package-lock.json
generated
Normal file
3761
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
23
package.json
23
package.json
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "ebics-client",
|
"name": "ebics-client",
|
||||||
"version": "0.0.8",
|
"version": "0.1.1",
|
||||||
"description": "Node.js ISO 20022 Compliant EBICS Client",
|
"description": "Node.js ISO 20022 Compliant EBICS Client",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"test": "mocha test/*/**.js"
|
"test": "nyc mocha test/**/*.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -19,6 +19,16 @@
|
|||||||
],
|
],
|
||||||
"author": "eCollect Sofia Tech Team",
|
"author": "eCollect Sofia Tech Team",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Dimitar Nanov",
|
||||||
|
"url": "https://nanov.io",
|
||||||
|
"email": "dimitar@nanov.io"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Vladislav Hristov",
|
||||||
|
"url": "https://github.com/vladhristov",
|
||||||
|
"email": "vlad.s.ch@gmail.com"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Vasyl Stashuk",
|
"name": "Vasyl Stashuk",
|
||||||
"url": "https://github.com/vasyas"
|
"url": "https://github.com/vasyas"
|
||||||
@@ -28,13 +38,11 @@
|
|||||||
"url": "https://github.com/yagop"
|
"url": "https://github.com/yagop"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "GPL-3.0-only",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bn.js": "^5.0.0",
|
|
||||||
"handlebars": "^4.4.3",
|
"handlebars": "^4.4.3",
|
||||||
"js2xmlparser": "^4.0.0",
|
"js2xmlparser": "^4.0.0",
|
||||||
"moment": "^2.24.0",
|
"node-forge": "^0.9.1",
|
||||||
"node-rsa": "^1.0.6",
|
|
||||||
"request": "^2.88.0",
|
"request": "^2.88.0",
|
||||||
"uuid": "^3.3.3",
|
"uuid": "^3.3.3",
|
||||||
"xml-crypto": "^1.4.0",
|
"xml-crypto": "^1.4.0",
|
||||||
@@ -47,6 +55,7 @@
|
|||||||
"eslint-config-ecollect-base": "^0.1.2",
|
"eslint-config-ecollect-base": "^0.1.2",
|
||||||
"eslint-plugin-import": "^2.18.2",
|
"eslint-plugin-import": "^2.18.2",
|
||||||
"libxmljs": "^0.19.7",
|
"libxmljs": "^0.19.7",
|
||||||
"mocha": "^6.2.2"
|
"mocha": "^6.2.2",
|
||||||
|
"nyc": "^14.1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
43
test/fixtures/keys.js
vendored
Normal file
43
test/fixtures/keys.js
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const publicSmallExpPEM = '';
|
||||||
|
const publicSmallExpMod = '';
|
||||||
|
const publicSmallExpExp = '';
|
||||||
|
|
||||||
|
const publicBigPEM = `-----BEGIN PUBLIC KEY-----
|
||||||
|
MIIBJDANBgkqhkiG9w0BAQEFAAOCAREAMIIBDAKCAQEAuvqhJ2ptulHGUmYq3BOO
|
||||||
|
NoIDXOUDrVV3s188wvU3Fj9TcO3yBqWuJ5GMEzRIOfi8Pb4AkJBjjPOR0Taby7+n
|
||||||
|
7coa2Zm0ZprGzXVM1Gb0aG3BAbDaFbvdF25NLAtkmtKKW/8YfXy89qvy6+UEBdOa
|
||||||
|
1UTLaR+9Pf63Wa+qu638udSDe3refHdZV1bKUR1UOZ/1iWn5b7aq4vITRPNNWXk5
|
||||||
|
eG8He2lWzYHg5+yY4ckBooh1K5cMwl5s+Iz24iWtqIlV5EyORbdfGatrNzv6S7Lx
|
||||||
|
FngEGCL5e97qU1pAcarE9XmrlJ5dHl9LQPaw957AlZuOFpVEE5shXZkSgRYrHv2m
|
||||||
|
cQIFAQAAAA8=
|
||||||
|
-----END PUBLIC KEY-----`;
|
||||||
|
const publicBigModString = 'ALr6oSdqbbpRxlJmKtwTjjaCA1zlA61Vd7NfPML1NxY/U3Dt8galrieRjBM0SDn4vD2+AJCQY4zzkdE2m8u/p+3KGtmZtGaaxs11TNRm9GhtwQGw2hW73RduTSwLZJrSilv/GH18vPar8uvlBAXTmtVEy2kfvT3+t1mvqrut/LnUg3t63nx3WVdWylEdVDmf9Ylp+W+2quLyE0TzTVl5OXhvB3tpVs2B4OfsmOHJAaKIdSuXDMJebPiM9uIlraiJVeRMjkW3Xxmrazc7+kuy8RZ4BBgi+Xve6lNaQHGqxPV5q5SeXR5fS0D2sPeewJWbjhaVRBObIV2ZEoEWKx79pnE=';
|
||||||
|
const publicBigModBytes = [0, 186, 250, 161, 39, 106, 109, 186, 81, 198, 82, 102, 42, 220, 19, 142, 54, 130, 3, 92, 229, 3, 173, 85, 119, 179, 95, 60, 194, 245, 55, 22, 63, 83, 112, 237, 242, 6, 165, 174, 39, 145, 140, 19, 52, 72, 57, 248, 188, 61, 190, 0, 144, 144, 99, 140, 243, 145, 209, 54, 155, 203, 191, 167, 237, 202, 26, 217, 153, 180, 102, 154, 198, 205, 117, 76, 212, 102, 244, 104, 109, 193, 1, 176, 218, 21, 187, 221, 23, 110, 77, 44, 11, 100, 154, 210, 138, 91, 255, 24, 125, 124, 188, 246, 171, 242, 235, 229, 4, 5, 211, 154, 213, 68, 203, 105, 31, 189, 61, 254, 183, 89, 175, 170, 187, 173, 252, 185, 212, 131, 123, 122, 222, 124, 119, 89, 87, 86, 202, 81, 29, 84, 57, 159, 245, 137, 105, 249, 111, 182, 170, 226, 242, 19, 68, 243, 77, 89, 121, 57, 120, 111, 7, 123, 105, 86, 205, 129, 224, 231, 236, 152, 225, 201, 1, 162, 136, 117, 43, 151, 12, 194, 94, 108, 248, 140, 246, 226, 37, 173, 168, 137, 85, 228, 76, 142, 69, 183, 95, 25, 171, 107, 55, 59, 250, 75, 178, 241, 22, 120, 4, 24, 34, 249, 123, 222, 234, 83, 90, 64, 113, 170, 196, 245, 121, 171, 148, 158, 93, 30, 95, 75, 64, 246, 176, 247, 158, 192, 149, 155, 142, 22, 149, 68, 19, 155, 33, 93, 153, 18, 129, 22, 43, 30, 253, 166, 113];
|
||||||
|
const publicBigExpString = 'AQAAAA8=';
|
||||||
|
const publicBigExpBytes = [1, 0, 0, 0, 15];
|
||||||
|
|
||||||
|
|
||||||
|
const pblc = {
|
||||||
|
big: {
|
||||||
|
pem: publicBigPEM,
|
||||||
|
mod: {
|
||||||
|
bytes: publicBigModBytes,
|
||||||
|
string: publicBigModString,
|
||||||
|
},
|
||||||
|
exp: {
|
||||||
|
bytes: publicBigExpBytes,
|
||||||
|
string: publicBigExpString,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
small: {
|
||||||
|
pem: publicSmallExpPEM,
|
||||||
|
mod: publicSmallExpMod,
|
||||||
|
exp: publicSmallExpExp,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
pblc,
|
||||||
|
};
|
1
test/support/TEST_KEYS.key
Normal file
1
test/support/TEST_KEYS.key
Normal file
File diff suppressed because one or more lines are too long
47
test/unit/BigNumber.js
Normal file
47
test/unit/BigNumber.js
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
/* eslint-env node, mocha */
|
||||||
|
|
||||||
|
const { assert } = require('chai');
|
||||||
|
const { jsbn: { BigInteger } } = require('node-forge');
|
||||||
|
|
||||||
|
const BigNumber = require('../../lib/crypto/BigNumber');
|
||||||
|
|
||||||
|
const types = [
|
||||||
|
{ name: 'BigNumber', value: new BigNumber(11) },
|
||||||
|
{ name: 'BigInteger', value: new BigInteger('11') },
|
||||||
|
{ name: 'string with default radix', value: '11' },
|
||||||
|
{ name: 'string with radix 16', value: '0b', radix: 16 },
|
||||||
|
{ name: 'Buffer', value: Buffer.from('0b', 'hex') },
|
||||||
|
{ name: 'Array', value: [11] },
|
||||||
|
];
|
||||||
|
|
||||||
|
describe('BigNumber', () => {
|
||||||
|
describe('creating an instance', () => {
|
||||||
|
it('should throw with no value given', () => assert.throws(() => new BigNumber()));
|
||||||
|
it('should throw wrong value type', () => assert.throws(() => new BigNumber({})));
|
||||||
|
|
||||||
|
for (const { name, value, radix } of types) {
|
||||||
|
let instance;
|
||||||
|
describe(`out of ${name}`, () => {
|
||||||
|
it('create instance', () => assert.doesNotThrow(() => {
|
||||||
|
instance = new BigNumber(value, radix);
|
||||||
|
}));
|
||||||
|
it('toString with radix 10', () => assert.equal(instance.toString(), '11'));
|
||||||
|
it('toString with radix 16', () => assert.equal(instance.toString(16), '0b'));
|
||||||
|
it('toBEBuffer without length', () => assert.equal(instance.toBEBuffer().toString('hex'), '0b'));
|
||||||
|
it('toBEBuffer with length', () => assert.equal(instance.toBEBuffer(4).toString('hex'), '0000000b'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
describe('exports', () => {
|
||||||
|
it('toBEBuffer with too short length should throw', () => assert.throw(() => new BigNumber(837462187362).toBEBuffer(1)));
|
||||||
|
});
|
||||||
|
describe('operators', () => {
|
||||||
|
const num = new BigNumber(1);
|
||||||
|
it('and', () => assert.equal(num.and(1), 1));
|
||||||
|
it('mul', () => assert.equal(num.mul(2), 2));
|
||||||
|
it('mod', () => assert.equal(num.mod(1), 0));
|
||||||
|
it('shrn', () => assert.equal(num.shrn(1), 0));
|
||||||
|
});
|
||||||
|
});
|
92
test/unit/keys.js
Normal file
92
test/unit/keys.js
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
/* eslint-env node, mocha */
|
||||||
|
|
||||||
|
const { assert } = require('chai');
|
||||||
|
const fixtures = require('../fixtures/keys');
|
||||||
|
// const Key = require('../lib/keymanagers/keyRSA');
|
||||||
|
const Key = require('../../lib/keymanagers/Key');
|
||||||
|
|
||||||
|
const stripWhitespace = str => str.replace(/\s+/g, '');
|
||||||
|
|
||||||
|
describe('Keys management', () => {
|
||||||
|
describe('generates brand new', () => {
|
||||||
|
const keySize = 2048;
|
||||||
|
// const newKey = Key().generate(keySize);
|
||||||
|
const newKey = Key.generate();
|
||||||
|
|
||||||
|
it('private key', () => {
|
||||||
|
assert.isTrue(newKey.isPrivate());
|
||||||
|
});
|
||||||
|
|
||||||
|
it('that has the right key size', () => {
|
||||||
|
// const newKeySize = newKey.size(); // console.log(newKey.size());
|
||||||
|
assert(newKey.size(), keySize);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('creates public key from mod and exp', () => {
|
||||||
|
const { pem, mod, exp } = fixtures.pblc.big;
|
||||||
|
|
||||||
|
describe('that are strings', () => {
|
||||||
|
const m = Buffer.from(mod.string, 'base64');
|
||||||
|
const e = Buffer.from(exp.string, 'base64');
|
||||||
|
/* const newKey = Key().importKey({
|
||||||
|
mod: m, exp: e, modulus: mod.string, exponent: exp.string,
|
||||||
|
}); */
|
||||||
|
const newKey = new Key({ mod: m, exp: e });
|
||||||
|
|
||||||
|
it('and is really public', () => {
|
||||||
|
assert.isTrue(newKey.isPublic());
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
it('and has a propper mod in bytes', () => {
|
||||||
|
assert.deepEqual([...newKey.n()], mod.bytes);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('and has a propper pem string', () => {
|
||||||
|
assert.equal(stripWhitespace(newKey.toPem()), stripWhitespace(pem));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('that are bytes', () => {
|
||||||
|
const m = Buffer.from(mod.bytes);
|
||||||
|
const e = Buffer.from(exp.bytes);
|
||||||
|
/* const newKey = Key().importKey({
|
||||||
|
mod: m, exp: e, modulus: mod.string, exponent: exp.string,
|
||||||
|
}); */
|
||||||
|
const newKey = new Key({ mod: m, exp: e });
|
||||||
|
|
||||||
|
it('and is really public', () => {
|
||||||
|
assert.isTrue(newKey.isPublic());
|
||||||
|
});
|
||||||
|
|
||||||
|
it('and has a propper mod as a string', () => {
|
||||||
|
assert.equal(newKey.n().toString('base64'), mod.string);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('and has a propper pem string', () => {
|
||||||
|
assert.equal(stripWhitespace(newKey.toPem()), stripWhitespace(pem));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('creates public key from pem string', () => {
|
||||||
|
const { pem } = fixtures.pblc.big;
|
||||||
|
// const newKey = Key(pem);
|
||||||
|
const newKey = new Key({ pem });
|
||||||
|
|
||||||
|
it('and is really public', () => {
|
||||||
|
assert.isTrue(newKey.isPublic());
|
||||||
|
});
|
||||||
|
|
||||||
|
it('and has a propper(the same) pem string', () => {
|
||||||
|
/* newKey.pempem = {
|
||||||
|
modulus: mod.string,
|
||||||
|
exponent: exp.string,
|
||||||
|
}; */
|
||||||
|
assert.equal(stripWhitespace(newKey.toPem()), stripWhitespace(pem));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
@@ -3,7 +3,7 @@
|
|||||||
/* eslint-env node, mocha */
|
/* eslint-env node, mocha */
|
||||||
|
|
||||||
const { assert } = require('chai');
|
const { assert } = require('chai');
|
||||||
const H004Response = require('../lib/orders/H004/response');
|
const H004Response = require('../../lib/orders/H004/response');
|
||||||
|
|
||||||
describe('H004 response parsing', () => {
|
describe('H004 response parsing', () => {
|
||||||
it('parses bank keys', () => {
|
it('parses bank keys', () => {
|
29
test/unit/utils.js
Normal file
29
test/unit/utils.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
/* eslint-env node, mocha */
|
||||||
|
|
||||||
|
const { assert } = require('chai');
|
||||||
|
|
||||||
|
const utils = require('../../lib/utils');
|
||||||
|
|
||||||
|
describe('utils', () => {
|
||||||
|
describe('dateRange', () => {
|
||||||
|
describe('dateRange', () => {
|
||||||
|
it('should generate empty object with partial parameters', () => {
|
||||||
|
assert.isEmpty(utils.dateRange());
|
||||||
|
});
|
||||||
|
it('should throw with invalid date', () => {
|
||||||
|
assert.throws(() => utils.dateRange('2018-15-15', '2018-20-20'));
|
||||||
|
});
|
||||||
|
it('should work for valid string input', () => {
|
||||||
|
assert.containsAllDeepKeys(utils.dateRange('2018-01-15', '2018-01-20'), { DateRange: { Start: '2018-01-15', End: '2018-01-20' } });
|
||||||
|
});
|
||||||
|
it('should work for Date string input', () => {
|
||||||
|
assert.containsAllDeepKeys(utils.dateRange(new Date('2018-01-15'), new Date('2018-01-20')), { DateRange: { Start: '2018-01-15', End: '2018-01-20' } });
|
||||||
|
});
|
||||||
|
it('should work for timestamp string input', () => {
|
||||||
|
assert.containsAllDeepKeys(utils.dateRange(new Date('2018-01-15').getTime(), new Date('2018-01-20').getTime()), { DateRange: { Start: '2018-01-15', End: '2018-01-20' } });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Reference in New Issue
Block a user