Merge branch 'Development' into 6715-change-sastoken-to-oauth

This commit is contained in:
2021-11-18 10:25:47 +00:00
35 changed files with 988 additions and 870 deletions
+14 -14
View File
@@ -105,12 +105,9 @@ const DocumentDetails = (props) => {
>
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
<a
href={
"/api/proxy/documents/download/" +
encryptDocReference(
detailsObj.pinswg_isharedocumentreference
)
}
href={encryptDocReference(
detailsObj.pinswg_isharedocumentreference
)}
>
<span className="results-visually-hidden">
{t(
@@ -194,15 +191,18 @@ const DocumentDetails = (props) => {
);
};
const encryptDocReference = (documentRef) => {
var encrypted = encodeURIComponent(
CryptoJS.AES.encrypt(
documentRef,
process.env.NEXT_PUBLIC_ISHARESECRETPHRASE
)
);
const WORDKEY = process.env.NEXT_PUBLIC_HASHKEY;
return encrypted;
const encryptDocReference = (documentRef) => {
var hashlink = CryptoJS.HmacSHA256(
"documents/download/" + documentRef,
CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString(CryptoJS.enc.Hex);
return (
"/api/proxy/documents/download/" + documentRef + "?hash=" + hashlink
);
};
useEffect(() => {