Skip to content

Instantly share code, notes, and snippets.

@m0freak
Created December 29, 2021 21:26
Show Gist options
  • Save m0freak/544d8b1fe7c87f3b32b4ce672ce1aa01 to your computer and use it in GitHub Desktop.
Save m0freak/544d8b1fe7c87f3b32b4ce672ce1aa01 to your computer and use it in GitHub Desktop.
creating sms auth token
<?php
//timestamp of when sms is sent in UTC+0
$x_timestamp = "2021-11-03T06:17:41.883Z";
//set to the same value as reference in the payload
$x_reference = "3fa85f64-5717-4562-b3fc-2c963f66afa6";
//data to use to generate the sms-auth-token
$data = $x_timestamp . $x_reference;
//set to the secret that must have been shared between the 2 parties
$secret = "-very-secret-string-";
//sample of the x-auth-token
printf("sms-auth-token: %s", base64_encode(hash_hmac('sha512', $data, $secret, true)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment