def mac.if
bend-kit-jwt@0.11.0.1 · jwt.bend:436
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
436def mac.if(weak: Bool, +alg: String, +kn: U32, kb: Array<U32>, +dn: U32, db: Array<U32>) ->
437 IO(Result<&1, &1, Err, Bytes.Bytes>):
438 match weak:
439 case True{}:
440 IO.pure(Result<&1, &1, Err, Bytes.Bytes>, Fail{WeakKey{}})
441 case False{}:
442 do IO<Result<&1, &1, Err, Bytes.Bytes>>:
443 r : Result<&1, &1, U32 & String, U32 & Array<U32>> <- Crypto.hmac.words(alg, kn, kb, dn, db)
444 return crypto.bytes(r)