X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Futils%2FCrypto.js;h=91b67996dc1ae32315a793798eab2c5eaf9fe2d0;hb=refs%2Fheads%2Fmaster;hp=7f9408e68e6df801c181fc5c112806edf829b57f;hpb=1580adb8ab521e55a129afc32693071620d85c02;p=aai%2Fsparky-fe.git diff --git a/src/utils/Crypto.js b/src/utils/Crypto.js index 7f9408e..91b6799 100644 --- a/src/utils/Crypto.js +++ b/src/utils/Crypto.js @@ -2,8 +2,8 @@ * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017 Amdocs + * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2018 Amdocs * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,15 +17,13 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ /** * Created by salmaat on 7/13/2017. */ import CryptoJS from 'crypto-js'; -var key = 'key2017'; +const key = 'key2017'; function encrypt(text) { var encrypted = CryptoJS.AES.encrypt(text, key); @@ -37,8 +35,17 @@ function decrypt(text) { return decrypted.toString(CryptoJS.enc.Utf8); } +function encode(phrase) { + return CryptoJS.enc.Utf16.parse(phrase); +} + +function decode(encodedPhrase) { + return CryptoJS.enc.Utf16.stringify(encodedPhrase); +} module.exports = { encrypt: encrypt, - decrypt: decrypt + decrypt: decrypt, + encode: encode, + decode: decode };