def mac
bend-kit-webhooks@0.11.0.1 · webhooks.bend:166
import bend-kit-webhooks@0.11.0.1/webhooks.bend as Webhooks
import Base
import bend-kit-crypto@0.2.2.2/crypto.bend as Crypto
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
166def mac(k: Bytes.Bytes, data: Bytes.Bytes) -> IO(Result<&1, &1, Err, Bytes.Bytes>):
167 Bytes.Bytes{+kn, kb} = k
168 Bytes.Bytes{+dn, db} = data
169 do IO<Result<&1, &1, Err, Bytes.Bytes>>:
170 r : Result<&1, &1, U32 & String, U32 & Array<U32>> <- Crypto.hmac.words("SHA256", kn, kb, dn, db)
171 return mac.of(r)