User login and creation

This commit is contained in:
Caleb Gardner
2024-05-24 04:26:24 -05:00
parent e4f8b31e29
commit 144f45293b
4 changed files with 156 additions and 18 deletions
+7 -4
View File
@@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"net/http"
"sync"
"time"
)
@@ -12,16 +13,18 @@ type Backend struct {
userTable Table[User]
keyTable Table[ApiKey]
m *http.ServeMux
apps map[string]App
jwtPriv ed25519.PrivateKey
jwtPub ed25519.PublicKey
apps map[string]App
userMutex sync.RWMutex
}
func NewBackend(keyTable Table[ApiKey], apps ...App) (*Backend, error) {
b := &Backend{
keyTable: keyTable,
m: &http.ServeMux{},
apps: make(map[string]App),
keyTable: keyTable,
m: &http.ServeMux{},
apps: make(map[string]App),
userMutex: sync.RWMutex{},
}
var hasLog, hasCrash bool
for i := range apps {