From b8ec1e228ee8d1b626615de07583dd6283a99450 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 13 Mar 2021 02:40:29 +0000 Subject: [PATCH 1/3] 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] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8644be4..1b15967 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ebics-client", - "version": "0.1.6", + "version": "0.1.7", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -4367,9 +4367,9 @@ "integrity": "sha512-HgS+X6zAztGa9zIK3Y3LXuJes33Lz9x+YyTxgrkIdabu2vqcGOWwdfCpf1hWLRrd553wd4QCDf6BBO6FfdsRiQ==" }, "xmldom": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.3.0.tgz", - "integrity": "sha512-z9s6k3wxE+aZHgXYxSTpGDo7BYOUfJsIRyoZiX6HTjwpwfS2wpQBQKa2fD+ShLyPkqDYo5ud7KitmLZ2Cd6r0g==" + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.5.0.tgz", + "integrity": "sha512-Foaj5FXVzgn7xFzsKeNIde9g6aFBxTPi37iwsno8QvApmtg7KYrr+OPyRHcJF7dud2a5nGRBXK3n0dL62Gf7PA==" }, "xpath": { "version": "0.0.27", diff --git a/package.json b/package.json index 4e757de..839a572 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "request": "^2.88.2", "uuid": "^8.0.0", "xml-crypto": "^2.0.0", - "xmldom": "^0.3.0", + "xmldom": "^0.5.0", "xpath": "0.0.27" }, "devDependencies": { From 0e56947b07e1dfa1c9ac827afc8aec74bcb82ebc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Mar 2021 07:50:28 +0000 Subject: [PATCH 2/3] 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] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1b15967..ec7cbdb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4377,9 +4377,9 @@ "integrity": "sha512-fg03WRxtkCV6ohClePNAECYsmpKKTv5L8y/X3Dn1hQrec3POx2jHZ/0P2qQ6HvsrU1BmeqXcof3NGGueG6LxwQ==" }, "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", + "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==", "dev": true }, "yallist": { From d192e61d29e5895953c5a47bd791ae218a2bfbee Mon Sep 17 00:00:00 2001 From: Herman van Hazendonk Date: Fri, 26 Mar 2021 14:50:20 +0100 Subject: [PATCH 3/3] 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 --- examples/bankLetter.js | 7 +- examples/config/config.json | 6 +- ...n.json => config.production.testbank.json} | 6 +- ...config.production.testbank.testentity.json | 12 ++ lib/Client.js | 14 +- templates/ini_fr.hbs | 164 ++++++++++++++++++ 6 files changed, 200 insertions(+), 9 deletions(-) rename examples/config/{config.production.json => config.production.testbank.json} (56%) create mode 100644 examples/config/config.production.testbank.testentity.json create mode 100644 templates/ini_fr.hbs diff --git a/examples/bankLetter.js b/examples/bankLetter.js index 8f7fee0..3963e35 100755 --- a/examples/bankLetter.js +++ b/examples/bankLetter.js @@ -9,10 +9,9 @@ const os = require('os'); const config = require('./loadConfig')(); const client = require('./getClient')(config); -const bankName = config.bankName; -const languageCode = config.languageCode; -const template = fs.readFileSync('../templates/ini_'+config.languageCode+'.hbs', { encoding: 'utf8 '}); -const bankLetterFile = path.join(os.homedir(), 'bankLetter_'+languageCode+'.html'); +const bankName = client.bankName; +const template = fs.readFileSync("../templates/ini_"+client.languageCode+".hbs", { encoding: 'utf8'}); +const bankLetterFile = path.join("./", "bankLetter_"+client.bankShortName+"_"+client.languageCode+".html"); const letter = new ebics.BankLetter({ client, bankName, template }); diff --git a/examples/config/config.json b/examples/config/config.json index 44e3369..a91252f 100644 --- a/examples/config/config.json +++ b/examples/config/config.json @@ -5,6 +5,8 @@ "hostId": "MyHostIdTest", "passphrase": "MyPasswordTest", "keyStoragePath": "./keys-test", - "bankName":"Test Bank", - "languageCode":"en" + "bankName":"Test Bank Full Name", + "bankShortName":"TESTBANKSHORT", + "languageCode":"en", + "storageLocation":"\\\\myserver\\Share\\Folder\\BankName\\Test\\" } diff --git a/examples/config/config.production.json b/examples/config/config.production.testbank.json similarity index 56% rename from examples/config/config.production.json rename to examples/config/config.production.testbank.json index 1bb31fa..b94996a 100644 --- a/examples/config/config.production.json +++ b/examples/config/config.production.testbank.json @@ -5,6 +5,8 @@ "hostId": "MyHostIdProduction", "passphrase": "MyPasswordProduction", "keyStoragePath": "./keys-prod", - "bankName":"Production Bank", - "languageCode":"en" + "bankName":"Production Bank Full Name", + "bankShortName":"PRODBANKSHORT", + "languageCode":"en", + "storageLocation":"\\\\myserver\\Share\\Folder\\BankName\\Production\\" } diff --git a/examples/config/config.production.testbank.testentity.json b/examples/config/config.production.testbank.testentity.json new file mode 100644 index 0000000..b94996a --- /dev/null +++ b/examples/config/config.production.testbank.testentity.json @@ -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\\" +} diff --git a/lib/Client.js b/lib/Client.js index 3140b10..4a829f1 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -46,6 +46,10 @@ const stringifyKeys = (keys) => { * @property {string} passphrase - passphrase for keys encryption * @property {KeyStorage} keyStorage - keyStorage 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, keyStorage, tracesStorage, + bankName, + bankShortName, + languageCode, + storageLocation, }) { if (!url) throw new Error('EBICS URL is required'); @@ -83,7 +91,11 @@ module.exports = class Client { this.hostId = hostId; this.keyStorage = keyStorage; 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) { diff --git a/templates/ini_fr.hbs b/templates/ini_fr.hbs new file mode 100644 index 0000000..5967b31 --- /dev/null +++ b/templates/ini_fr.hbs @@ -0,0 +1,164 @@ + + + + + + + EBICS ini + + + +
+

Lettre d'initialisation pour clés électroniques bancaires (INI)

+ + + + + + + + + + + + + + + + + + + + + +
Date{{ today }}
Heure{{ now }}
Banque{{ bankName }}
ID Utilisateur{{ userId }}
ID Partenaire{{ partnerId }}
+

Clé publique (Public Key) pour la signature électronique (A006)

+

Exposant ({{ keyExponentBits A006 }} Bit):

+

+ {{ keyExponent A006 }} +

+

Modulo ({{ keyModulusBits A006 }} Bit):

+

+ {{ keyModulus A006 }} +

+

Hash (SHA-256):

+

+ {{ sha256 A006 }} +

+

Je confirme par la présente la clé publique ci-dessus pour ma signature électronique.

+
+
+
+
+ + + + + + + + + + + +
___________________________________________________________________________
Lieu/DateNom/EntrepriseSignature
+
+
+

Lettre d'initialisation pour clés électroniques bancaires (HIA) - Page 1/2

+ + + + + + + + + + + + + + + + + + + + + +
Date{{ today }}
Heure{{ now }}
Banque{{ bankName }}
ID Utilisateur{{ userId }}
ID Partenaire{{ partnerId }}
+
+

Clé d'identification publique (X002)

+

Exposant ({{ keyExponentBits X002 }} Bit):

+

+ {{ keyExponent X002 }} +

+

Modulo ({{ keyModulusBits X002 }} Bit):

+

+ {{ keyModulus X002 }} +

+

Hash (SHA-256):

+

+ {{ sha256 X002 }} +

+

Suite à la page 2 ...

+
+

Lettre d'initialisation pour clés électroniques bancaires (HIA) - Page 2/2

+ + + + + + + + + + + + + + + + + + + + + +
Date{{ today }}
Heure{{ now }}
Banque{{ bankName }}
ID Utilisateur{{ userId }}
ID Partenaire{{ partnerId }}
+
+
+

Clé de chiffrement publique (E002)

+

Exposant ({{ keyExponentBits E002 }} Bit):

+

+ {{ keyExponent E002 }} +

+

Modulo ({{ keyModulusBits E002 }} Bit):

+

+ {{ keyModulus E002 }} +

+

Hash (SHA-256):

+

+ {{ sha256 E002 }} +

+

Je confirme par la présente les clés publiques ci-dessus.

+
+
+
+
+ + + + + + + + + + + +
___________________________________________________________________________
Lieu/DateNom/EntrepriseSignature
+
+ + +