From 3acf01d3cab18777e2ffdf9f48caa65d227cb3d3 Mon Sep 17 00:00:00 2001 From: Johann-S Date: Tue, 28 Jul 2020 10:53:02 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#46389=20[coinbase-?= =?UTF-8?q?commerce-node]=20-=20verifyEventBody=20function=20by=20@Johann-?= =?UTF-8?q?S?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../coinbase-commerce-node/coinbase-commerce-node-tests.ts | 7 +++++++ types/coinbase-commerce-node/index.d.ts | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/types/coinbase-commerce-node/coinbase-commerce-node-tests.ts b/types/coinbase-commerce-node/coinbase-commerce-node-tests.ts index d9e6f31a82..0d35c03a60 100644 --- a/types/coinbase-commerce-node/coinbase-commerce-node-tests.ts +++ b/types/coinbase-commerce-node/coinbase-commerce-node-tests.ts @@ -338,3 +338,10 @@ const paginationExample: Pagination = { */ // tslint:disable-next-line:void-return no-void-expression const shouldBeVoid: void = Webhook.verifySigHeader(JSON.stringify(eventResponseExample), 'some-signature', 'my-secret'); + +/** + * Verify event body. + * + * @link https://github.com/coinbase/coinbase-commerce-node/blob/v1.0.4/lib/Webhook.js#L10 + */ +Webhook.verifyEventBody(JSON.stringify(eventResponseExample), 'some-signature', 'my-secret'); diff --git a/types/coinbase-commerce-node/index.d.ts b/types/coinbase-commerce-node/index.d.ts index c769998bd7..3700ee6396 100644 --- a/types/coinbase-commerce-node/index.d.ts +++ b/types/coinbase-commerce-node/index.d.ts @@ -594,6 +594,13 @@ declare namespace Webhook { * @link https://github.com/coinbase/coinbase-commerce-node#verify-signature-header */ function verifySigHeader(rawBody: string, signature: string, sharedSecret: string): void; + + /** + * Verify event body. + * + * @link https://github.com/coinbase/coinbase-commerce-node/blob/v1.0.4/lib/Webhook.js#L10 + */ + function verifyEventBody(rawBody: string, signature: string, sharedSecret: string): resources.Event; } export {