-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
encoding support in crypto #1770
Comments
Hi @kokokenada, From my quick glance at the code - your suggestion seems correct. I have to check but input likely is the utf16 encoding of the string that you provide. The following script: import crypto from "k6/crypto";
function encode(input) {
let hasher = crypto.createHMAC('sha256', 'secret');
hasher.update(input);
return hasher.digest('base64')
}
export default function() {
var input = "тайна"
console.log(input);
console.log(encode(input));
input = unescape(encodeURIComponent(input));
console.log(input);
console.log(encode(input));
} seems to generate different outputs if the input is not just ascii symbols.
So the hack proposed here seems to work in k6 as well. If this doesn't work can you provide us with a complete example with inputs and desired output for both nodejs and k6. Obviously don't use the real secret ;) I am not certain anyone will have time to look into this during the holidays and the crypto package is ... mostly shelved for now as k6 did not have good binary data support and now that goja has typed arrays there are a lot of other parts that also need to get updated and so I can't even tell you if the crypto package won't be completely rewritten with a different API in the future. |
Thanks for the reply. Here's what I see in K6 sending the post:
And here's what I see on the server:
Oh - and thanks for the work around suggestion. I did try it to no effect |
Hi @kokokenada, sorry for the late reply. I did a lot of testing including using python3 as an arbiter on what is ... right and ... it seems like your example above compares two different payloads - the one on the server and the one in k6 do not match, but if they do it gets the same hash so 🎉 Also hmac.update takes only 2 parameters and the second is ignored (of course) if a string is provided. |
Hm on second check, it seems to me that ... through some reflect magic that actually goja checks if the exportable type of the goja string, which is golang string, can be assigned to But more importantly, it does mean that we go from utf16 to utf8 when we Export the goja String to a golang string and then we go from the golang string to So I don't know what exactly happens above with my hack, but it seems like it isn't needed and all my checks show that crypto seems to work the same between nodejs and k6 for string inputs. And python seems to suggest my test are right. @kokokenada have you been able to reproduce some difference as running: var crypto = require("crypto");
var a = {
"alg": "sha256",
"secret": "test_secret",
"payload": "{\"id\":2639876882543,\"contact_email\":\"params.email\",\"email\":\"substemail\",\"note_attributes\":[{\"name\":\"brandId\",\"value\":\"at\"},{\"name\":\"branchId\",\"value\":\"ken-dev-load\"}],\"closed_at\":null,\"created_at\":\"2020-12-09T12:36:43-05:00\",\"updated_at\":\"2020-12-09T12:36:44-05:00\",\"number\":60,\"note\":null,\"token\":\"eb6545d8122eac2b8dd5a523c53f7301\",\"gateway\":null,\"test\":false,\"total_price\":\"0.00\",\"subtotal_price\":\"0.00\",\"total_weight\":0,\"total_tax\":\"0.00\",\"taxes_included\":false,\"currency\":\"CAD\",\"financial_status\":\"paid\",\"confirmed\":true,\"total_discounts\":\"0.00\",\"total_line_items_price\":\"0.00\",\"cart_token\":\"\",\"buyer_accepts_marketing\":false,\"name\":\"#1060\",\"referring_site\":null,\"landing_site\":\"/api/2020-07/graphql.json\",\"cancelled_at\":null,\"cancel_reason\":null,\"total_price_usd\":\"0.00\",\"checkout_token\":\"76030e1da406faff7bf7f3b2604abab2\",\"reference\":null,\"user_id\":null,\"location_id\":null,\"source_identifier\":null,\"source_url\":null,\"processed_at\":\"2020-12-09T12:36:42-05:00\",\"device_id\":null,\"phone\":null,\"customer_locale\":\"en\",\"app_id\":3122233,\"browser_ip\":\"174.92.136.112\",\"client_details\":{\"accept_language\":null,\"browser_height\":799,\"browser_ip\":\"174.92.136.112\",\"browser_width\":500,\"session_hash\":null,\"user_agent\":\"node-fetch/1.0 (+https://github.com/bitinn/node-fetch)\"},\"landing_site_ref\":null,\"order_number\":1060,\"discount_applications\":[],\"discount_codes\":[],\"payment_gateway_names\":[],\"processing_method\":\"free\",\"checkout_id\":16167784808559,\"source_name\":\"web\",\"fulfillment_status\":null,\"tax_lines\":[],\"tags\":\"\",\"order_status_url\":\"https://watchhabitat.myshopify.com/17684561974/orders/eb6545d8122eac2b8dd5a523c53f7301/authenticate?key=903ec1040dadb781b11801be3220bb77\",\"presentment_currency\":\"CAD\",\"total_line_items_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_discounts_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_shipping_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"subtotal_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_tax_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"line_items\":[{\"id\":5734446137455,\"variant_id\":32086752362607,\"title\":\"Coney Hatch at the Elmo - Oct 3, 2020\",\"quantity\":1,\"sku\":\"\",\"variant_title\":\"\",\"vendor\":\"WatchHabitat\",\"fulfillment_service\":\"manual\",\"product_id\":4566884909167,\"requires_shipping\":false,\"taxable\":true,\"gift_card\":false,\"name\":\"Coney Hatch at the Elmo - Oct 3, 2020\",\"variant_inventory_management\":null,\"properties\":[],\"product_exists\":true,\"fulfillable_quantity\":1,\"grams\":0,\"price\":\"0.00\",\"total_discount\":\"0.00\",\"fulfillment_status\":null,\"price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_discount_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"discount_allocations\":[],\"duties\":[],\"admin_graphql_api_id\":\"gid://shopify/LineItem/5734446137455\",\"tax_lines\":[],\"origin_location\":{\"id\":1418132586550,\"country_code\":\"CA\",\"province_code\":\"ON\",\"name\":\"WatchHabitat\",\"address1\":\"559 College Street\",\"address2\":\"Suite 401\",\"city\":\"Toronto\",\"zip\":\"M6G1A9\"}}],\"fulfillments\":[],\"refunds\":[],\"total_tip_received\":\"0.0\",\"original_total_duties_set\":null,\"current_total_duties_set\":null,\"admin_graphql_api_id\":\"gid://shopify/Order/2639876882543\",\"shipping_lines\":[],\"billing_address\":{\"first_name\":\"Ken\",\"address1\":\"559 College Street, 5th Floor\",\"phone\":null,\"city\":\"Toronto\",\"zip\":\"M6G1A9\",\"province\":\"Ontario\",\"country\":\"Canada\",\"last_name\":\"Ono\",\"address2\":\"\",\"company\":null,\"latitude\":43.6551489,\"longitude\":-79.41220299999999,\"name\":\"Ken Ono\",\"country_code\":\"CA\",\"province_code\":\"ON\"},\"customer\":{\"id\":3486333861999,\"email\":\"params.email\",\"accepts_marketing\":false,\"created_at\":\"2020-12-09T12:36:24-05:00\",\"updated_at\":\"2020-12-09T12:36:43-05:00\",\"first_name\":\"Ken\",\"last_name\":\"Ono\",\"orders_count\":1,\"state\":\"disabled\",\"total_spent\":\"0.00\",\"last_order_id\":2639876882543,\"note\":null,\"verified_email\":true,\"multipass_identifier\":null,\"tax_exempt\":false,\"phone\":null,\"tags\":\"\",\"last_order_name\":\"#1060\",\"currency\":\"CAD\",\"accepts_marketing_updated_at\":\"2020-12-09T12:36:25-05:00\",\"marketing_opt_in_level\":null,\"admin_graphql_api_id\":\"gid://shopify/Customer/3486333861999\",\"default_address\":{\"id\":3743730532463,\"customer_id\":3486333861999,\"first_name\":\"Ken\",\"last_name\":\"Ono\",\"company\":null,\"address1\":\"559 College Street, 5th Floor\",\"address2\":\"\",\"city\":\"Toronto\",\"province\":\"Ontario\",\"country\":\"Canada\",\"zip\":\"M6G1A9\",\"phone\":null,\"name\":\"Ken Ono\",\"province_code\":\"ON\",\"country_code\":\"CA\",\"country_name\":\"Canada\",\"default\":true}}}",
"hash": "3ilgZHvK9U2bjBbT0tSjFPSRSawXZ4+rJRHr3jP9X2I=",
}
var b = { hash:"jeElv6QSAFTU0uPU+K9uBtKc1y8+92z2e/3XFNKuSNA=",
"payload": "{\"id\":2639876882543,\"contact_email\":\"[email protected]\",\"email\":\"[email protected]\",\"note_attributes\":[{\"name\":\"brandId\",\"value\":\"at\"},{\"name\":\"branchId\",\"value\":\"ken-dev-load\"}],\"closed_at\":null,\"created_at\":\"2020-12-09T12:36:43-05:00\",\"updated_at\":\"2020-12-09T12:36:44-05:00\",\"number\":60,\"note\":null,\"token\":\"eb6545d8122eac2b8dd5a523c53f7301\",\"gateway\":null,\"test\":false,\"total_price\":\"0.00\",\"subtotal_price\":\"0.00\",\"total_weight\":0,\"total_tax\":\"0.00\",\"taxes_included\":false,\"currency\":\"CAD\",\"financial_status\":\"paid\",\"confirmed\":true,\"total_discounts\":\"0.00\",\"total_line_items_price\":\"0.00\",\"cart_token\":\"\",\"buyer_accepts_marketing\":false,\"name\":\"#1060\",\"referring_site\":null,\"landing_site\":\"/api/2020-07/graphql.json\",\"cancelled_at\":null,\"cancel_reason\":null,\"total_price_usd\":\"0.00\",\"checkout_token\":\"76030e1da406faff7bf7f3b2604abab2\",\"reference\":null,\"user_id\":null,\"location_id\":null,\"source_identifier\":null,\"source_url\":null,\"processed_at\":\"2020-12-09T12:36:42-05:00\",\"device_id\":null,\"phone\":null,\"customer_locale\":\"en\",\"app_id\":3122233,\"browser_ip\":\"174.92.136.112\",\"client_details\":{\"accept_language\":null,\"browser_height\":799,\"browser_ip\":\"174.92.136.112\",\"browser_width\":500,\"session_hash\":null,\"user_agent\":\"node-fetch/1.0 (+https://github.com/bitinn/node-fetch)\"},\"landing_site_ref\":null,\"order_number\":1060,\"discount_applications\":[],\"discount_codes\":[],\"payment_gateway_names\":[],\"processing_method\":\"free\",\"checkout_id\":16167784808559,\"source_name\":\"web\",\"fulfillment_status\":null,\"tax_lines\":[],\"tags\":\"\",\"order_status_url\":\"https://watchhabitat.myshopify.com/17684561974/orders/eb6545d8122eac2b8dd5a523c53f7301/authenticate?key=903ec1040dadb781b11801be3220bb77\",\"presentment_currency\":\"CAD\",\"total_line_items_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_discounts_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_shipping_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"subtotal_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_tax_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"line_items\":[{\"id\":5734446137455,\"variant_id\":32086752362607,\"title\":\"Coney Hatch at the Elmo - Oct 3, 2020\",\"quantity\":1,\"sku\":\"\",\"variant_title\":\"\",\"vendor\":\"WatchHabitat\",\"fulfillment_service\":\"manual\",\"product_id\":4566884909167,\"requires_shipping\":false,\"taxable\":true,\"gift_card\":false,\"name\":\"Coney Hatch at the Elmo - Oct 3, 2020\",\"variant_inventory_management\":null,\"properties\":[],\"product_exists\":true,\"fulfillable_quantity\":1,\"grams\":0,\"price\":\"0.00\",\"total_discount\":\"0.00\",\"fulfillment_status\":null,\"price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_discount_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"discount_allocations\":[],\"duties\":[],\"admin_graphql_api_id\":\"gid://shopify/LineItem/5734446137455\",\"tax_lines\":[],\"origin_location\":{\"id\":1418132586550,\"country_code\":\"CA\",\"province_code\":\"ON\",\"name\":\"WatchHabitat\",\"address1\":\"559 College Street\",\"address2\":\"Suite 401\",\"city\":\"Toronto\",\"zip\":\"M6G1A9\"}}],\"fulfillments\":[],\"refunds\":[],\"total_tip_received\":\"0.0\",\"original_total_duties_set\":null,\"current_total_duties_set\":null,\"admin_graphql_api_id\":\"gid://shopify/Order/2639876882543\",\"shipping_lines\":[],\"billing_address\":{\"first_name\":\"Ken\",\"address1\":\"559 College Street, 5th Floor\",\"phone\":null,\"city\":\"Toronto\",\"zip\":\"M6G1A9\",\"province\":\"Ontario\",\"country\":\"Canada\",\"last_name\":\"Ono\",\"address2\":\"\",\"company\":null,\"latitude\":43.6551489,\"longitude\":-79.41220299999999,\"name\":\"Ken Ono\",\"country_code\":\"CA\",\"province_code\":\"ON\"},\"customer\":{\"id\":3486333861999,\"email\":\"params.email\",\"accepts_marketing\":false,\"created_at\":\"2020-12-09T12:36:24-05:00\",\"updated_at\":\"2020-12-09T12:36:43-05:00\",\"first_name\":\"Ken\",\"last_name\":\"Ono\",\"orders_count\":1,\"state\":\"disabled\",\"total_spent\":\"0.00\",\"last_order_id\":2639876882543,\"note\":null,\"verified_email\":true,\"multipass_identifier\":null,\"tax_exempt\":false,\"phone\":null,\"tags\":\"\",\"last_order_name\":\"#1060\",\"currency\":\"CAD\",\"accepts_marketing_updated_at\":\"2020-12-09T12:36:25-05:00\",\"marketing_opt_in_level\":null,\"admin_graphql_api_id\":\"gid://shopify/Customer/3486333861999\",\"default_address\":{\"id\":3743730532463,\"customer_id\":3486333861999,\"first_name\":\"Ken\",\"last_name\":\"Ono\",\"company\":null,\"address1\":\"559 College Street, 5th Floor\",\"address2\":\"\",\"city\":\"Toronto\",\"province\":\"Ontario\",\"country\":\"Canada\",\"zip\":\"M6G1A9\",\"phone\":null,\"name\":\"Ken Ono\",\"province_code\":\"ON\",\"country_code\":\"CA\",\"country_name\":\"Canada\",\"default\":true}}}",
"alg": "sha256",
"secret": "test_secret"
}
var c = { hash:"4rgBlMdnVnskrfabzYBl2GinoGIzBZtC1sECfE9hUd4=",
"payload": "{\"някаква кирлица да има\":2639876882543,\"contact_email\":\"[email protected]\",\"email\":\"[email protected]\",\"note_attributes\":[{\"name\":\"brandId\",\"value\":\"at\"},{\"name\":\"branchId\",\"value\":\"ken-dev-load\"}],\"closed_at\":null,\"created_at\":\"2020-12-09T12:36:43-05:00\",\"updated_at\":\"2020-12-09T12:36:44-05:00\",\"number\":60,\"note\":null,\"token\":\"eb6545d8122eac2b8dd5a523c53f7301\",\"gateway\":null,\"test\":false,\"total_price\":\"0.00\",\"subtotal_price\":\"0.00\",\"total_weight\":0,\"total_tax\":\"0.00\",\"taxes_included\":false,\"currency\":\"CAD\",\"financial_status\":\"paid\",\"confirmed\":true,\"total_discounts\":\"0.00\",\"total_line_items_price\":\"0.00\",\"cart_token\":\"\",\"buyer_accepts_marketing\":false,\"name\":\"#1060\",\"referring_site\":null,\"landing_site\":\"/api/2020-07/graphql.json\",\"cancelled_at\":null,\"cancel_reason\":null,\"total_price_usd\":\"0.00\",\"checkout_token\":\"76030e1da406faff7bf7f3b2604abab2\",\"reference\":null,\"user_id\":null,\"location_id\":null,\"source_identifier\":null,\"source_url\":null,\"processed_at\":\"2020-12-09T12:36:42-05:00\",\"device_id\":null,\"phone\":null,\"customer_locale\":\"en\",\"app_id\":3122233,\"browser_ip\":\"174.92.136.112\",\"client_details\":{\"accept_language\":null,\"browser_height\":799,\"browser_ip\":\"174.92.136.112\",\"browser_width\":500,\"session_hash\":null,\"user_agent\":\"node-fetch/1.0 (+https://github.com/bitinn/node-fetch)\"},\"landing_site_ref\":null,\"order_number\":1060,\"discount_applications\":[],\"discount_codes\":[],\"payment_gateway_names\":[],\"processing_method\":\"free\",\"checkout_id\":16167784808559,\"source_name\":\"web\",\"fulfillment_status\":null,\"tax_lines\":[],\"tags\":\"\",\"order_status_url\":\"https://watchhabitat.myshopify.com/17684561974/orders/eb6545d8122eac2b8dd5a523c53f7301/authenticate?key=903ec1040dadb781b11801be3220bb77\",\"presentment_currency\":\"CAD\",\"total_line_items_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_discounts_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_shipping_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"subtotal_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_tax_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"line_items\":[{\"id\":5734446137455,\"variant_id\":32086752362607,\"title\":\"Coney Hatch at the Elmo - Oct 3, 2020\",\"quantity\":1,\"sku\":\"\",\"variant_title\":\"\",\"vendor\":\"WatchHabitat\",\"fulfillment_service\":\"manual\",\"product_id\":4566884909167,\"requires_shipping\":false,\"taxable\":true,\"gift_card\":false,\"name\":\"Coney Hatch at the Elmo - Oct 3, 2020\",\"variant_inventory_management\":null,\"properties\":[],\"product_exists\":true,\"fulfillable_quantity\":1,\"grams\":0,\"price\":\"0.00\",\"total_discount\":\"0.00\",\"fulfillment_status\":null,\"price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_discount_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"discount_allocations\":[],\"duties\":[],\"admin_graphql_api_id\":\"gid://shopify/LineItem/5734446137455\",\"tax_lines\":[],\"origin_location\":{\"id\":1418132586550,\"country_code\":\"CA\",\"province_code\":\"ON\",\"name\":\"WatchHabitat\",\"address1\":\"559 College Street\",\"address2\":\"Suite 401\",\"city\":\"Toronto\",\"zip\":\"M6G1A9\"}}],\"fulfillments\":[],\"refunds\":[],\"total_tip_received\":\"0.0\",\"original_total_duties_set\":null,\"current_total_duties_set\":null,\"admin_graphql_api_id\":\"gid://shopify/Order/2639876882543\",\"shipping_lines\":[],\"billing_address\":{\"first_name\":\"Ken\",\"address1\":\"559 College Street, 5th Floor\",\"phone\":null,\"city\":\"Toronto\",\"zip\":\"M6G1A9\",\"province\":\"Ontario\",\"country\":\"Canada\",\"last_name\":\"Ono\",\"address2\":\"\",\"company\":null,\"latitude\":43.6551489,\"longitude\":-79.41220299999999,\"name\":\"Ken Ono\",\"country_code\":\"CA\",\"province_code\":\"ON\"},\"customer\":{\"id\":3486333861999,\"email\":\"params.email\",\"accepts_marketing\":false,\"created_at\":\"2020-12-09T12:36:24-05:00\",\"updated_at\":\"2020-12-09T12:36:43-05:00\",\"first_name\":\"Ken\",\"last_name\":\"Ono\",\"orders_count\":1,\"state\":\"disabled\",\"total_spent\":\"0.00\",\"last_order_id\":2639876882543,\"note\":null,\"verified_email\":true,\"multipass_identifier\":null,\"tax_exempt\":false,\"phone\":null,\"tags\":\"\",\"last_order_name\":\"#1060\",\"currency\":\"CAD\",\"accepts_marketing_updated_at\":\"2020-12-09T12:36:25-05:00\",\"marketing_opt_in_level\":null,\"admin_graphql_api_id\":\"gid://shopify/Customer/3486333861999\",\"default_address\":{\"id\":3743730532463,\"customer_id\":3486333861999,\"first_name\":\"Ken\",\"last_name\":\"Ono\",\"company\":null,\"address1\":\"559 College Street, 5th Floor\",\"address2\":\"\",\"city\":\"Toronto\",\"province\":\"Ontario\",\"country\":\"Canada\",\"zip\":\"M6G1A9\",\"phone\":null,\"name\":\"Ken Ono\",\"province_code\":\"ON\",\"country_code\":\"CA\",\"country_name\":\"Canada\",\"default\":true}}}",
"alg": "sha256",
"secret": "test_secret"
}
for (var s of [a, b, c]) {
const hash = crypto
.createHmac(s.alg, s.secret)
.update(s.payload)
.digest('base64');
console.log(hash)
console.log(s.hash)
console.log(s.hash == hash)
} and the corresponding k6 variant: var crypto = require("k6/crypto");
var a = {
"alg": "sha256",
"secret": "test_secret",
"payload": "{\"id\":2639876882543,\"contact_email\":\"params.email\",\"email\":\"substemail\",\"note_attributes\":[{\"name\":\"brandId\",\"value\":\"at\"},{\"name\":\"branchId\",\"value\":\"ken-dev-load\"}],\"closed_at\":null,\"created_at\":\"2020-12-09T12:36:43-05:00\",\"updated_at\":\"2020-12-09T12:36:44-05:00\",\"number\":60,\"note\":null,\"token\":\"eb6545d8122eac2b8dd5a523c53f7301\",\"gateway\":null,\"test\":false,\"total_price\":\"0.00\",\"subtotal_price\":\"0.00\",\"total_weight\":0,\"total_tax\":\"0.00\",\"taxes_included\":false,\"currency\":\"CAD\",\"financial_status\":\"paid\",\"confirmed\":true,\"total_discounts\":\"0.00\",\"total_line_items_price\":\"0.00\",\"cart_token\":\"\",\"buyer_accepts_marketing\":false,\"name\":\"#1060\",\"referring_site\":null,\"landing_site\":\"/api/2020-07/graphql.json\",\"cancelled_at\":null,\"cancel_reason\":null,\"total_price_usd\":\"0.00\",\"checkout_token\":\"76030e1da406faff7bf7f3b2604abab2\",\"reference\":null,\"user_id\":null,\"location_id\":null,\"source_identifier\":null,\"source_url\":null,\"processed_at\":\"2020-12-09T12:36:42-05:00\",\"device_id\":null,\"phone\":null,\"customer_locale\":\"en\",\"app_id\":3122233,\"browser_ip\":\"174.92.136.112\",\"client_details\":{\"accept_language\":null,\"browser_height\":799,\"browser_ip\":\"174.92.136.112\",\"browser_width\":500,\"session_hash\":null,\"user_agent\":\"node-fetch/1.0 (+https://github.com/bitinn/node-fetch)\"},\"landing_site_ref\":null,\"order_number\":1060,\"discount_applications\":[],\"discount_codes\":[],\"payment_gateway_names\":[],\"processing_method\":\"free\",\"checkout_id\":16167784808559,\"source_name\":\"web\",\"fulfillment_status\":null,\"tax_lines\":[],\"tags\":\"\",\"order_status_url\":\"https://watchhabitat.myshopify.com/17684561974/orders/eb6545d8122eac2b8dd5a523c53f7301/authenticate?key=903ec1040dadb781b11801be3220bb77\",\"presentment_currency\":\"CAD\",\"total_line_items_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_discounts_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_shipping_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"subtotal_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_tax_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"line_items\":[{\"id\":5734446137455,\"variant_id\":32086752362607,\"title\":\"Coney Hatch at the Elmo - Oct 3, 2020\",\"quantity\":1,\"sku\":\"\",\"variant_title\":\"\",\"vendor\":\"WatchHabitat\",\"fulfillment_service\":\"manual\",\"product_id\":4566884909167,\"requires_shipping\":false,\"taxable\":true,\"gift_card\":false,\"name\":\"Coney Hatch at the Elmo - Oct 3, 2020\",\"variant_inventory_management\":null,\"properties\":[],\"product_exists\":true,\"fulfillable_quantity\":1,\"grams\":0,\"price\":\"0.00\",\"total_discount\":\"0.00\",\"fulfillment_status\":null,\"price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_discount_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"discount_allocations\":[],\"duties\":[],\"admin_graphql_api_id\":\"gid://shopify/LineItem/5734446137455\",\"tax_lines\":[],\"origin_location\":{\"id\":1418132586550,\"country_code\":\"CA\",\"province_code\":\"ON\",\"name\":\"WatchHabitat\",\"address1\":\"559 College Street\",\"address2\":\"Suite 401\",\"city\":\"Toronto\",\"zip\":\"M6G1A9\"}}],\"fulfillments\":[],\"refunds\":[],\"total_tip_received\":\"0.0\",\"original_total_duties_set\":null,\"current_total_duties_set\":null,\"admin_graphql_api_id\":\"gid://shopify/Order/2639876882543\",\"shipping_lines\":[],\"billing_address\":{\"first_name\":\"Ken\",\"address1\":\"559 College Street, 5th Floor\",\"phone\":null,\"city\":\"Toronto\",\"zip\":\"M6G1A9\",\"province\":\"Ontario\",\"country\":\"Canada\",\"last_name\":\"Ono\",\"address2\":\"\",\"company\":null,\"latitude\":43.6551489,\"longitude\":-79.41220299999999,\"name\":\"Ken Ono\",\"country_code\":\"CA\",\"province_code\":\"ON\"},\"customer\":{\"id\":3486333861999,\"email\":\"params.email\",\"accepts_marketing\":false,\"created_at\":\"2020-12-09T12:36:24-05:00\",\"updated_at\":\"2020-12-09T12:36:43-05:00\",\"first_name\":\"Ken\",\"last_name\":\"Ono\",\"orders_count\":1,\"state\":\"disabled\",\"total_spent\":\"0.00\",\"last_order_id\":2639876882543,\"note\":null,\"verified_email\":true,\"multipass_identifier\":null,\"tax_exempt\":false,\"phone\":null,\"tags\":\"\",\"last_order_name\":\"#1060\",\"currency\":\"CAD\",\"accepts_marketing_updated_at\":\"2020-12-09T12:36:25-05:00\",\"marketing_opt_in_level\":null,\"admin_graphql_api_id\":\"gid://shopify/Customer/3486333861999\",\"default_address\":{\"id\":3743730532463,\"customer_id\":3486333861999,\"first_name\":\"Ken\",\"last_name\":\"Ono\",\"company\":null,\"address1\":\"559 College Street, 5th Floor\",\"address2\":\"\",\"city\":\"Toronto\",\"province\":\"Ontario\",\"country\":\"Canada\",\"zip\":\"M6G1A9\",\"phone\":null,\"name\":\"Ken Ono\",\"province_code\":\"ON\",\"country_code\":\"CA\",\"country_name\":\"Canada\",\"default\":true}}}",
"hash": "3ilgZHvK9U2bjBbT0tSjFPSRSawXZ4+rJRHr3jP9X2I=",
}
var b = { hash:"jeElv6QSAFTU0uPU+K9uBtKc1y8+92z2e/3XFNKuSNA=",
"payload": "{\"id\":2639876882543,\"contact_email\":\"[email protected]\",\"email\":\"[email protected]\",\"note_attributes\":[{\"name\":\"brandId\",\"value\":\"at\"},{\"name\":\"branchId\",\"value\":\"ken-dev-load\"}],\"closed_at\":null,\"created_at\":\"2020-12-09T12:36:43-05:00\",\"updated_at\":\"2020-12-09T12:36:44-05:00\",\"number\":60,\"note\":null,\"token\":\"eb6545d8122eac2b8dd5a523c53f7301\",\"gateway\":null,\"test\":false,\"total_price\":\"0.00\",\"subtotal_price\":\"0.00\",\"total_weight\":0,\"total_tax\":\"0.00\",\"taxes_included\":false,\"currency\":\"CAD\",\"financial_status\":\"paid\",\"confirmed\":true,\"total_discounts\":\"0.00\",\"total_line_items_price\":\"0.00\",\"cart_token\":\"\",\"buyer_accepts_marketing\":false,\"name\":\"#1060\",\"referring_site\":null,\"landing_site\":\"/api/2020-07/graphql.json\",\"cancelled_at\":null,\"cancel_reason\":null,\"total_price_usd\":\"0.00\",\"checkout_token\":\"76030e1da406faff7bf7f3b2604abab2\",\"reference\":null,\"user_id\":null,\"location_id\":null,\"source_identifier\":null,\"source_url\":null,\"processed_at\":\"2020-12-09T12:36:42-05:00\",\"device_id\":null,\"phone\":null,\"customer_locale\":\"en\",\"app_id\":3122233,\"browser_ip\":\"174.92.136.112\",\"client_details\":{\"accept_language\":null,\"browser_height\":799,\"browser_ip\":\"174.92.136.112\",\"browser_width\":500,\"session_hash\":null,\"user_agent\":\"node-fetch/1.0 (+https://github.com/bitinn/node-fetch)\"},\"landing_site_ref\":null,\"order_number\":1060,\"discount_applications\":[],\"discount_codes\":[],\"payment_gateway_names\":[],\"processing_method\":\"free\",\"checkout_id\":16167784808559,\"source_name\":\"web\",\"fulfillment_status\":null,\"tax_lines\":[],\"tags\":\"\",\"order_status_url\":\"https://watchhabitat.myshopify.com/17684561974/orders/eb6545d8122eac2b8dd5a523c53f7301/authenticate?key=903ec1040dadb781b11801be3220bb77\",\"presentment_currency\":\"CAD\",\"total_line_items_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_discounts_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_shipping_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"subtotal_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_tax_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"line_items\":[{\"id\":5734446137455,\"variant_id\":32086752362607,\"title\":\"Coney Hatch at the Elmo - Oct 3, 2020\",\"quantity\":1,\"sku\":\"\",\"variant_title\":\"\",\"vendor\":\"WatchHabitat\",\"fulfillment_service\":\"manual\",\"product_id\":4566884909167,\"requires_shipping\":false,\"taxable\":true,\"gift_card\":false,\"name\":\"Coney Hatch at the Elmo - Oct 3, 2020\",\"variant_inventory_management\":null,\"properties\":[],\"product_exists\":true,\"fulfillable_quantity\":1,\"grams\":0,\"price\":\"0.00\",\"total_discount\":\"0.00\",\"fulfillment_status\":null,\"price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_discount_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"discount_allocations\":[],\"duties\":[],\"admin_graphql_api_id\":\"gid://shopify/LineItem/5734446137455\",\"tax_lines\":[],\"origin_location\":{\"id\":1418132586550,\"country_code\":\"CA\",\"province_code\":\"ON\",\"name\":\"WatchHabitat\",\"address1\":\"559 College Street\",\"address2\":\"Suite 401\",\"city\":\"Toronto\",\"zip\":\"M6G1A9\"}}],\"fulfillments\":[],\"refunds\":[],\"total_tip_received\":\"0.0\",\"original_total_duties_set\":null,\"current_total_duties_set\":null,\"admin_graphql_api_id\":\"gid://shopify/Order/2639876882543\",\"shipping_lines\":[],\"billing_address\":{\"first_name\":\"Ken\",\"address1\":\"559 College Street, 5th Floor\",\"phone\":null,\"city\":\"Toronto\",\"zip\":\"M6G1A9\",\"province\":\"Ontario\",\"country\":\"Canada\",\"last_name\":\"Ono\",\"address2\":\"\",\"company\":null,\"latitude\":43.6551489,\"longitude\":-79.41220299999999,\"name\":\"Ken Ono\",\"country_code\":\"CA\",\"province_code\":\"ON\"},\"customer\":{\"id\":3486333861999,\"email\":\"params.email\",\"accepts_marketing\":false,\"created_at\":\"2020-12-09T12:36:24-05:00\",\"updated_at\":\"2020-12-09T12:36:43-05:00\",\"first_name\":\"Ken\",\"last_name\":\"Ono\",\"orders_count\":1,\"state\":\"disabled\",\"total_spent\":\"0.00\",\"last_order_id\":2639876882543,\"note\":null,\"verified_email\":true,\"multipass_identifier\":null,\"tax_exempt\":false,\"phone\":null,\"tags\":\"\",\"last_order_name\":\"#1060\",\"currency\":\"CAD\",\"accepts_marketing_updated_at\":\"2020-12-09T12:36:25-05:00\",\"marketing_opt_in_level\":null,\"admin_graphql_api_id\":\"gid://shopify/Customer/3486333861999\",\"default_address\":{\"id\":3743730532463,\"customer_id\":3486333861999,\"first_name\":\"Ken\",\"last_name\":\"Ono\",\"company\":null,\"address1\":\"559 College Street, 5th Floor\",\"address2\":\"\",\"city\":\"Toronto\",\"province\":\"Ontario\",\"country\":\"Canada\",\"zip\":\"M6G1A9\",\"phone\":null,\"name\":\"Ken Ono\",\"province_code\":\"ON\",\"country_code\":\"CA\",\"country_name\":\"Canada\",\"default\":true}}}",
"alg": "sha256",
"secret": "test_secret"
}
var c = { hash:"4rgBlMdnVnskrfabzYBl2GinoGIzBZtC1sECfE9hUd4=",
"payload": "{\"някаква кирлица да има\":2639876882543,\"contact_email\":\"[email protected]\",\"email\":\"[email protected]\",\"note_attributes\":[{\"name\":\"brandId\",\"value\":\"at\"},{\"name\":\"branchId\",\"value\":\"ken-dev-load\"}],\"closed_at\":null,\"created_at\":\"2020-12-09T12:36:43-05:00\",\"updated_at\":\"2020-12-09T12:36:44-05:00\",\"number\":60,\"note\":null,\"token\":\"eb6545d8122eac2b8dd5a523c53f7301\",\"gateway\":null,\"test\":false,\"total_price\":\"0.00\",\"subtotal_price\":\"0.00\",\"total_weight\":0,\"total_tax\":\"0.00\",\"taxes_included\":false,\"currency\":\"CAD\",\"financial_status\":\"paid\",\"confirmed\":true,\"total_discounts\":\"0.00\",\"total_line_items_price\":\"0.00\",\"cart_token\":\"\",\"buyer_accepts_marketing\":false,\"name\":\"#1060\",\"referring_site\":null,\"landing_site\":\"/api/2020-07/graphql.json\",\"cancelled_at\":null,\"cancel_reason\":null,\"total_price_usd\":\"0.00\",\"checkout_token\":\"76030e1da406faff7bf7f3b2604abab2\",\"reference\":null,\"user_id\":null,\"location_id\":null,\"source_identifier\":null,\"source_url\":null,\"processed_at\":\"2020-12-09T12:36:42-05:00\",\"device_id\":null,\"phone\":null,\"customer_locale\":\"en\",\"app_id\":3122233,\"browser_ip\":\"174.92.136.112\",\"client_details\":{\"accept_language\":null,\"browser_height\":799,\"browser_ip\":\"174.92.136.112\",\"browser_width\":500,\"session_hash\":null,\"user_agent\":\"node-fetch/1.0 (+https://github.com/bitinn/node-fetch)\"},\"landing_site_ref\":null,\"order_number\":1060,\"discount_applications\":[],\"discount_codes\":[],\"payment_gateway_names\":[],\"processing_method\":\"free\",\"checkout_id\":16167784808559,\"source_name\":\"web\",\"fulfillment_status\":null,\"tax_lines\":[],\"tags\":\"\",\"order_status_url\":\"https://watchhabitat.myshopify.com/17684561974/orders/eb6545d8122eac2b8dd5a523c53f7301/authenticate?key=903ec1040dadb781b11801be3220bb77\",\"presentment_currency\":\"CAD\",\"total_line_items_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_discounts_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_shipping_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"subtotal_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_tax_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"line_items\":[{\"id\":5734446137455,\"variant_id\":32086752362607,\"title\":\"Coney Hatch at the Elmo - Oct 3, 2020\",\"quantity\":1,\"sku\":\"\",\"variant_title\":\"\",\"vendor\":\"WatchHabitat\",\"fulfillment_service\":\"manual\",\"product_id\":4566884909167,\"requires_shipping\":false,\"taxable\":true,\"gift_card\":false,\"name\":\"Coney Hatch at the Elmo - Oct 3, 2020\",\"variant_inventory_management\":null,\"properties\":[],\"product_exists\":true,\"fulfillable_quantity\":1,\"grams\":0,\"price\":\"0.00\",\"total_discount\":\"0.00\",\"fulfillment_status\":null,\"price_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"total_discount_set\":{\"shop_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"},\"presentment_money\":{\"amount\":\"0.00\",\"currency_code\":\"CAD\"}},\"discount_allocations\":[],\"duties\":[],\"admin_graphql_api_id\":\"gid://shopify/LineItem/5734446137455\",\"tax_lines\":[],\"origin_location\":{\"id\":1418132586550,\"country_code\":\"CA\",\"province_code\":\"ON\",\"name\":\"WatchHabitat\",\"address1\":\"559 College Street\",\"address2\":\"Suite 401\",\"city\":\"Toronto\",\"zip\":\"M6G1A9\"}}],\"fulfillments\":[],\"refunds\":[],\"total_tip_received\":\"0.0\",\"original_total_duties_set\":null,\"current_total_duties_set\":null,\"admin_graphql_api_id\":\"gid://shopify/Order/2639876882543\",\"shipping_lines\":[],\"billing_address\":{\"first_name\":\"Ken\",\"address1\":\"559 College Street, 5th Floor\",\"phone\":null,\"city\":\"Toronto\",\"zip\":\"M6G1A9\",\"province\":\"Ontario\",\"country\":\"Canada\",\"last_name\":\"Ono\",\"address2\":\"\",\"company\":null,\"latitude\":43.6551489,\"longitude\":-79.41220299999999,\"name\":\"Ken Ono\",\"country_code\":\"CA\",\"province_code\":\"ON\"},\"customer\":{\"id\":3486333861999,\"email\":\"params.email\",\"accepts_marketing\":false,\"created_at\":\"2020-12-09T12:36:24-05:00\",\"updated_at\":\"2020-12-09T12:36:43-05:00\",\"first_name\":\"Ken\",\"last_name\":\"Ono\",\"orders_count\":1,\"state\":\"disabled\",\"total_spent\":\"0.00\",\"last_order_id\":2639876882543,\"note\":null,\"verified_email\":true,\"multipass_identifier\":null,\"tax_exempt\":false,\"phone\":null,\"tags\":\"\",\"last_order_name\":\"#1060\",\"currency\":\"CAD\",\"accepts_marketing_updated_at\":\"2020-12-09T12:36:25-05:00\",\"marketing_opt_in_level\":null,\"admin_graphql_api_id\":\"gid://shopify/Customer/3486333861999\",\"default_address\":{\"id\":3743730532463,\"customer_id\":3486333861999,\"first_name\":\"Ken\",\"last_name\":\"Ono\",\"company\":null,\"address1\":\"559 College Street, 5th Floor\",\"address2\":\"\",\"city\":\"Toronto\",\"province\":\"Ontario\",\"country\":\"Canada\",\"zip\":\"M6G1A9\",\"phone\":null,\"name\":\"Ken Ono\",\"province_code\":\"ON\",\"country_code\":\"CA\",\"country_name\":\"Canada\",\"default\":true}}}",
"alg": "sha256",
"secret": "test_secret"
}
for (var s of [a, b, c]) {
let hasher = crypto.createHMAC(s.alg, s.secret)
hasher.update(s.payload)
let hash = hasher.digest('base64');
console.log(hash)
console.log(s.hash)
console.log(s.hash == hash)
} Putting "utf-8" and "hex" as the second and third argument of the |
hi @kokokenada can you confirm that you have fixed this or still have this problem. From my lost comment it seems like ti should be working the way you want? |
I'm having trouble remembering the details. I was able to get things working. Looking at my code now, the following node code works for me:
|
I'm having difficulty creating a matching hash for a shopify web hook: https://shopify.dev/tutorials/manage-webhooks#verifying-webhooks
The following in node works fine:
but
in k6 produces a different hash. My working theory is that it is the utf encoding. (Not sure if the 3rd 'hex' param is needed - I've seen other examples without it.
Feature Description
Mimic the node crypto object to include encoding options.
Suggested Solution (optional)
Don't know. I'd love a work around. I tried using https://www.npmjs.com/package/utf8 but no luck...
The text was updated successfully, but these errors were encountered: