Upload index.html
Browse files- index.html +4 -3
index.html
CHANGED
|
@@ -5,6 +5,7 @@
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Dynamic Component Factory - OpenPlatform</title>
|
| 7 |
<script src="https://cdn.componentator.com/total4.js/4.0.0/total4.js"></script>
|
|
|
|
| 8 |
<style>
|
| 9 |
body {
|
| 10 |
margin: 0;
|
|
@@ -117,7 +118,7 @@
|
|
| 117 |
const [tokenUrl, signature] = data;
|
| 118 |
|
| 119 |
// Verify signature
|
| 120 |
-
const expectedSignature = (tokenUrl + REQ_TOKEN).
|
| 121 |
if (expectedSignature !== signature) {
|
| 122 |
throw new Error('Invalid signature');
|
| 123 |
}
|
|
@@ -125,7 +126,7 @@
|
|
| 125 |
console.log('Signature verified');
|
| 126 |
|
| 127 |
// Sign the response
|
| 128 |
-
const responseSignature = (signature + RES_TOKEN).
|
| 129 |
|
| 130 |
// Get user profile
|
| 131 |
const response = await fetch(tokenUrl, {
|
|
@@ -171,7 +172,7 @@
|
|
| 171 |
|
| 172 |
try {
|
| 173 |
const notifyUrl = userProfile.notify;
|
| 174 |
-
const signature = ((notifyUrl + REQ_TOKEN)
|
| 175 |
|
| 176 |
const notification = {
|
| 177 |
body: message,
|
|
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Dynamic Component Factory - OpenPlatform</title>
|
| 7 |
<script src="https://cdn.componentator.com/total4.js/4.0.0/total4.js"></script>
|
| 8 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
|
| 9 |
<style>
|
| 10 |
body {
|
| 11 |
margin: 0;
|
|
|
|
| 118 |
const [tokenUrl, signature] = data;
|
| 119 |
|
| 120 |
// Verify signature
|
| 121 |
+
const expectedSignature = CryptoJS.MD5(tokenUrl + REQ_TOKEN).toString();
|
| 122 |
if (expectedSignature !== signature) {
|
| 123 |
throw new Error('Invalid signature');
|
| 124 |
}
|
|
|
|
| 126 |
console.log('Signature verified');
|
| 127 |
|
| 128 |
// Sign the response
|
| 129 |
+
const responseSignature = CryptoJS.MD5(signature + RES_TOKEN).toString();
|
| 130 |
|
| 131 |
// Get user profile
|
| 132 |
const response = await fetch(tokenUrl, {
|
|
|
|
| 172 |
|
| 173 |
try {
|
| 174 |
const notifyUrl = userProfile.notify;
|
| 175 |
+
const signature = CryptoJS.MD5((notifyUrl + REQ_TOKEN) + RES_TOKEN).toString();
|
| 176 |
|
| 177 |
const notification = {
|
| 178 |
body: message,
|