PostgreSQL authentication handshakes: trust (AuthenticationOk),
cleartext password, MD5, and SASL/SCRAM-SHA-256. Internal to the pg
package. Each handshake consumes backend messages through the final
AuthenticationOk, leaving the socket positioned for ParameterStatus.
On success these return true; on failure they return a
Result.Err carrying the PostgreSQL error details, which
::pg/connect propagates to its caller.
Values
AUTH-CLEARTEXT
AUTH-CLEARTEXT: Int 3
AUTH-MD5
AUTH-MD5: Int 5
AUTH-OK
AUTH-OK: Int 0
AUTH-SASL
AUTH-SASL: Int 10
AUTH-SASL-CONTINUE
AUTH-SASL-CONTINUE: Int 11
AUTH-SASL-FINAL
AUTH-SASL-FINAL: Int 12
GS2-HEADER-B64
GS2-HEADER-B64: Str "biws"
MECHANISM
MECHANISM: Str "SCRAM-SHA-256"
Functions
auth-code
fn (msg: Map): Int
do-cleartext
fn (socket, password: Str): Any
do-md5
fn (socket, user: Str, password: Str, salt: Bytes): Any
do-scram
fn (socket, password: Str, msg: Map): Any
err-pg
fn (payload: Bytes): Any
expect-auth-ok
fn (socket): Any
parse-scram-attrs
fn (s: Str): Map
run-auth
fn (socket, user: Str, password: Str, msg: Map): Any
Handle the authentication exchange given the first Authentication
('R') message. Returns true once authenticated, or an Err with the
failure details.
scram-finish
fn (socket, password: Str, client-nonce: Str, client-first-bare: Str, server-first: Str): Any
verify-server-signature
fn (salted: Bytes, auth-message: Str, server-final: Str): Any