def mac.cmp

bend-kit-jwt@0.11.0.1 · jwt.bend:451

import bend-kit-jwt@0.11.0.1/jwt.bend as Jwt
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

451def mac.cmp(m: Result<&1, &1, Err, Bytes.Bytes>, sig: Bytes.Bytes) -> IO(Result<&1, &1, Err, Bool>):
452  match m:
453    case Fail{e}:
454      IO.pure(Result<&1, &1, Err, Bool>, Fail{e})
455    case Done{Bytes.Bytes{+mn, mb}}:
456      Bytes.Bytes{+sn, sb} = sig
457      do IO<Result<&1, &1, Err, Bool>>:
458        ok : Bool <- Crypto.eq.ct.words(mn, mb, sn, sb)
459        return Done{ok}

Uses (8)

Used by (1)