def decode_len
import bend-collections@1.0.0.0/spec/crypto/secp256k1/curve.bend as Curveimport Base
288# a compressed (33 bytes) or uncompressed (65 bytes) public key; None when
289# malformed, a coordinate is not below p, or the point is not on the curve
290def decode_len(+p: Nat, +bs: List<&2, U32>, c33: Bool, c65: Bool) -> Maybe<&2, SPoint>:
291 match c33 c65:
292 case True{} _: decode_c(p, head(bs), os2ip(after(1n, bs)))
293 case False{} True{}: decode_u(p, head(bs), os2ip(first(32n, after(1n, bs))), os2ip(after(33n, bs)))
294 case False{} False{}: None{}