View Source fast_scram (fast_scram v0.6.1)
SCRAM implementation, see the README
for details.
Summary
Types
Configuration for SCRAM, see the README
for details.
See server-error-message
at https://datatracker.ietf.org/doc/html/rfc5802#section-7
.
See client-final-message
and server-final-message
at https://datatracker.ietf.org/doc/html/rfc5802#section-7
.
See c-nonce
and s-nonce
at https://datatracker.ietf.org/doc/html/rfc5802#section-7
.
Callback to extract the configuration given a username.
Supported underlying hashing algorithms.
Username for the algorithm.
Functions
See Hi(str, salt, i)
at https://datatracker.ietf.org/doc/html/rfc5802#section-2.2
Types
-type auth_keys() :: password | salted_password | client_key | stored_key | server_key.
-type challenge() :: #challenge{salt :: binary(), it_count :: pos_integer()}.
-type channel_binding() :: #channel_binding{variant :: fast_scram:plus_variant(), data :: binary()}.
-type configuration() :: #{entity := client | server, hash_method := sha_type(), _ => _}.
Configuration for SCRAM, see the README
for details.
-type error_message() :: binary().
See server-error-message
at https://datatracker.ietf.org/doc/html/rfc5802#section-7
.
-type final_message() :: binary().
See client-final-message
and server-final-message
at https://datatracker.ietf.org/doc/html/rfc5802#section-7
.
-type next_message() :: binary().
See c-nonce
and s-nonce
at https://datatracker.ietf.org/doc/html/rfc5802#section-7
.
-type plus_variant() :: undefined | none | binary().
-type retrieve_mechanism() :: fun((username()) -> configuration()) | fun((username(), state()) -> {configuration(), state()}).
Callback to extract the configuration given a username.
Required for the server.
-type sha_type() :: crypto:sha1() | crypto:sha2().
Supported underlying hashing algorithms.
-type state() :: #fast_scram_state{step :: 1..6, nonce :: fast_scram:nonce(), challenge :: fast_scram:challenge(), channel_binding :: fast_scram:channel_binding(), scram_definitions :: fast_scram:definitions(), data :: map()}.
-type username() :: binary().
Username for the algorithm.
Required for a client.
-type username_to_config() :: fun((username()) -> configuration()).
-type username_to_state() :: fun((username(), state()) -> {configuration(), state()}).
Functions
-spec hi(sha_type(), binary(), binary(), non_neg_integer()) -> binary().
See Hi(str, salt, i)
at https://datatracker.ietf.org/doc/html/rfc5802#section-2.2
-spec mech_new(configuration()) -> {ok, state()} | {error, term()}.
-spec mech_step(state(), binary()) -> {ok, final_message(), state()} | {continue, next_message(), state()} | {error, error_message(), state()}.
-spec salted_password(sha_type(), binary(), binary(), non_neg_integer()) -> binary().