Skip to content

Instantly share code, notes, and snippets.

@jamsesso
Last active December 21, 2015 18:18
Show Gist options
  • Save jamsesso/a5f57d1a6e9deba8f2d9 to your computer and use it in GitHub Desktop.
Save jamsesso/a5f57d1a6e9deba8f2d9 to your computer and use it in GitHub Desktop.
create_signature(payload, type, timestamp, public_key, secret_key) {
signature = sprintf("payload=%s&public_key=%s&timestamp=%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