diff options
author | Marius David Wieschollek <passwords.public@mdns.eu> | 2021-01-09 21:09:13 +0300 |
---|---|---|
committer | Marius David Wieschollek <passwords.public@mdns.eu> | 2021-01-09 21:09:13 +0300 |
commit | 1a3aa9cd1e33aa4394061601414ed4b99da88c6f (patch) | |
tree | 13f42b796e73f9510ec15a075f730e59ed955a73 | |
parent | 8d2e0e60dd6b1d033513b63ba2b0d7e2cde7a77a (diff) |
Use client instead of api
Signed-off-by: Marius David Wieschollek <passwords.public@mdns.eu>
-rw-r--r-- | src/Converter/AbstractConverter.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Converter/AbstractConverter.js b/src/Converter/AbstractConverter.js index 3b471bf..0e6536b 100644 --- a/src/Converter/AbstractConverter.js +++ b/src/Converter/AbstractConverter.js @@ -7,7 +7,7 @@ export default class AbstractConverter { * @param {String} type */ constructor(api, type) { - this._api = api; + this._client = api; this._type = type; } @@ -63,7 +63,7 @@ export default class AbstractConverter { * @return {*} */ makeModel(properties) { - return this._api.getClass(`model.${this._type}`, properties, this._api); + return this._client.getClass(`model.${this._type}`, properties); } /** @@ -74,9 +74,9 @@ export default class AbstractConverter { async fromEncryptedData(data) { if(data.hasOwnProperty('cseType')) { if(data.cseType === 'CSEv1r1') { - data = await this._api.getCseV1Encryption().decrypt(data, this._type); + data = await this._client.getCseV1Encryption().decrypt(data, this._type); } else if(data.cseType !== 'none') { - throw this._api.getClass('exception.encryption.unsupported', data, 'CSEv1r1'); + throw this._client.getClass('exception.encryption.unsupported', data, 'CSEv1r1'); } } @@ -92,14 +92,14 @@ export default class AbstractConverter { let data = await this.toObject(model); if(data.cseType === 'none') { - return await this._api.getInstance('encryption.none').encrypt(data, this._type); + return await this._client.getInstance('encryption.none').encrypt(data, this._type); } if(data.cseType === 'CSEv1r1') { - return await this._api.getCseV1Encryption().encrypt(data, this._type); + return await this._client.getCseV1Encryption().encrypt(data, this._type); } - return await this._api.getDefaultEncryption().encrypt(data, this._type); + return await this._client.getDefaultEncryption().encrypt(data, this._type); } /** |