diff options
author | Marius David Wieschollek <passwords.public@mdns.eu> | 2020-12-23 13:43:20 +0300 |
---|---|---|
committer | Marius David Wieschollek <passwords.public@mdns.eu> | 2020-12-23 13:43:20 +0300 |
commit | 6d6ed84908c2f95ce981d813bab405d43b4f1e5a (patch) | |
tree | ceab2320466e01042fec3eee4abf745f42189a12 | |
parent | 72e4bd842e755ef565351aa1f5d5a8475c931ec5 (diff) |
Use exceptions in noencryption
Signed-off-by: Marius David Wieschollek <passwords.public@mdns.eu>
-rw-r--r-- | src/Encryption/CSEv1Encryption.js | 1 | ||||
-rw-r--r-- | src/Encryption/NoEncryption.js | 13 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/Encryption/CSEv1Encryption.js b/src/Encryption/CSEv1Encryption.js index efe772b..06e5891 100644 --- a/src/Encryption/CSEv1Encryption.js +++ b/src/Encryption/CSEv1Encryption.js @@ -29,7 +29,6 @@ export default class CSEv1Encryption { } /** - * * @returns {Boolean} */ enabled() { diff --git a/src/Encryption/NoEncryption.js b/src/Encryption/NoEncryption.js index 42077d1..37d7780 100644 --- a/src/Encryption/NoEncryption.js +++ b/src/Encryption/NoEncryption.js @@ -1,7 +1,13 @@ export default class NoEncryption { /** - * + * @param {BasicClassLoader} classLoader + */ + constructor(classLoader) { + this._classLoader = classLoader; + } + + /** * @returns {Promise<Boolean>} */ async ready() { @@ -9,10 +15,9 @@ export default class NoEncryption { } /** - * * @returns {Boolean} */ - async enabled() { + enabled() { return true; } @@ -37,7 +42,7 @@ export default class NoEncryption { * @returns {Object} */ async decrypt(object, type) { - if(object.cseType !== 'none') throw new Error('Unsupported encryption type'); + if(object.cseType !== 'none') throw this._classLoader.getClass('exception.encryption.unsupported', object, 'none'); return object; } }
\ No newline at end of file |