Created wc_api_hash()

This commit is contained in:
Claudio Sanches 2015-06-08 12:57:19 -03:00
parent 3697ad9de2
commit 3f45c874fe
3 changed files with 15 additions and 4 deletions

View File

@ -220,8 +220,8 @@ class WC_Admin_API_Keys {
'user_id' => $user_id,
'description' => $description,
'permissions' => $permissions,
'consumer_key' => $consumer_key,
'consumer_secret' => $consumer_secret
'consumer_key' => wc_api_hash( $consumer_key ),
'consumer_secret' => wc_api_hash( $consumer_secret )
),
array(
'%d',

View File

@ -203,8 +203,8 @@ class WC_Auth {
'user_id' => $user->ID,
'description' => $description,
'permissions' => $permissions,
'consumer_key' => $consumer_key,
'consumer_secret' => $consumer_secret
'consumer_key' => wc_api_hash( $consumer_key ),
'consumer_secret' => wc_api_hash( $consumer_secret )
),
array(
'%d',

View File

@ -817,3 +817,14 @@ function wc_rand_hash() {
return sha1( wp_rand() );
}
}
/**
* WC API - Hash
*
* @since 2.4.0
* @param string $data
* @return string
*/
function wc_api_hash( $data ) {
return hash_hmac( 'sha256', $data, 'wc-api' );
}