diff --git a/sign_demo.php b/sign_demo.php index 9797a88..732da8f 100644 --- a/sign_demo.php +++ b/sign_demo.php @@ -1,37 +1,76 @@ -
'. - 'id (your client id):
'. - 'otp:
'. - ''. - ''; - exit; +if ($act == 'sign_req') { + $id = getHttpVal('id', ''); + $otp = getHttpVal('otp', ''); + $t = getHttpVal('t', ''); + $apiKey = base64_decode(getHttpVal('apikey', '')); + + $a['id'] = $id; + $a['otp'] = $otp; + + if ($t != '') { + $a['t'] = $t; + } + + $hmac = sign($a, $apiKey, true); + +// echo 'Test submit the request >> '; + +} else if ($act == 'sign_resp') { + $status = getHttpVal('status', ''); + $t = getHttpVal('t', ''); + $info = getHttpVal('info', ''); + $apiKey = base64_decode(getHttpVal('apikey', '')); + + $a['status'] = $status; + $a['t'] = $t; + + if ($info != '') { + $a['info'] = $info; + } + + $hmac = sign($a, $apiKey, true); } -$id = getHttpVal('id', ''); -$otp = getHttpVal('otp', ''); -$t = getHttpVal('t', ''); -$apiKey = base64_decode(getHttpVal('apikey', '')); +echo '
Generate a request signature'. + ''. + ' | ';
-$a['id']=$id;
-$a['otp']=$otp;
-
-if ($t != '') {
- $a['t']=$t;
-}
-
-$hmac = sign($a, $apiKey, true);
+echo 'Generate a response signature'. + ''. + ' |