Skip to content

Instantly share code, notes, and snippets.

View linkinmedo's full-sized avatar

Mohammed Shammout linkinmedo

View GitHub Profile

Front-end Assignment

Github Repos Compare

⚠️
Please carefully read the full document before you start working

Problem statement

Create an application that helps users find public repositories hosted on Github and compare their stats.

@linkinmedo
linkinmedo / fb_decode.js
Created July 21, 2018 18:28
Decode Facebook signed_request with NodeJS 8+
function parse_signed_request(signed_request, secret) {
const encoded_data = signed_request.split(".",2);
// decode the data
const sig = encoded_data[0];
let buffer = new Buffer(encoded_data[1], "base64");
const json = buffer.toString("ascii");
const data = JSON.parse(json); // ERROR Occurs Here!
// check algorithm - not relevant to error
if (!data.algorithm || data.algorithm.toUpperCase() != "HMAC-SHA256") {