diff --git a/.env.local b/.env.local index f0006e64..c448df58 100644 --- a/.env.local +++ b/.env.local @@ -33,4 +33,6 @@ I18N_DOMAIN = "cymru.local" GOOGLE_TAG_MANAGER = GTM-T78CBC3 SHOWLOGIN = "false" SHOWREPRESENTATIONS = "false" -BASIC_AUTH_CREDENTIALS,,= pinswg:password|pinswg2:password2 \ No newline at end of file +BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2 + +NEXT_PUBLIC_ISHARESECRETPHRASE = "Secret phrase" \ No newline at end of file diff --git a/components/case/documents.js b/components/case/documents.js index 58ca608c..90178c57 100644 --- a/components/case/documents.js +++ b/components/case/documents.js @@ -7,6 +7,7 @@ import { useDispatch, useSelector, shallowEqual, connect } from "react-redux"; import transLookup from "../../data/lookuptranslations.json"; import PaginationControl from "./pagination"; import LoadingOverlay from "react-loading-overlay"; +import CryptoJS from "crypto-js"; import { getBasicSearch, @@ -106,7 +107,9 @@ const DocumentDetails = (props) => { @@ -191,6 +194,17 @@ const DocumentDetails = (props) => { ); }; + const encryptDocReference = (documentRef) => { + var encrypted = encodeURIComponent( + CryptoJS.AES.encrypt( + documentRef, + process.env.NEXT_PUBLIC_ISHARESECRETPHRASE + ) + ); + + return encrypted; + }; + useEffect(() => { const docDetailsObj = async () => { let docObj = await getSearchDocumentDetails1(incidentid)