This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require("fs"); | |
| const useragentFromSeed = require("useragent-from-seed"); | |
| const axios = require("axios").default; | |
| function getString(start, end, all) { | |
| const regex = new RegExp(`${start}(.*?)${end}`); | |
| const str = all; | |
| const result = regex.exec(str); | |
| return result[1]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import hmac | |
| import hashlib | |
| import base64 | |
| SECRET = '1d5131dc63a6ceeea91ccf62eef2e74a8d618205aae030b1326bf4c9d0589a68' | |
| data = '{"id":820982911946154508,"email":"jon@doe.ca","closed_at":null,"created_at":"2020-07-28T06:50:28-04:00","updated_at":"2020-07-28T06:50:28-04:00","number":234,"note":null,"token":"123456abcd","gateway":null,"test":true,"total_price":"254.98","subtotal_price":"244.98","total_weight":0,"total_tax":"0.00","taxes_included":false,"currency":"EUR","financial_status":"voided","confirmed":false,"total_discounts":"5.00","total_line_items_price":"249.98","cart_token":null,"buyer_accepts_marketing":true,"name":"#9999","referring_site":null,"landing_site":null,"cancelled_at":"2020-07-28T06:50:28-04:00","cancel_reason":"customer","total_price_usd":null,"checkout_token":null,"reference":null,"user_id":null,"location_id":null,"source_identifier":null,"source_url":null,"processed_at":null,"device_id":null,"phone":null,"customer_locale":"en","app_id":null,"browser_ip":null,"landing_site_ref":null,"order |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const crypto = require('crypto') | |
| const SECRET = '1d5131dc63a6ceeea91ccf62eef2e74a8d618205aae030b1326bf4c9d0589a68' | |
| const verifyHmac = (body, hmac) => { | |
| const hash = crypto | |
| .createHmac("sha256", SECRET) | |
| .update(Buffer.from(body)) | |
| .digest("base64"); |