This file contains 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
var http = require('https'); | |
// Create Slack channel -> Slack URL mapping | |
// This incoming webhook URL is provided when adding a Slack integration | |
var config = { | |
'#mychannel': 'https://hooks.slack.com/services/YOUR/SLACK/HOOK_HERE', | |
}; | |
/* | |
Convenience method to fetch the channel's URL |
This file contains 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
<?php | |
// DEFINE our cipher | |
define('AES_256_CBC', 'aes-256-cbc'); | |
// Generate a 256-bit encryption key | |
// This should be stored somewhere instead of recreating it each time | |
$encryption_key = openssl_random_pseudo_bytes(32); | |
// Generate an initialization vector | |
// This *MUST* be available for decryption as well |
This file contains 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
var crypto = require('crypto'); | |
// Added for safer string equality checking | |
var bufferEq = require('buffer-equal-constant-time'); | |
var url = require('url'); | |
var SHARED_SECRET = "sup3rs3cr3t!!"; | |
function verifySignature(string_to_sign, signature, shared_secret) { | |
var hmac = crypto.createHmac('sha512', shared_secret); | |
hmac.write(string_to_sign); | |
hmac.end() |
This file contains 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
var crypto = require('crypto'); | |
var SHARED_SECRET = "sup3rs3cr3t!!"; | |
function signString(string_to_sign, shared_secret) { | |
var hmac = crypto.createHmac('sha512', shared_secret); | |
hmac.write(string_to_sign); | |
hmac.end() | |
return hmac.read(); | |
} |
This file contains 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
<?php | |
define("SHARED_SECRET", "sup3rs3cr3t!!"); | |
if(!function_exists('hash_equals')) { | |
function hash_equals($str1, $str2) { | |
// Run constant-time comparison for PHP < 5.6 which doesn't support hmac_equals | |
$str1_len = strlen($str1); | |
$str2_len = strlen($str2); |
This file contains 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
<?php | |
define("SHARED_SECRET", "sup3rs3cr3t!!"); | |
function signString($string_to_sign, $shared_secret) { | |
return hash_hmac("sha512", $string_to_sign, $shared_secret); | |
} | |
$payload = array( |
This file contains 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
require 'digest' | |
require 'base64' | |
require 'cgi' | |
require 'uri' | |
require 'time' | |
require 'openssl' | |
require 'json' | |
require 'active_support/security_utils' | |
SHARED_SECRET = 'sup3rs3cr3t!!' |
This file contains 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
require 'digest' | |
require 'base64' | |
require 'cgi' | |
require 'time' | |
require 'openssl' | |
require 'json' | |
SHARED_SECRET = 'sup3rs3cr3t!!' | |
def signString(string_to_sign, shared_secret) |
This file contains 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, hashlib, json, time, base64, urlparse | |
SHARED_SECRET = 'sup3rs3cr3t!!' | |
def verifySignature(string_to_verify, signature, shared_secret): | |
return ct_compare(hmac.new(shared_secret, | |
string_to_verify, hashlib.sha512).digest(), signature) | |
def verifyTime(decoded_json): | |
j = json.loads(decoded_json) |
This file contains 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, hashlib, json, time, base64 | |
SHARED_SECRET = 'sup3rs3cr3t!!' | |
def signString(string_to_sign, shared_secret): | |
return hmac.new(shared_secret, string_to_sign, hashlib.sha512).digest() | |
if __name__ == '__main__': | |
payload = { | |
'name': 'joe smith', |
NewerOlder