From cf16abc8435d2f624458ba3d1fbffc5d73fc6013 Mon Sep 17 00:00:00 2001 From: nanov Date: Tue, 5 Nov 2019 05:54:16 +0200 Subject: [PATCH] chire: jsdoc --- lib/Client.js | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/lib/Client.js b/lib/Client.js index d4babf4..ace9595 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -13,14 +13,47 @@ const response = require('./middleware/response'); const stringifyKeys = (keys) => { Object.keys(keys).map((key) => { keys[key] = keys[key] === null ? null : keys[key].toPem(); - return key; }); return JSON.stringify(keys); }; +/** + * Keys persistent object + * @typedef {Object} KeysObject + * @property {string} A006 - PEM representation of the A006 private key + * @property {string} E002 - PEM representation of the E002 private key + * @property {string} X002 - PEM representation of the X002 private key + * @property {string} bankX002 - PEM representation of the bankX002 public key + * @property {string} bankE002 - PEM representation of the bankE002 public key + */ + +/** + * Key storage implementation + * @typedef {Object} KeyStorage + * @property {(data: KeysObject):Promise} write - writes the keys to storage + * @property {():Promise} read - reads the keys from storage + */ + +/** + * Client initilization options + * @typedef {Object} EbicClientOptions + * @property {string} url - EBICS URL provided by the bank + * @property {string} partnerId - PARTNERID provided by the bank + * @property {string} hostId - HOSTID provided by the bank + * @property {string} userId - USERID provided by the bank + * @property {string} passphrase - passphrase for keys encyprion + * @property {KeyStorage} keyStorage - keyStorage implementation + * @property {object} [tracesStorage] - traces (logs) storage implementation + */ + + module.exports = class Client { + /** + *Creates an instance of Client. + * @param {EbicClientOptions} clientOptions + */ constructor({ url, partnerId,