def jwk.pick
import bend-kit-jwt@0.11.0.1/jwt.bend as Jwtimport Base
754# The first key named kid that can check alg a. RFC 7515 §4.1.4 leaves kid matching to exact comparison.
755def jwk.pick(ks: List<&2, Jwk>, +kid: String, +a: Alg) -> Maybe<&2, Jwk>:
756 match ks:
757 case Nil{}:
758 None{}
759 case Con{+k, t}:
760 Bool.pick(Maybe<&2, Jwk>, jwk.fits(k, kid, a), Some{k}, jwk.pick(t, kid, a))