anchor.diff:  %%% @doc
   %%%     Key manager for AE node
   %%%     * it will open keys that it finds using sys.config
  -%%%     * generating new/1 or setting set/3 keys will fail when another keys are present
   %%%     * delete/0 removes files from the filesystem and from the state (DANGER!)
   %%% @end
   %%% Created : 28 Aug 2017
  
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: -spec check_key_pair() -> boolean().
  check_key_pair() ->
      gen_server:call(?MODULE, check_key_pair).
  
  -spec delete() -> ok | error.
  delete() ->
  