View Source SanityWebhookPlug.Signature (sanity_webhook_plug v0.1.3)

Compute and verify signatures from Sanity webhooks

Link to this section Summary

Functions

Compute the signature for Sanity webhooks

Verify a payload, timestamp, and secret against a computed signature

Link to this section Types

@type secret() :: mfa() | (() -> String.t() | {:ok, String.t()}) | String.t()

Link to this section Functions

Link to this function

base64url_decode(payload)

View Source
Link to this function

base64url_encode(payload)

View Source
Link to this function

compute(ts, payload, secret)

View Source
@spec compute(pos_integer(), binary(), String.t()) ::
  {:ok, String.t()} | {:error, String.t(), nil}

Compute the signature for Sanity webhooks

Link to this function

verify(hash, ts, payload, secret)

View Source
@spec verify(String.t(), pos_integer(), binary(), secret()) ::
  :ok | {:error, String.t(), String.t()}

Verify a payload, timestamp, and secret against a computed signature