Update API

This commit is contained in:
Hoang Huu
2019-10-12 09:59:54 +07:00
parent e7b240ef66
commit 82e5de4919
6 changed files with 26 additions and 885 deletions

View File

@@ -95,3 +95,26 @@ function opalestate_api_get_property_data( $property_info ) {
return apply_filters( 'opalestate_api_properties_property', $property );
}
/**
* Generate a rand hash.
*
* @return string
*/
function opalestate_rand_hash() {
if ( ! function_exists( 'openssl_random_pseudo_bytes' ) ) {
return sha1( wp_rand() );
}
return bin2hex( openssl_random_pseudo_bytes( 20 ) ); // @codingStandardsIgnoreLine
}
/**
* Opalestate API - Hash.
*
* @param string $data Message to be hashed.
* @return string
*/
function opalestate_api_hash( $data ) {
return hash_hmac( 'sha256', $data, 'opalestate-api' );
}