Created wc_api_hash()
This commit is contained in:
parent
3697ad9de2
commit
3f45c874fe
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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' );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue