Skip to content

Instantly share code, notes, and snippets.

View mmoehrlein's full-sized avatar
🦄
fabulous

Michael Möhrlein mmoehrlein

🦄
fabulous
View GitHub Profile
@bcnzer
bcnzer / cloudflareworker-verifyjwt.js
Last active July 2, 2024 10:18
Sample Cloudflare worker that gets the JWT, ensures it hasn't expired, decrypts it and returns a result
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
// Following code is a modified version of that found at https://blog.cloudflare.com/dronedeploy-and-cloudflare-workers/
/**
* Fetch and log a request
* @param {Request} request
*/
@bradtraversy
bradtraversy / webdev_online_resources.md
Last active July 10, 2024 06:26
Online Resources For Web Developers (No Downloading)
@RobK
RobK / core.js
Last active January 28, 2022 10:03
NodeJS example code to generate a RFC 2104 compliant HMAC
var crypto = require("crypto");
/**
* Get the signature/digest of a supplied input string
* @param data [Required] The String to encode
* @param awsSecretKey [Required] Secret key shared with Amazon
* @param algorithm [Optional] Encryption algorithm, defaults to sha256
* @param encoding [Optional] The output encoding. Default to base64
* @returns Str with encoded digest of the input string
*/
function generateHmac (data, awsSecretKey, algorithm, encoding) {