summaryrefslogtreecommitdiffstats
path: root/src/utils/Crypto.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/Crypto.js')
-rw-r--r--src/utils/Crypto.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/utils/Crypto.js b/src/utils/Crypto.js
new file mode 100644
index 0000000..c2b34a0
--- /dev/null
+++ b/src/utils/Crypto.js
@@ -0,0 +1,22 @@
+/**
+ * Created by salmaat on 7/13/2017.
+ */
+import CryptoJS from 'crypto-js';
+
+var key = 'key2017';
+
+function encrypt(text) {
+ var encrypted = CryptoJS.AES.encrypt(text, key);
+ return encrypted.toString().split('/').join('*');
+}
+
+function decrypt(text) {
+ var decrypted = CryptoJS.AES.decrypt(text.split('*').join('/'), key);
+ return decrypted.toString(CryptoJS.enc.Utf8);
+}
+
+
+module.exports = {
+ encrypt: encrypt,
+ decrypt: decrypt
+};