Skip to content

Commit

Permalink
Merge pull request #2 from nomasi/feature-add-clientkey
Browse files Browse the repository at this point in the history
Add clientKey (sha256 hash of api key) to the public sizeme_options
  • Loading branch information
nomasi authored Jan 30, 2019
2 parents 51677e7 + 582cbbe commit 6c1b04d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
18 changes: 16 additions & 2 deletions sizeme-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @wordpress-plugin
* Plugin Name: SizeMe for WooCommerce
* Description: SizeMe is a web store plugin that enables your consumers to input their measurements and get personalised fit recommendations based on actual product data.
* Version: 2.0.0
* Version: 2.0.1
* Author: SizeMe Ltd
* Author URI: https://www.sizeme.com/
* Text Domain: sizeme
Expand Down Expand Up @@ -50,7 +50,7 @@ class WC_SizeMe_for_WooCommerce {
*
* @var string VERSION The plugin version.
*/
const VERSION = '2.0.0';
const VERSION = '2.0.1';

/**
* Minimum WordPress version this plugin works with, used for dependency checks.
Expand Down Expand Up @@ -323,6 +323,20 @@ public function get_service_status() {
}


/**
* Get the the client key which is a hash of the super-secret api key
*
* Gets the hashed key.
*
* @since 2.0.1
*
* @return string The hashed key.
*/
public function get_client_key() {
return hash( 'sha256', get_option( self::API_KEY ) );
}


/**
* Get the toggler boolean state.
*
Expand Down
1 change: 1 addition & 0 deletions templates/sizeme-product.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
service_status: "<?php echo esc_js( $sizeme->get_service_status() ); ?>",
pluginVersion: "WC-<?php echo WC_VERSION; ?>",
shopType: "woocommerce",
clientKey: "<?php echo esc_js( $sizeme->get_client_key() ); ?>",
uiOptions: {}
};

Expand Down

0 comments on commit 6c1b04d

Please sign in to comment.