signet
Safe HaskellNone
LanguageHaskell2010

Signet

Synopsis

Verification

verifyWebhookText Source #

Arguments

:: (MonadIO m, MonadThrow m) 
=> Text

A Verifier for the webhook. Typically this will be "whsec_..." or "whpk_...".

-> Text

The webhook's unique Id. Typically this will come from the hWebhookId header and look like "msg_...".

-> Text

The webhook's Timestamp. This is an integer number of seconds since the Unix epoch. Typically this will come from the hWebhookTimestamp header. For example "981173106" for 2001-02-03T04:05:06Z.

-> Text

The webhook's raw Payload. Typically this will be a JSON object like {"event_type":"ping",...}.

-> Text

The webhook's Signatures. Typically this will come from the hWebhookSignature header and look like "v1_..." or "v1a_...".

-> m Signature 

Verifies a webhook with Text values. This is a wrapper around verifyWebhookByteString that assumes all values are encoded as UTF-8.

verifyWebhookByteString Source #

Verifies a webhook with ByteString values. This is a wrapper around verifyWebhook. See verifyWebhookText for a description of the arguments.

verifyWebhook :: (MonadIO m, MonadThrow m) => Verifier -> Message -> Signatures -> m Signature Source #

Verifies a webhook. This is a wrapper around verifyWebhookWith that uses typicalTolerance and the current time.

Throws an exception if the webhook is invalid.

verifyWebhookWith Source #

Verifies a webhook. This is the lowest-level function that gives you the most control. If you're looking for something that's easier to use and assumes some reasonable defaults, consider verifyWebhook.

Signing

Headers

Types

newtype Id Source #

Constructors

MkId ByteString 

Instances

Instances details
Show Id Source # 
Instance details

Defined in Signet.Unstable.Type.Id

Methods

showsPrec :: Int -> Id -> ShowS #

show :: Id -> String #

showList :: [Id] -> ShowS #

Eq Id Source # 
Instance details

Defined in Signet.Unstable.Type.Id

Methods

(==) :: Id -> Id -> Bool #

(/=) :: Id -> Id -> Bool #

data Message Source #

Constructors

MkMessage 

Instances

Instances details
Show Message Source # 
Instance details

Defined in Signet.Unstable.Type.Message

Eq Message Source # 
Instance details

Defined in Signet.Unstable.Type.Message

Methods

(==) :: Message -> Message -> Bool #

(/=) :: Message -> Message -> Bool #

newtype Payload Source #

Constructors

MkPayload ByteString 

Instances

Instances details
Show Payload Source # 
Instance details

Defined in Signet.Unstable.Type.Payload

Eq Payload Source # 
Instance details

Defined in Signet.Unstable.Type.Payload

Methods

(==) :: Payload -> Payload -> Bool #

(/=) :: Payload -> Payload -> Bool #

newtype PublicKey Source #

Constructors

MkPublicKey PublicKey 

Instances

Instances details
Show PublicKey Source # 
Instance details

Defined in Signet.Unstable.Type.PublicKey

Eq PublicKey Source # 
Instance details

Defined in Signet.Unstable.Type.PublicKey

newtype Secret Source #

Constructors

MkSecret ScrubbedBytes 

Instances

Instances details
Show Secret Source # 
Instance details

Defined in Signet.Unstable.Type.Secret

Eq Secret Source # 
Instance details

Defined in Signet.Unstable.Type.Secret

Methods

(==) :: Secret -> Secret -> Bool #

(/=) :: Secret -> Secret -> Bool #

newtype SecretKey Source #

Constructors

MkSecretKey SecretKey 

Instances

Instances details
Show SecretKey Source # 
Instance details

Defined in Signet.Unstable.Type.SecretKey

Eq SecretKey Source # 
Instance details

Defined in Signet.Unstable.Type.SecretKey

data Signature where Source #

Instances

Instances details
Show Signature Source # 
Instance details

Defined in Signet.Unstable.Type.Signature

Eq Signature Source # 
Instance details

Defined in Signet.Unstable.Type.Signature

newtype Signatures Source #

Constructors

MkSignatures [Signature] 

Instances

Instances details
Show Signatures Source # 
Instance details

Defined in Signet.Unstable.Type.Signatures

Eq Signatures Source # 
Instance details

Defined in Signet.Unstable.Type.Signatures

data Signer where Source #

Bundled Patterns

pattern AsymmetricSigner :: SecretKey -> Signer

Alias for Asymmetric.

pattern SymmetricSigner :: Secret -> Signer

Alias for Symmetric.

Instances

Instances details
Show Signer Source # 
Instance details

Defined in Signet.Unstable.Type.Signer

Eq Signer Source # 
Instance details

Defined in Signet.Unstable.Type.Signer

Methods

(==) :: Signer -> Signer -> Bool #

(/=) :: Signer -> Signer -> Bool #

newtype Timestamp Source #

Constructors

MkTimestamp UTCTime 

Instances

Instances details
Show Timestamp Source # 
Instance details

Defined in Signet.Unstable.Type.Timestamp

Eq Timestamp Source # 
Instance details

Defined in Signet.Unstable.Type.Timestamp

newtype Tolerance Source #

Instances

Instances details
Show Tolerance Source # 
Instance details

Defined in Signet.Unstable.Type.Tolerance

Eq Tolerance Source # 
Instance details

Defined in Signet.Unstable.Type.Tolerance

data Verifier where Source #

Bundled Patterns

pattern AsymmetricVerifier :: PublicKey -> Verifier

Alias for Asymmetric.

pattern SymmetricVerifier :: Secret -> Verifier

Alias for Symmetric.

Instances

Instances details
Show Verifier Source # 
Instance details

Defined in Signet.Unstable.Type.Verifier

Eq Verifier Source # 
Instance details

Defined in Signet.Unstable.Type.Verifier

Exceptions