Search tokens

The idea behind search tokens is to not to store in the server contact information of the participants - and to have ability to search for it, restore access using, say, email and so on.

It is done by using search tokens, the specialized hash functions, syntex, of the real information. This way we do not expose directly the personal contact information.

Therefore, if the party knows, say, the exact email address, it can search for a party with this address - after calculatuing the hash of the normalized address.

As for now Attesta supports 2 types of search tokens: email tokens, phone tokens (mobile phones only) and nicks.

Calculating token

Note that token calculation is normally done in the client and therefore it is crucial to implement in in a correct way. For Attesta provides also ways to calculate token for the application, it requires transmitting information over the netword (using secure connection, anyway), but the information will not be stored on the server.

From nick

Nicks are unique accross the system. The party can have up to 5 nicks simultaneously, add and delete tiem at any moment. Deleted nicks are kept on quarantine for significant time before could be re-used. To get the nicks the same and non-confusing for all participants, it should be normalized first.

To do itm strip leading and trailing spaces. Replace all sequences of space character (newline, tab space, unbreakable space, whatever) to exactly one space character convert to lower case (using Unicode rules, e.g. taking care of national characters), encode to UTF-8 and calculate syntex hah.

Note that normalized nick should be at least 4 characters length.

From email

Strip leading and trailing spaces, convert to lower case and calculate it's syntex hash.

From phone number

Convert phone number to the international format +, and remove all non-digit characters except the leading plus sign (e.g. any spaces, dahes, parenteses), and calculate syntex hash of it.

searchable tokens

Searchable tokens allow other parties to discover it. Non-searchable tokens can be used only by the owner to login and restore connections. The searchble state of the token can be changed at any time by it's owner.

Add nick

Requires authentication.

token_add_nick( (nick_token: <binary> | nick: <stiting>) [, searchable: false  }
    -> { token: <binary-token> } 
  • only one of nick_token or nick is allowed. I the latter case Atteta calculates the token for the client.

  • searchable: defaults to false. Set to true to allow other parties to find it.

return value: null if the token is already registered by the other party, otherwise binary token value.

This method can be called for already registered token to change its searchable state.

Removing token

Requires authentication. Works for all types of the nicks.

token_remove(token: <binary-token>)
    -> {}

Throws an error if the token is not found (also if is already removed).