Last active
December 21, 2015 18:18
-
-
Save jamsesso/a5f57d1a6e9deba8f2d9 to your computer and use it in GitHub Desktop.
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
create_signature(payload, type, timestamp, public_key, secret_key) { | |
signature = sprintf("payload=%s&public_key=%s×tamp=%s&type=%s", | |
url_encode(payload), | |
url_encode(public_key), | |
url_encode(timestamp), | |
url_encode(type)) | |
return hmac_sha256(signature, secret_key) | |
} | |
create_message(payload, type, timestamp, public_key, secret_key) { | |
message.payload = payload | |
message.type = type | |
message.timestamp = timestamp | |
message.public_key = public_key | |
message.signature = create_signature(payload, type, timestamp, public_key, secret_key) | |
return message | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment