Code Review
/
aai
/
sparky-fe.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
increasing test coverage to 20 percent
[aai/sparky-fe.git]
/
src
/
utils
/
Crypto.js
diff --git
a/src/utils/Crypto.js
b/src/utils/Crypto.js
index
7f9408e
..
91b6799
100644
(file)
--- a/
src/utils/Crypto.js
+++ b/
src/utils/Crypto.js
@@
-2,8
+2,8
@@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
* ============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.
* ================================================================================
* 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=========================================================
* 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';
*/
/**
* 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);
function encrypt(text) {
var encrypted = CryptoJS.AES.encrypt(text, key);
@@
-37,8
+35,17
@@
function decrypt(text) {
return decrypted.toString(CryptoJS.enc.Utf8);
}
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,
module.exports = {
encrypt: encrypt,
- decrypt: decrypt
+ decrypt: decrypt,
+ encode: encode,
+ decode: decode
};
};