Tokens in the database


My WIP Synapse implementation now checks against tokens stored in a database table. The tokens can have an expiry time and/or a limited number of uses. The table could look a bit like this:

token allowed_usespendingcompletedexpiry_time
abcd NULL 0 3 NULL
limited 1 1 0 NULL
expires 5 0 1 1625102880000

This involved: creating a table; writing functions to check token validity, set a pending use, and complete a use; and storing the token in the UIA session so that the token is only used once registration is complete. There are still a few things to smooth out, but it works pretty well. Next I'll implement the validity checking endpoint, and then probably the fallback too, before getting on to the admin API for managing tokens.



<- Back to index