Skip to content

FoxSellApp/smoothcode-client-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SmoothCode Client Ruby

Introduction

Ruby Client that exposes utility functions to authenticate SmoothCode requests

Installation

gem install smoothcode

Usage

This library exposes 2 methods

  • dashboard_request?(shop) - This method verifies if the request for accessing the dashboard is coming from SmoothCode
require 'smoothcode'

# 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)

SmoothCodeAuth.new(request_hmac, client_secret).dashboard_request?(shop) # returns True if the request is valid
  • webhook_request?(webhook_data) - This method verifies if the webhook request is coming from SmoothCode
require 'smoothcode'

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

SmoothCodeAuth.new(request_hmac, client_secret).webhook_request?(webhook_data) # returns True if the request is valid

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages