1.0.9 • Published 2 years ago

smoothcode-client v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

SmoothCode Client JS

Introduction

JS Client that exposes utility functions to authenticate SmoothCode requests

Installation

npm i smoothcode-client

Usage

This library exposes 2 methods

  • isDashboardRequest(requestHmac, clientSecret, shop) - This method verifies if the request for accessing the dashboard is coming from SmoothCode
const smoothcode = require('smoothcode-client')

// SmoothCode sends query parameters to the URL
// shop -> Shopify Shop in the form: `test.myshopify.com`
// hmac -> HMAC of the shop signed by your App Client Secret (can be obtained from SmoothCode Dashboard in App Settings)

smoothcode.isDashboardRequest(requestHmac, clientSecret, shop) // returns True if the request is valid
  • isWebhookRequest(requestHmac, clientSecret, webhookData) - This method verifies if the webhook request is coming from SmoothCode
const smoothcode = require('smoothcode-client')

// SmoothCode sends hmac in the Authorization Header of the request
// It is hmac of the webhook id signed by your App Client Secret

smoothcode.isWebhookRequest(requestHmac, clientSecret, webhookData) // returns True if the request is valid
  • isGDPRWebhookRequest(requestHmac, clientSecret, webhookData) - This method verifies if the webhook request is coming from SmoothCode
const smoothcode = require('smoothcode-client')

// SmoothCode sends hmac in the Authorization Header of the request
// It is hmac of the shop id signed by your App Client Secret

smoothcode.isGDPRWebhookRequest(requestHmac, clientSecret, webhookData) // returns True if the request is valid

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago