anchor.diff:  -spec check_key_pair() -> boolean().
   check_key_pair() ->
       gen_server:call(?MODULE, check_key_pair).
  -
  --spec new(password()) -> {Priv :: binary(), Pub :: binary()} | error.
  -new(Password) ->
  -    gen_server:call(?MODULE, {new, Password}).
  -
  --spec set(password(), binary(), binary()) -> ok | error.
  -set(Password, Priv, Pub) ->
  -    gen_server:call(?MODULE, {set, Password, Priv, Pub}).
   
   -spec delete() -> ok | error.
   delete() ->
  
positive.code:         Err:R ->
              lager:error("New keys not deleted ~p ~p", [Err, R]),
              {reply, error, State}
      end;
  
  handle_call({new, Password}, _From, #state{crypto = C, keys_dir=KeysDir} = State) when is_binary(Password) ->
      try
          {NewPubFile, NewPrivFile} = p_gen_filename(KeysDir),
          {NewPubKey, NewPrivKey} = p_gen_new(Password, C, NewPubFile, NewPrivFile),
          {reply, {ok, NewPubKey}, State#state{priv=NewPrivKey, pub=NewPubKey, pass=Password,
                                               pub_file=NewPubFile, priv_file=NewPrivFile}}
      catch
          Err:R ->
              lager:error("New keys not generated or saved ~p ~p", [Err, R]),
              {reply, error, State}
      end;
  
  handle_call({set, Password, Priv, Pub}, _From, #state{pub_file=PubFile, priv_file=PrivFile} = State) when is_binary(Password) ->
      try
          EncPub = encrypt_pubkey(Password, Pub),
          EncPriv = encrypt_privkey(Password, Priv),
          ok = to_local_dir(PubFile, EncPub),
          ok = to_local_dir(PrivFile, EncPriv),
          {reply, ok, State#state{priv = Priv, pub = Pub}}
      catch
          Err:R ->
              lager:error("Can't set keys ~p ~p", [Err, R]),
              {reply, {error, keys_not_loaded}, State}
      end.
  
  handle_cast(_Msg, State) ->
  
negative.code: -export([init/1, handle_call/3, handle_cast/2, handle_info/2,
           terminate/2, code_change/3]).
  
  -export([sign/1, pubkey/0, delete/0,
           wait_for_pubkey/0]).
  -export([verify/2]).
  -export([check_key_pair/0]).
  