Skip to content

Instantly share code, notes, and snippets.

View tcollins's full-sized avatar
👨‍🔧
...

Tim Collins tcollins

👨‍🔧
...
View GitHub Profile
@igorrendulic
igorrendulic / MailGun.java
Created December 3, 2017 22:17
MailGun Webhook Signature Validation
private static final key = "mailgun_key"
public static boolean isSignatureValid(String token , long timestamp, String signature) {
try {
Mac hmac = Mac.getInstance("HmacSHA256");
SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(), "HmacSHA256");
hmac.init(signingKey);
String signed = Hex.encodeHexString(hmac.doFinal((timestamp + token).getBytes()));
if (signed.equals(signature)) {
return true;
}
@imjasonh
imjasonh / markdown.css
Last active November 6, 2024 14:26
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}