Mojtabarezaei4 / Queueomatic

A queue system that can be used for educational purposes or for any other situations where prioritization of individuals is necessary.
https://queueomatic.azurewebsites.net/
MIT License
7 stars 2 forks source link

Add hashids #44

Closed FabianAronsson closed 1 year ago

FabianAronsson commented 1 year ago

Adds support for hashids. We have to change our datamodel ids to ints, otherwise this package will not work.

Closes #29

Mojtabarezaei4 commented 1 year ago

Why does it have to be int? HashIds should not be stored in db

FabianAronsson commented 1 year ago

@Mojtabarezaei4 the hashids are not stored in the database. The package https://hashids.org/net/ does not support encoding strings or Guids, which means our room ids has to be ints.

When you encode something using the hashid package you use a salt which is a string and a number as input. The output is a string and we send this in the handler back to the client for use. When a user wants to connect from the client they send a room id in the form of our hashid which we decode to a int and compare it with our database and grant access to the user if it is a valid id.

Our room id's internally would simply be a self incrementing integer. There is no other solution if we decide to use the hashid package.

FabianAronsson commented 1 year ago

Yes I will change it