Skip to content

Instantly share code, notes, and snippets.

@m0freak
m0freak / sms_auth_token.php
Created December 29, 2021 21:26
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;
<?php
//set to the timestamp exactly the same as that provided in the request payload
$data = "2021-11-03T06:17:41.883Z";
//set to the secret that must have been shared between the 2 parties
$secret = "-very-secret-string-";
//sample of the x-auth-token
printf("x-auth-token: %s", base64_encode(hash_hmac('sha512', $data, $secret, true)));
@m0freak
m0freak / RsaSignature.php
Created May 17, 2018 10:32
Generate a data Signature using PHP and OPENSSL
<?php
$priv_key = file_get_contents("./key.pem");
$pkeyid = openssl_get_privatekey($priv_key);
$date_time="2016-06-01 12:00:00";
$amount="1000";
$narrative="Test transaction";
$network_ref="1000100";