def head.check
import bend-kit-jwt@0.11.0.1/jwt.bend as Jwtimport Base
307# The header's alg is exactly the pinned one, and it asks for no extension: crit (RFC 7515 §4.1.11) and
308# b64 (RFC 7797) change how the token must be read, and neither is implemented.
309def head.check(+a: Alg, +h: List<&2, Field>) -> Result<&1, &1, Err, Unit>:
310 do Result<&1, &1, Err, Unit>:
311 got : String <- head.alg(field(h, "alg"))
312 u : Unit <- fail.if(Bool.not(String.eq(got, alg.name(a))), AlgMismatch{})
313 fail.if(Bool.or(has(h, "crit"), has(h, "b64")), Crit{})