def sasl.final
bend-kit-postgres@0.3.0.0 · postgres.bend:264
import bend-kit-postgres@0.3.0.0/postgres.bend as Postgres
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
import bend-kit-postgres@0.3.0.0/codec.bend as Codec
import bend-kit-postgres@0.3.0.0/scram.bend as Scram
264
265def sasl.final(fin: Scram.Final, r: Result<&1, &1, Failure, Conn & Codec.Back>) -> IO(Result<&1, &1, Failure, Conn>):
266 match r:
267 case Fail{e}:
268 IO.pure(Result<&1, &1, Failure, Conn>, Fail{e})
269 case Done{(c, m)}:
270 match m:
271 case Codec.AuthSASLFinal{data}:
272 do IO<Result<&1, &1, Failure, Conn>>:
273 v : Result<&1, &1, U32 & String, Unit> <- Scram.verify(fin, Bytes.to_string(data))
274 sasl.verified(c, v)
275 case Codec.ErrorResponse{fs}:
276 reject(Conn, c, fs)
277 case _:
278 abort(Conn, c, Malformed{})