anchor.diff:  id_to_binary(Bin) when is_binary(Bin) -> Bin.
   binary_to_id(Bin) -> Bin.
   
  +-spec grant(perm(), #cred{}) -> #cred{}.
   grant(Perm, Cred = #cred{perms = Perms}) ->
       valid = valid_perm(Perm),
       NewPerms = ordsets:add_element(Perm, Perms),
       Cred#cred{perms = NewPerms}.
   
  +-spec valid_perm(any()) -> 'valid' | 'invalid'.
   valid_perm(full_api) -> valid;
   valid_perm(any_channel) -> valid;
   valid_perm({channel, Id}) when is_integer(Id) -> valid;
   valid_perm(_) -> invalid.
   
  +-spec has_perm(perm(), #cred{}) -> 'permitted' | 'not_permitted'.
   has_perm(Perm, Cred = #cred{}) ->
       case ordsets:is_element(Perm, perms(Cred)) of
           true -> permitted;
           false -> not_permitted
       end.
   
  +
  +-spec verify_basic(string() | binary()) ->
  +                          {'authorized', #cred{}} |
  +                          {'error', term()}.
   verify_basic(BasicAuthStr) ->
       try binary:split(base64:decode(BasicAuthStr), <<":">>) of
           [Id, Pass] ->
  
positive.code:             {error, invalid_encoding}
      end.
  
  auth(Id, Pass) when is_binary(Id), is_binary(Pass) ->
      case lookup(Id) of
          no_such_cred ->
  
negative.code: delete(Id) ->
      ets:delete(?CRED_TAB, Id).
  
  -spec lookup(id()) -> #cred{}.
  lookup(Id) ->
      case ets:lookup(?CRED_TAB, Id) of
          [Cred = #cred{}] -> Cred;
  