%% @copyright (C) 2014, Jean Parpaillon %% @author Jean Parpaillon %% @doc Defines callbacks for implemeting an SASL authentication %% mechanism. Authentication state machine is implemented in %% @see dbus_peer_conection. %% %% ```-callback init() -> %% {ok, Resp :: binary()} | %% {continue, Resp :: binary(), State :: term()} | %% {error, term()}.''' %% %% Returns a binary to be sent to other side. %% * `{ok, binary()}': state-machine waits for `OK' or `REJECT' %% * `{continue, binary()}': state-machine waits for a challenge (`DATA ...') or `REJECT' %% * `{error, term()}': an error occurred while initializing the mechanism %% %% ```-callback challenge(Chall :: binary(), State :: term()) -> %% {ok, Resp :: binary()} | %% {continue, Resp :: binary(), State :: term()} | %% {error, Reason :: term()}.''' %% %% Called when receiving a challenge from the server. %% Answers has the same meaning as init @see init/0. %% %% See D-Bus Specification %% and RFC 4422. %% for complete specification of the mechanisms. %% %% @end %% Created : 5 Jul 2014 by Jean Parpaillon -module(dbus_auth). -callback init() -> {ok, Resp :: binary()} | {continue, Resp :: binary(), State :: term()} | {error, term()}. -callback challenge(Chall :: binary(), State :: term()) -> {ok, Resp :: binary()} | {continue, Resp :: binary(), State :: term()} | {error, Reason :: term()}.