packages feed

stripe-signature 1.0.0.0 → 1.0.0.1

raw patch · 4 files changed

+27/−15 lines, 4 filesdep +base16-bytestringdep −hex-textPVP ok

version bump matches the API change (PVP)

Dependencies added: base16-bytestring

Dependencies removed: hex-text

API changes (from Hackage documentation)

Files

changelog.md view
@@ -1,12 +1,10 @@ # Changelog -All notable changes to this package will be documented in this file.--The format is based on-[Keep a Changelog](https://keepachangelog.com/en/1.0.0/),-and this project adheres to the-[Haskell Package Versioning Policy](https://pvp.haskell.org/).- ## 1.0.0.0 - 2018-12-20  - Initial release++## 1.0.0.1 - 2019-05-18++- Replace `hex-text` package dependency with slightly smaller `base16-bytestring` dependency+ 
library/Stripe/Signature.hs view
@@ -13,16 +13,17 @@ import           Numeric.Natural (Natural) import qualified Text.Read +-- base16-bytestring+import qualified Data.ByteString.Base16+ -- bytestring import Data.ByteString (ByteString)+import qualified Data.ByteString  -- cryptonite import Crypto.Hash     (SHA256) import Crypto.MAC.HMAC as HMAC --- hex-text-import qualified Text.Hex- -- memory import qualified Data.ByteArray @@ -32,6 +33,7 @@ -- text import           Data.Text (Text) import qualified Data.Text+import qualified Data.Text.Encoding  isSigValid :: Sig -> WebhookSecretKey -> ByteString -> Bool isSigValid x secret body =@@ -84,7 +86,7 @@           v1 = Data.Maybe.mapMaybe               ( \(k, v) ->                   if k == Data.Text.pack "v1"-                  then Text.Hex.decodeHex v+                  then decodeHex v                   else Nothing               )               parts@@ -109,3 +111,15 @@  readNatural :: String -> Maybe Natural readNatural = Text.Read.readMaybe++{- | Decodes hexidecimal text as a byte string. The result is a 'Just' value iff+the text contains an even number of characters and consists only of the digits+@0@ through @9@ and letters @a@ through @f@. -}++decodeHex :: Text -> Maybe ByteString+decodeHex txt =+    let+        bs = Data.Text.Encoding.encodeUtf8 txt+        (x, remainder) = Data.ByteString.Base16.decode bs+    in+        if Data.ByteString.null remainder then Just x else Nothing
license.txt view
@@ -1,4 +1,4 @@-Copyright 2018 Typeclass Consulting, LLC+Copyright 2019 Typeclass Consulting, LLC  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in
stripe-signature.cabal view
@@ -1,5 +1,5 @@ name: stripe-signature-version: 1.0.0.0+version: 1.0.0.1  synopsis: Verification of Stripe webhook signatures category: Web@@ -23,7 +23,7 @@  build-type: Simple cabal-version: >=1.10-tested-with: GHC==8.2.2, GHC==8.4.3, GHC==8.6.1+tested-with: GHC==8.2.2, GHC==8.4.4, GHC==8.6.3  extra-source-files:     changelog.md@@ -37,9 +37,9 @@      build-depends:         base >=4.10 && <5+      , base16-bytestring       , bytestring       , cryptonite-      , hex-text       , memory       , stripe-concepts       , text