chire: jsdoc

This commit is contained in:
nanov 2019-11-05 05:54:16 +02:00
parent c60fed4d58
commit cf16abc843

View File

@ -13,14 +13,47 @@ const response = require('./middleware/response');
const stringifyKeys = (keys) => { const stringifyKeys = (keys) => {
Object.keys(keys).map((key) => { Object.keys(keys).map((key) => {
keys[key] = keys[key] === null ? null : keys[key].toPem(); keys[key] = keys[key] === null ? null : keys[key].toPem();
return key; return key;
}); });
return JSON.stringify(keys); 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<void>} write - writes the keys to storage
* @property {():Promise<KeysObject>} 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 { module.exports = class Client {
/**
*Creates an instance of Client.
* @param {EbicClientOptions} clientOptions
*/
constructor({ constructor({
url, url,
partnerId, partnerId,