Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.mdns.eu/nextcloud/passwords-client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/Encryption/NoEncryption.js')
-rw-r--r--src/Encryption/NoEncryption.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/Encryption/NoEncryption.js b/src/Encryption/NoEncryption.js
new file mode 100644
index 0000000..37d7780
--- /dev/null
+++ b/src/Encryption/NoEncryption.js
@@ -0,0 +1,48 @@
+export default class NoEncryption {
+
+ /**
+ * @param {BasicClassLoader} classLoader
+ */
+ constructor(classLoader) {
+ this._classLoader = classLoader;
+ }
+
+ /**
+ * @returns {Promise<Boolean>}
+ */
+ async ready() {
+ return true;
+ }
+
+ /**
+ * @returns {Boolean}
+ */
+ enabled() {
+ return true;
+ }
+
+ /**
+ * Encrypts an object
+ *
+ * @param {Object} object
+ * @param {String} type
+ * @returns {Object}
+ */
+ async encrypt(object, type) {
+ object.cseType = 'none';
+ object.cseKey = '';
+ return object;
+ }
+
+ /**
+ * Decrypts an object
+ *
+ * @param {Object} object
+ * @param {String} type
+ * @returns {Object}
+ */
+ async decrypt(object, type) {
+ if(object.cseType !== 'none') throw this._classLoader.getClass('exception.encryption.unsupported', object, 'none');
+ return object;
+ }
+} \ No newline at end of file