35 Commits

Author SHA1 Message Date
nanov
9ee2be97c4 chore: changelog 2021-03-30 14:27:22 +03:00
nanov
f9fb6d3dc9 chore: cleanup & bump 2021-03-30 14:26:35 +03:00
nanov
2d580c0d44 merge 2021-03-30 14:24:07 +03:00
nanov
5c8139e1bc bump version 2021-03-30 14:23:52 +03:00
Dimitar Nanov
cecaa782c9 Merge pull request #56 from node-ebics/dependabot/npm_and_yarn/y18n-4.0.1
chore(deps): bump y18n from 4.0.0 to 4.0.1
2021-03-30 14:22:37 +03:00
Dimitar Nanov
3eb997e3df Merge pull request #53 from Herrie82/herrie/additionalConfigItems
Add additional bank configuration items
2021-03-30 14:22:14 +03:00
nanov
2b35ed072a fix: crypto additional byte check 2021-03-30 14:20:25 +03:00
Herrie
9ef50081ca Merge branch 'master' into herrie/additionalConfigItems 2021-03-30 11:03:35 +02:00
Herman van Hazendonk
d192e61d29 Add additional bank configuration items
For prettier generation of bank letters and other bits used in examples:

Expand the bank config to include:

* "bankFullName" used in the INI letter's which are sent to the bank.
* "bankShortName" used in the filename for the generated letters and in other places if needed.
* "languageCode" used for determining which template to use for the bank (currently "en" and "de" are supported).
* "storageLocation" can be used to specify a local or network path where to store downloaded files.

* In bankLetter.js: Use the current script folder as output for the bank's letter in HTML format instead of the user/os homedir folder.

Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
2021-03-30 11:02:36 +02:00
dependabot[bot]
0e56947b07 chore(deps): bump y18n from 4.0.0 to 4.0.1
Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-30 07:50:28 +00:00
nanov
e6420244dc chore: update deps 2021-03-30 10:36:45 +03:00
Dimitar Nanov
c8220f6d45 Merge pull request #46 from node-ebics/dependabot/npm_and_yarn/xmldom-0.5.0
chore(deps): bump xmldom from 0.3.0 to 0.5.0
2021-03-30 10:29:44 +03:00
nanov
f6dfc73ff2 chore: add https://github.com/Herrie82 to contributors 2021-03-30 09:21:34 +03:00
nanov
6921f8d503 chore: cleanup crypto sign fucntion 2021-03-30 09:20:21 +03:00
Dimitar Nanov
043caedc94 Merge pull request #50 from Herrie82/master
Cryto.js: Nasty workaround for incorrect signature (257 vs 256) and h…
2021-03-30 08:58:35 +03:00
Dimitar Nanov
13f6d03cb2 Merge pull request #51 from Herrie82/herrie/multibank
Examples: Improve config implementation for multibank
2021-03-30 08:53:35 +03:00
Dimitar Nanov
546d371193 Merge pull request #55 from Herrie82/herrie/jpm
README.md: Add J.P. Morgan to tested banks
2021-03-30 08:52:02 +03:00
Herman van Hazendonk
374560b14a README.md: Add J.P. Morgan to tested banks
J.P. Morgan has been tested for their global EBICS channel as well and confirmed to be working.

Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
2021-03-29 14:53:27 +02:00
Herman van Hazendonk
500737dbc7 Remove not needed else statement
Cleanup as per comment
2021-03-29 09:12:23 +02:00
Dimitar Nanov
57a15f0722 Merge pull request #49 from Herrie82/herrie/gazprumm
Add support for Bank GPB AO (Gazprombank Russia)
2021-03-29 09:13:59 +03:00
Dimitar Nanov
bff972f354 Merge pull request #48 from Herrie82/herrie/zipped-camt
Add sample code for zipped CAMT statements
2021-03-29 09:12:36 +03:00
Herman van Hazendonk
de92265c95 Examples: Improve config implementation for multibank.
When using the software with multiple banks, the current config file solution wasn't very flexible. We had some different local implementation at our end. In order to use upstream software directly without any changes, suggesting to merge these changes. For me locally it would mean I can get rid of a lot of local example code which are currently bank and even entity specific and can be made more generic.
This will also allow multiple EBICS connections with the same bank for different entities as well, in case this is needed. In our case we have multiple EBICS connections with the same bank.

Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
2021-03-26 19:57:54 +01:00
Herrie
61581d1af7 Cryto.js: Nasty workaround for incorrect signature (257 vs 256) and hex key length (514 vs 512)
For some unknown reason, the signature gets a length of 257 bytes instead of 256 bytes, and the length of the hex value is 514 bytes instead of 512 bytes.

This works around it, until a proper fix is implemented. The bug seems to be caused by https://github.com/node-ebics/node-ebics-client/blob/master/lib/crypto/Crypto.js#L71 somehow.

Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
2021-03-25 10:07:33 +01:00
Herman van Hazendonk
8af3cb50c5 Add sample code for zipped CAMT statements
Some banks provide zipped CAMT statements, add some example code on how to write these to a file.

Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
2021-03-24 22:14:21 +01:00
Herman van Hazendonk
a628e00b9b Add support for Bank GPB AO (Gazprombank Russia)
Add custom order types (G02, G52, G53, G1R and G1V) and examples for Bank GPB AO (Gazprombank Russia).

Pain.001.001.06 (RUB) - G1R
Pain.001.001.06 (FCY/FX/RLS) - G1V
Pain.002.001.06 - G02
Camt.052.001.05 - G52
Camt.053.001.05 - G53

Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
2021-03-24 22:13:18 +01:00
dependabot[bot]
b8ec1e228e chore(deps): bump xmldom from 0.3.0 to 0.5.0
Bumps [xmldom](https://github.com/xmldom/xmldom) from 0.3.0 to 0.5.0.
- [Release notes](https://github.com/xmldom/xmldom/releases)
- [Changelog](https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/xmldom/xmldom/compare/0.3.0...0.5.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-13 02:40:29 +00:00
nanov
f027bc4048 chore: adjust ownership 2021-02-05 20:38:38 +02:00
nanov
a998538316 changelog 2021-02-05 20:30:59 +02:00
nanov
b44ff0f44c chore: bump 2021-02-05 20:29:22 +02:00
Dimitar Nanov
2ba095fbdd Merge pull request #44 from chrwoizi/master
fix high severity vulnerabilities
2021-01-25 16:21:16 +02:00
chrwoizi
c28a6f7f09 fix high severity vulnerabilities 2021-01-21 11:34:37 +01:00
Dimitar Nanov
0585ecd396 Merge pull request #39 from node-ebics/dependabot/npm_and_yarn/lodash-4.17.19
chore(deps): bump lodash from 4.17.15 to 4.17.19
2020-08-05 19:16:34 +03:00
dependabot[bot]
21a46832fc chore(deps): bump lodash from 4.17.15 to 4.17.19
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-18 18:01:50 +00:00
nanov
d5a24f9537 chore: fix dev dependencies voulnarbilities 2020-05-09 13:24:00 +03:00
nanov
a9bbdd95c6 chore: changelog 2020-05-09 13:21:16 +03:00
25 changed files with 850 additions and 321 deletions

View File

@@ -1,14 +1,43 @@
### Changelog ### Changelog
#### [v0.1.5](https://github.com/node-ebics/node-ebics-client/compare/v0.1.4...v0.1.5) #### [v0.2.0](https://github.com/node-ebics/node-ebics-client/compare/v0.1.7...v0.2.0)
> 6 March 2020 > 30 March 2021
- chore(deps): bump y18n from 4.0.0 to 4.0.1 [`#56`](https://github.com/node-ebics/node-ebics-client/pull/56)
- Add additional bank configuration items [`#53`](https://github.com/node-ebics/node-ebics-client/pull/53)
- chore(deps): bump xmldom from 0.3.0 to 0.5.0 [`#46`](https://github.com/node-ebics/node-ebics-client/pull/46)
- Cryto.js: Nasty workaround for incorrect signature (257 vs 256) and h… [`#50`](https://github.com/node-ebics/node-ebics-client/pull/50)
- Examples: Improve config implementation for multibank [`#51`](https://github.com/node-ebics/node-ebics-client/pull/51)
- README.md: Add J.P. Morgan to tested banks [`#55`](https://github.com/node-ebics/node-ebics-client/pull/55)
- Add support for Bank GPB AO (Gazprombank Russia) [`#49`](https://github.com/node-ebics/node-ebics-client/pull/49)
- Add sample code for zipped CAMT statements [`#48`](https://github.com/node-ebics/node-ebics-client/pull/48)
- chore: cleanup & bump [`f9fb6d3`](https://github.com/node-ebics/node-ebics-client/commit/f9fb6d3dc94c27a0c983205ce0ef00e4a18f95ff)
- merge [`2d580c0`](https://github.com/node-ebics/node-ebics-client/commit/2d580c0d443b0ec0d103a94b64c803bfa1dd6b0b)
- chore: update deps [`e642024`](https://github.com/node-ebics/node-ebics-client/commit/e6420244dc5d218926ede3b0123897096fb6dfd9)
#### [v0.1.7](https://github.com/node-ebics/node-ebics-client/compare/v0.1.6...v0.1.7)
> 5 February 2021
- fix high severity vulnerabilities [`#44`](https://github.com/node-ebics/node-ebics-client/pull/44)
- chore(deps): bump lodash from 4.17.15 to 4.17.19 [`#39`](https://github.com/node-ebics/node-ebics-client/pull/39)
- chore: fix dev dependencies voulnarbilities [`d5a24f9`](https://github.com/node-ebics/node-ebics-client/commit/d5a24f9537f676ded8d1996928ed7e76b7b9ba3f)
- changelog [`a998538`](https://github.com/node-ebics/node-ebics-client/commit/a998538316c963896c0e7ca76002513f9ea4a01a)
- chore: changelog [`a9bbdd9`](https://github.com/node-ebics/node-ebics-client/commit/a9bbdd95c6ce0fdb9cac5452af6fedb4f04b10cb)
#### [v0.1.6](https://github.com/node-ebics/node-ebics-client/compare/v0.1.4...v0.1.6)
> 9 May 2020
- chore(deps): bump acorn from 7.1.0 to 7.1.1 [`#34`](https://github.com/node-ebics/node-ebics-client/pull/34)
- feat: Wait until the keys are generated [`#33`](https://github.com/node-ebics/node-ebics-client/pull/33) - feat: Wait until the keys are generated [`#33`](https://github.com/node-ebics/node-ebics-client/pull/33)
- chore: update deps [`bd11a41`](https://github.com/node-ebics/node-ebics-client/commit/bd11a410f1d2444cdfdfba965df7be37cedcc14a)
- chore: update deps [`7053a03`](https://github.com/node-ebics/node-ebics-client/commit/7053a03286c700106bb1988fce72338f51ca9a96) - chore: update deps [`7053a03`](https://github.com/node-ebics/node-ebics-client/commit/7053a03286c700106bb1988fce72338f51ca9a96)
- changelog [`c5e5941`](https://github.com/node-ebics/node-ebics-client/commit/c5e59414f35a9634e12a6b74163f1b7fa6403de5) - changelog [`c5e5941`](https://github.com/node-ebics/node-ebics-client/commit/c5e59414f35a9634e12a6b74163f1b7fa6403de5)
- fix(examples): orders ref [`4b0bf0e`](https://github.com/node-ebics/node-ebics-client/commit/4b0bf0eba63f3eaa8986d8974ca4c0e647b9029f)
#### [v0.1.4](https://github.com/node-ebics/node-ebics-client/compare/v0.1.3...v0.1.4) #### [v0.1.4](https://github.com/node-ebics/node-ebics-client/compare/v0.1.3...v0.1.4)

View File

@@ -28,6 +28,8 @@ The client is currently tested and verified to work with the following banks:
* [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) * [BW Bank](https://www.bw-bank.de/de/home.html)
* [Bank GPB International S.A.](https://gazprombank.lu/e-banking) * [Bank GPB International S.A.](https://gazprombank.lu/e-banking)
* [Bank GPB AO](https://gazprombank.ru/)
* [J.P. Morgan](https://www.jpmorgan.com/)
## Inspiration ## Inspiration
@@ -37,6 +39,6 @@ The basic concept of this library was inspired by the [EPICS](https://github.com
## Copyright ## Copyright
Copyright: eCollect AG, 2018-9. Copyright: Dimitar Nanov, 2019-2021.
Licensed under the [GPLv3](LICENSE) license. Licensed under the [GPLv3](LICENSE) license.

View File

@@ -9,10 +9,9 @@ const os = require('os');
const config = require('./loadConfig')(); const config = require('./loadConfig')();
const client = require('./getClient')(config); const client = require('./getClient')(config);
const bankName = config.bankName; const bankName = client.bankName;
const languageCode = config.languageCode; const template = fs.readFileSync("../templates/ini_"+client.languageCode+".hbs", { encoding: 'utf8'});
const template = fs.readFileSync('../templates/ini_'+config.languageCode+'.hbs', { encoding: 'utf8 '}); const bankLetterFile = path.join("./", "bankLetter_"+client.bankShortName+"_"+client.languageCode+".html");
const bankLetterFile = path.join(os.homedir(), 'bankLetter_'+languageCode+'.html');
const letter = new ebics.BankLetter({ client, bankName, template }); const letter = new ebics.BankLetter({ client, bankName, template });

View File

@@ -5,6 +5,8 @@
"hostId": "MyHostIdTest", "hostId": "MyHostIdTest",
"passphrase": "MyPasswordTest", "passphrase": "MyPasswordTest",
"keyStoragePath": "./keys-test", "keyStoragePath": "./keys-test",
"bankName":"Test Bank", "bankName":"Test Bank Full Name",
"languageCode":"en" "bankShortName":"TESTBANKSHORT",
"languageCode":"en",
"storageLocation":"\\\\myserver\\Share\\Folder\\BankName\\Test\\"
} }

View File

@@ -5,6 +5,8 @@
"hostId": "MyHostIdProduction", "hostId": "MyHostIdProduction",
"passphrase": "MyPasswordProduction", "passphrase": "MyPasswordProduction",
"keyStoragePath": "./keys-prod", "keyStoragePath": "./keys-prod",
"bankName":"Production Bank", "bankName":"Production Bank Full Name",
"languageCode":"en" "bankShortName":"PRODBANKSHORT",
"languageCode":"en",
"storageLocation":"\\\\myserver\\Share\\Folder\\BankName\\Production\\"
} }

View File

@@ -0,0 +1,12 @@
{
"url": "https://ebics.server",
"partnerId": "EBICS ParnerID Production",
"userId": "MyUserIdProduction",
"hostId": "MyHostIdProduction",
"passphrase": "MyPasswordProduction",
"keyStoragePath": "./keys-prod",
"bankName":"Production Bank Full Name",
"bankShortName":"PRODBANKSHORT",
"languageCode":"en",
"storageLocation":"\\\\myserver\\Share\\Folder\\BankName\\Production\\"
}

View File

@@ -20,11 +20,22 @@ const getDefaultEnv = () => {
return parArg || process.env.NODE_ENV; return parArg || process.env.NODE_ENV;
} }
const loadConfig = (configDirectory = path.join(__dirname, './config'), env = getDefaultEnv()) => { const getBankIdentifier = () => {
console.log(`Loading config form ${configDirectory} with env set to ${env}.`); const [,,,parArg] = process.argv;
return parArg || "testbank";
}
const getEntityIdentifier = () => {
const [,,,,parArg] = process.argv;
return parArg || ""
}
const loadConfig = (configDirectory = path.join(__dirname, './config'), env = getDefaultEnv(), bank = getBankIdentifier(), entity = getEntityIdentifier()) => {
entity ? console.log(`Loading config from ${configDirectory} with env set to ${env}, bank set to ${bank} and entity set to ${entity}.`) : console.log(`Loading config from ${configDirectory} with env set to ${env} and bank set to ${bank}.`);
global.entity = entity;
const baseConfigFile = path.join(configDirectory, 'config.json'); const baseConfigFile = path.join(configDirectory, 'config.json');
const envConfigFile = env ? path.join(configDirectory, `config.${env}.json`) : null; const envConfigFile = env ? entity ? path.join(configDirectory, `config.${env}.${bank}.${entity}.json`) : path.join(configDirectory, `config.${env}.${bank}.json`) : null;
return { return {
...safeLoadJson(baseConfigFile), ...safeLoadJson(baseConfigFile),

View File

@@ -0,0 +1,28 @@
#! /usr/bin/env node
'use strict';
const fs = require('fs');
const client = require('./getClient')();
const { Orders } = require('../index');
// The bank keys must have been already saved
client.send(Orders.C52(null, null)) // startDate 'YYYY-MM-DD', endDate 'YYYY-MM-DD'
.then((resp) => {
console.log('Response for C52 order %j', resp);
if (resp.technicalCode !== '000000')
throw new Error('Something went wrong');
// Parsing and processing the CAMT052 file should happen somewhere here, ideally after saving it to disk
const data = Buffer.from(resp.orderData);
let distPath = "CAMT052.zip";
const dstZip = fs.createWriteStream(distPath);
dstZip.write(data);
dstZip.end();
})
.catch((err) => {
console.error(err);
process.exit(1);
});

View File

@@ -0,0 +1,28 @@
#! /usr/bin/env node
'use strict';
const fs = require('fs');
const client = require('./getClient')();
const { Orders } = require('../index');
// The bank keys must have been already saved
client.send(Orders.C53(null, null)) // startDate 'YYYY-MM-DD', endDate 'YYYY-MM-DD'
.then((resp) => {
console.log('Response for C53 order %j', resp);
if (resp.technicalCode !== '000000')
throw new Error('Something went wrong');
// Parsing and processing the CAMT053 file should happen somewhere here, ideally after saving it to disk
const data = Buffer.from(resp.orderData);
let distPath = "CAMT053.zip";
const dstZip = fs.createWriteStream(distPath);
dstZip.write(data);
dstZip.end();
})
.catch((err) => {
console.error(err);
process.exit(1);
});

View File

@@ -0,0 +1,28 @@
#! /usr/bin/env node
'use strict';
const fs = require('fs');
const client = require('./getClient')();
const { Orders } = require('../index');
// The bank keys must have been already saved
client.send(Orders.G02(null, null)) // startDate 'YYYY-MM-DD', endDate 'YYYY-MM-DD'
.then((resp) => {
console.log('Response for G02 order %j', resp);
if (resp.technicalCode !== '000000')
throw new Error('Something went wrong');
// Parsing and processing the G02 Pain.002.001.06 file should happen somewhere here, ideally after saving it to disk
const data = Buffer.from(resp.orderData);
let distPath = "G02.zip";
const dstZip = fs.createWriteStream(distPath);
dstZip.write(data);
dstZip.end();
})
.catch((err) => {
console.error(err);
process.exit(1);
});

View File

@@ -0,0 +1,20 @@
#! /usr/bin/env node
'use strict';
const fs = require('fs');
const client = require('./getClient')();
const { Orders } = require('../index');
// The bank keys must have been already saved
const paymentFile = fs.readFileSync('RUB_PAYMENT.xml').toString();
client.send(Orders.G1R(paymentFile))
.then((resp) => {
console.log('Response for G1R order %j', resp);
})
.catch((err) => {
console.error(err);
process.exit(1);
});

View File

@@ -0,0 +1,20 @@
#! /usr/bin/env node
'use strict';
const fs = require('fs');
const client = require('./getClient')();
const { Orders } = require('../index');
// The bank keys must have been already saved
const paymentFile = fs.readFileSync('FCY_PAYMENT.xml').toString();
client.send(Orders.G1V(paymentFile))
.then((resp) => {
console.log('Response for G1V order %j', resp);
})
.catch((err) => {
console.error(err);
process.exit(1);
});

View File

@@ -0,0 +1,28 @@
#! /usr/bin/env node
'use strict';
const fs = require('fs');
const client = require('./getClient')();
const { Orders } = require('../index');
// The bank keys must have been already saved
client.send(Orders.G52(null, null)) // startDate 'YYYY-MM-DD', endDate 'YYYY-MM-DD'
.then((resp) => {
console.log('Response for G52 order %j', resp);
if (resp.technicalCode !== '000000')
throw new Error('Something went wrong');
// Parsing and processing the CAMT052 file should happen somewhere here, ideally after saving it to disk
const data = Buffer.from(resp.orderData);
let distPath = "CAMT052-G52.zip";
const dstZip = fs.createWriteStream(distPath);
dstZip.write(data);
dstZip.end();
})
.catch((err) => {
console.error(err);
process.exit(1);
});

View File

@@ -0,0 +1,28 @@
#! /usr/bin/env node
'use strict';
const fs = require('fs');
const client = require('./getClient')();
const { Orders } = require('../index');
// The bank keys must have been already saved
client.send(Orders.G53(null, null)) // startDate 'YYYY-MM-DD', endDate 'YYYY-MM-DD'
.then((resp) => {
console.log('Response for G53 order %j', resp);
if (resp.technicalCode !== '000000')
throw new Error('Something went wrong');
// Parsing and processing the CAMT053 file should happen somewhere here, ideally after saving it to disk
const data = Buffer.from(resp.orderData);
let distPath = "CAMT053-G53.zip";
const dstZip = fs.createWriteStream(distPath);
dstZip.write(data);
dstZip.end();
})
.catch((err) => {
console.error(err);
process.exit(1);
});

View File

@@ -46,6 +46,10 @@ const stringifyKeys = (keys) => {
* @property {string} passphrase - passphrase for keys encryption * @property {string} passphrase - passphrase for keys encryption
* @property {KeyStorage} keyStorage - keyStorage implementation * @property {KeyStorage} keyStorage - keyStorage implementation
* @property {object} [tracesStorage] - traces (logs) storage implementation * @property {object} [tracesStorage] - traces (logs) storage implementation
* @property {string} bankName - Full name of the bank to be used in the bank INI letters.
* @property {string} bankShortName - Short name of the bank to be used in folders, filenames etc.
* @property {string} languageCode - Language code to be used in the bank INI letters ("de", "en" and "fr" are currently supported).
* @property {string} storageLocation - Location where to store the files that are downloaded. This can be a network share for example.
*/ */
@@ -62,6 +66,10 @@ module.exports = class Client {
passphrase, passphrase,
keyStorage, keyStorage,
tracesStorage, tracesStorage,
bankName,
bankShortName,
languageCode,
storageLocation,
}) { }) {
if (!url) if (!url)
throw new Error('EBICS URL is required'); throw new Error('EBICS URL is required');
@@ -84,6 +92,10 @@ module.exports = class Client {
this.keyStorage = keyStorage; this.keyStorage = keyStorage;
this.keyEncryptor = defaultKeyEncryptor({ passphrase }); this.keyEncryptor = defaultKeyEncryptor({ passphrase });
this.tracesStorage = tracesStorage || null; this.tracesStorage = tracesStorage || null;
this.bankName = bankName || 'Dummy Bank Full Name';
this.bankShortName = bankShortName || 'BANKSHORTCODE';
this.languageCode = languageCode || 'en';
this.storageLocation = storageLocation || null;
} }
async send(order) { async send(order) {

View File

@@ -67,12 +67,15 @@ module.exports = class Crypto {
} }
static sign(key, msg, salt = crypto.randomBytes(32)) { static sign(key, msg, salt = crypto.randomBytes(32)) {
// console.log(key.d());
const base = new BigNumber(emsaPSS(msg, salt)); const base = new BigNumber(emsaPSS(msg, salt));
const power = new BigNumber(key.d()); const power = new BigNumber(key.d());
const mod = new BigNumber(key.n()); const mod = new BigNumber(key.n());
const buffer = modPow(base, power, mod).toBEBuffer();
return (modPow(base, power, mod)).toBEBuffer().toString('base64'); if (buffer.byteLength !== 257 && buffer[0] === 0x00)
return buffer.slice(1).toString('base64');
return buffer.toString('base64');
} }
static pad(d) { static pad(d) {

View File

@@ -0,0 +1,13 @@
'use strict';
const utils = require('../utils');
module.exports = (start = null, end = null) => ({
version: 'h004',
orderDetails: {
OrderType: 'G02',
OrderAttribute: 'DZHNN',
StandardOrderParams: utils.dateRange(start, end),
},
operation: 'download',
});

View File

@@ -0,0 +1,8 @@
'use strict';
module.exports = document => ({
version: 'h004',
orderDetails: { OrderType: 'G1R', OrderAttribute: 'DZHNN', StandardOrderParams: {} },
operation: 'upload',
document,
});

View File

@@ -0,0 +1,8 @@
'use strict';
module.exports = document => ({
version: 'h004',
orderDetails: { OrderType: 'G1V', OrderAttribute: 'DZHNN', StandardOrderParams: {} },
operation: 'upload',
document,
});

View File

@@ -0,0 +1,13 @@
'use strict';
const utils = require('../utils');
module.exports = (start = null, end = null) => ({
version: 'h004',
orderDetails: {
OrderType: 'G52',
OrderAttribute: 'DZHNN',
StandardOrderParams: utils.dateRange(start, end),
},
operation: 'download',
});

View File

@@ -0,0 +1,13 @@
'use strict';
const utils = require('../utils');
module.exports = (start = null, end = null) => ({
version: 'h004',
orderDetails: {
OrderType: 'G53',
OrderAttribute: 'DZHNN',
StandardOrderParams: utils.dateRange(start, end),
},
operation: 'download',
});

View File

@@ -14,6 +14,8 @@ const CCS = require('./CCS');
const XE3 = require('./XE3'); const XE3 = require('./XE3');
const XCT = require('./XCT'); const XCT = require('./XCT');
const XG1 = require('./XG1'); const XG1 = require('./XG1');
const G1V = require('./G1V');
const G1R = require('./G1R');
const STA = require('./STA'); const STA = require('./STA');
const VMK = require('./VMK'); const VMK = require('./VMK');
@@ -27,6 +29,9 @@ const Z53 = require('./Z53');
const DKI = require('./DKI'); const DKI = require('./DKI');
const C52 = require('./C52'); const C52 = require('./C52');
const C53 = require('./C53'); const C53 = require('./C53');
const G52 = require('./G52');
const G53 = require('./G53');
const G02 = require('./G02');
module.exports = { module.exports = {
INI, INI,
@@ -44,6 +49,8 @@ module.exports = {
XE3, XE3,
XCT, XCT,
XG1, XG1,
G1V,
G1R,
STA, STA,
VMK, VMK,
@@ -56,4 +63,7 @@ module.exports = {
DKI, DKI,
C52, C52,
C53, C53,
G52,
G53,
G02,
}; };

634
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "ebics-client", "name": "ebics-client",
"version": "0.1.6", "version": "0.2.0",
"description": "Node.js ISO 20022 Compliant EBICS Client", "description": "Node.js ISO 20022 Compliant EBICS Client",
"main": "index.js", "main": "index.js",
"files": [ "files": [
@@ -51,28 +51,32 @@
{ {
"name": "chrwoizi", "name": "chrwoizi",
"url": "https://github.com/chrwoizi" "url": "https://github.com/chrwoizi"
},
{
"name": "Herrie",
"url": "https://github.com/Herrie82"
} }
], ],
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"dependencies": { "dependencies": {
"handlebars": "^4.7.6", "handlebars": "^4.7.7",
"js2xmlparser": "^4.0.1", "js2xmlparser": "^4.0.1",
"node-forge": "^0.9.1", "node-forge": "^0.10.0",
"request": "^2.88.2", "request": "^2.88.2",
"uuid": "^8.0.0", "uuid": "^8.3.2",
"xml-crypto": "^1.5.3", "xml-crypto": "^2.1.1",
"xmldom": "^0.3.0", "xmldom": "^0.5.0",
"xpath": "0.0.27" "xpath": "0.0.32"
}, },
"devDependencies": { "devDependencies": {
"auto-changelog": "^1.16.2", "auto-changelog": "^1.16.2",
"chai": "^4.2.0", "chai": "^4.3.4",
"coveralls": "^3.1.0", "coveralls": "^3.1.0",
"eslint": "^6.7.2", "eslint": "^6.7.2",
"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": "^7.1.2", "mocha": "^7.1.2",
"nyc": "^15.0.1" "nyc": "^15.1.0"
} }
} }

164
templates/ini_fr.hbs Normal file
View File

@@ -0,0 +1,164 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta charset="UTF-8" />
<title>EBICS ini</title>
</head>
<body>
<div>
<h2>Lettre d'initialisation pour clés électroniques bancaires (INI)</h2>
<table>
<tr>
<td>Date</td>
<td>{{ today }}</td>
</tr>
<tr>
<td>Heure</td>
<td>{{ now }}</td>
</tr>
<tr>
<td>Banque</td>
<td>{{ bankName }}</td>
</tr>
<tr>
<td>ID Utilisateur</td>
<td>{{ userId }}</td>
</tr>
<tr>
<td>ID Partenaire</td>
<td>{{ partnerId }}</td>
</tr>
</table>
<p>Clé publique (Public Key) pour la signature électronique (A006)</p>
<p>Exposant ({{ keyExponentBits A006 }} Bit):</p>
<p>
<code>{{ keyExponent A006 }}</code>
</p>
<p>Modulo ({{ keyModulusBits A006 }} Bit):</p>
<p>
<code>{{ keyModulus A006 }}</code>
</p>
<p>Hash (SHA-256):</p>
<p>
<code>{{ sha256 A006 }}</code>
</p>
<p>Je confirme par la présente la clé publique ci-dessus pour ma signature électronique.</p>
<br/>
<br/>
<br/>
<br/>
<table>
<tr>
<td>_________________________</td>
<td>_________________________</td>
<td>_________________________</td>
</tr>
<tr>
<td>Lieu/Date</td>
<td>Nom/Entreprise</td>
<td>Signature</td>
</tr>
</table>
</div>
<div style="page-break-after:always"></div>
<h2>Lettre d'initialisation pour clés électroniques bancaires (HIA) - Page 1/2</h2>
<table>
<tr>
<td>Date</td>
<td>{{ today }}</td>
</tr>
<tr>
<td>Heure</td>
<td>{{ now }}</td>
</tr>
<tr>
<td>Banque</td>
<td>{{ bankName }}</td>
</tr>
<tr>
<td>ID Utilisateur</td>
<td>{{ userId }}</td>
</tr>
<tr>
<td>ID Partenaire</td>
<td>{{ partnerId }}</td>
</tr>
</table>
<div>
<p>Clé d'identification publique (X002)</p>
<p>Exposant ({{ keyExponentBits X002 }} Bit):</p>
<p>
<code>{{ keyExponent X002 }}</code>
</p>
<p>Modulo ({{ keyModulusBits X002 }} Bit):</p>
<p>
<code>{{ keyModulus X002 }}</code>
</p>
<p>Hash (SHA-256):</p>
<p>
<code>{{ sha256 X002 }}</code>
</p>
<p>Suite à la page 2 ...</p>
<div style="page-break-after:always"></div>
<h2>Lettre d'initialisation pour clés électroniques bancaires (HIA) - Page 2/2</h2>
<table>
<tr>
<td>Date</td>
<td>{{ today }}</td>
</tr>
<tr>
<td>Heure</td>
<td>{{ now }}</td>
</tr>
<tr>
<td>Banque</td>
<td>{{ bankName }}</td>
</tr>
<tr>
<td>ID Utilisateur</td>
<td>{{ userId }}</td>
</tr>
<tr>
<td>ID Partenaire</td>
<td>{{ partnerId }}</td>
</tr>
</table>
</div>
<div>
<p>Clé de chiffrement publique (E002)</p>
<p>Exposant ({{ keyExponentBits E002 }} Bit):</p>
<p>
<code>{{ keyExponent E002 }}</code>
</p>
<p>Modulo ({{ keyModulusBits E002 }} Bit):</p>
<p>
<code>{{ keyModulus E002 }}</code>
</p>
<p>Hash (SHA-256):</p>
<p>
<code>{{ sha256 E002 }}</code>
</p>
<p>Je confirme par la présente les clés publiques ci-dessus.</p>
<br/>
<br/>
<br/>
<br/>
<table>
<tr>
<td>_________________________</td>
<td>_________________________</td>
<td>_________________________</td>
</tr>
<tr>
<td>Lieu/Date</td>
<td>Nom/Entreprise</td>
<td>Signature</td>
</tr>
</table>
</div>
</body>
</html>