Postgres module

scram_secret

procedure · 1 overloadsince 0.27.0Source

The SCRAM-SHA-256 secret the server stores for a password, to put in ALTER ROLE ... PASSWORD without the server seeing the password (libpq's PQencryptPasswordConn does the same). The password is prepared with SASLprep. iterations is what the server reports as scram_iterations, 4096 by default.

scram_secret :: (password: string, iterations := 4096) -> string

The SCRAM-SHA-256 secret the server stores for a password, to put in ALTER ROLE ... PASSWORD without the server seeing the password (libpq's PQencryptPasswordConn does the same). The password is prepared with SASLprep. iterations is what the server reports as scram_iterations, 4096 by default.

Parameters

password: string
the plain password.
iterations := 4096
how many rounds of hashing to apply.

Returns

string

See also