Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

EthanStandel/simple-chat-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple-chat-api

Deprecating this repo

I've realized that the idea of solving this problem has become far more interesting to me than solving it in Go. Despite how nice Fiber is and how simple Go is to work with, I know that I'll be able to develop faster using simpler technologies. I may undeprecate this repo and come back to make an implementation in Go once I've completed the initial implementation.

Tooling overview

Running locally

Adding environment variables

Copy the contents of .envrc.example into a new file .envrc and then fulfill those variables. If you want automatic loading, be sure to install direnv.

via go run

go run main.go

via executable

go build
simple-chat-api

Technical & security model

  • Uses each users password hash as their JWT signature key. This is slow for initial lookups but the user enitities can be cached to increase performance. The benefit of this model is that all user's sessions can be invalidated by changing their password (must notify cache), while not having to maintain a session ID table and lookups.
  • And the next day I've realized that this^ is a terrible idea in terms of actual client security. First off, this would make it so that anyone with database access would be able to generate a valid token. Second, this would make it so that the real password is actually the hash which is pretty stupid. That means if the DB leaks, bad actors could generate tokens for users at will without even having their passwords.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages