diogob / postgres-websockets

PostgreSQL + Websockets
https://hackage.haskell.org/package/postgres-websockets
MIT License
355 stars 28 forks source link

Jwt validate exp #56

Closed diogob closed 4 years ago

diogob commented 4 years ago

This will send a close request to the websocket if the channel was open with a JWT containing an exp claim once the expiration timestamp has passed.

There is a breaking change in the format of the timestamp sent in the message, now we send the POSIX time as an Integer value in nanoseconds. This is for the sake of consistency with the way exp claim is represented (although with a different resolution). Since we are breaking the format I took the oportunity to rename the field to something more JSON friendly, now it's called deliveredAt.

This PR uses verifyClaimsAt instead of verifyClaims so we can use an unified clock function avoiding wasting system resources.

It also adds the library alarmclock to set a concurrent timeout that will close our websocket connection.

It should address #54