anchor.diff: --module(tts_rest_cred).
  +-module(tts_temp_cred).
   %%
   %% Copyright 2016 SCC/KIT
   %%
  
positive.code: start_link() ->
      gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
  
  -spec add_cred(Credential :: map(), UserId::binary()) -> {ok, Id::binary()}.
  add_cred(Credential, UserId) ->
      gen_server:call(?MODULE, {add, Credential, UserId}).
  
  -spec get_cred(CredId :: binary(), UserId::binary()) -> {ok, Credential::map} |
                                                          {error, Reason::any()}.
  get_cred(Id, UserId) ->
      gen_server:call(?MODULE, {get, Id, UserId}).
  
  -spec stop() -> ok.
  stop() ->
  
negative.code: init([]) ->
      {ok, #state{}}.
  
  handle_call({add,  Cred, UserInfo}, _From, #state{creds = Creds} = State) ->
      UserId = get_userid(UserInfo),
      Id = gen_random_id(State),
      NewCreds = case UserId of
                     undefined -> Creds;
                     _ -> [{Id, UserId, Cred} | Creds]
                 end,
      {reply, {ok, Id}, State#state{creds=NewCreds}};
  handle_call({get, Id, UserInfo}, _From, #state{creds=Creds}=State) ->
      UserId = get_userid(UserInfo),
      case lists:keyfind(Id, 1, Creds) of
          {Id, UserId, Cred} ->
              NewCreds = lists:keydelete(Id, 1, Creds),
  