Skip to content

Instantly share code, notes, and snippets.

@yippeykeiyay
yippeykeiyay / powerShellApiKeySigning.ps1
Created May 25, 2021 10:40
PowerShell public & private key hash
# Thanks to Khuong Phan - duykhuongkid@gmail.com - for providing this example.
# Provided public and private keys
$publicKey = 'xxxxxxxxxxx';
$privateKey = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy';
# Unix timestamp
$unixTime=[int][double]::Parse($(Get-Date -date (Get-Date).ToUniversalTime()-uformat %s))
# Capture the time and package with public key
@yippeykeiyay
yippeykeiyay / phpApiKeySigning.php
Last active May 25, 2021 16:34
PHP public & private key hash
<?php
// Set timezone to UTC
date_default_timezone_set('UTC');
// Provided public and private keys
$publicKey = 'put-your-public-key';
$privateKey = 'put-your-private-key-here';
// Capture the time and package with the public key
@yippeykeiyay
yippeykeiyay / postmanApiKeySigning.js
Last active May 25, 2021 16:25
Postman public & private key hash
/**
* Place this in your Pre-request Script section of your Postman calls to the RapidSpike API.
*
* Then add this query string to your request URLs: `?public_key={{publicKey}}&time={{unixTime}}&signature={{signature}}`
*/
var publicKey = 'put-your-public-key';
var privateKey = 'put-your-private-key-here';
var unixTime = Math.floor(Date.now() / 1000);
@yippeykeiyay
yippeykeiyay / rs_auth.php
Last active March 30, 2020 14:48
RapidSpike API - Authentication Example (PHP)
<?php
// Set timezone to UTC
date_default_timezone_set('UTC');
function rapidspike_api_call($uri, $public_key, $private_key)
{
$url = sprintf('https://api.rapidspike.com/v1%s?', $uri);
$now = time();
@yippeykeiyay
yippeykeiyay / rs_auth.py
Last active March 30, 2020 14:49
RapidSpike API - Authentication Example (Python)
#!/usr/bin/python
import hashlib
import hmac
import base64
import time
import requests
import logging
logger = logging.getLogger(__name__)