def std.check

bend-kit-webhooks@0.11.0.1 · webhooks.bend:283

import bend-kit-webhooks@0.11.0.1/webhooks.bend as Webhooks
import Base
import bend-kit-time@0.3.0.0/time.bend as Time
import bend-kit-int@0.2.0.0/int.bend as Int

283def std.check(+tol: U32, now: Time.Instant, +h: Map<&2, List<&2, String>>) -> Result<&1, &1, Err, String & String & List<&2, String>>:
284  do Result<&1, &1, Err, String & String & List<&2, String>>:
285    +id : String <- need("webhook-id", field(h, "webhook-id"))
286    +ts : String <- need("webhook-timestamp", field(h, "webhook-timestamp"))
287    sig : String <- need("webhook-signature", field(h, "webhook-signature"))
288    u : Unit <- id.check(id)
289    t : Int.I64 <- ts.read(ts)
290    w : Unit <- window(tol, now, t)
291    return (id, id ++ "." ++ ts ++ ".", std.sigs(String.split(sig, ' ')))

Uses (22)

Used by (1)