fix: switch the protobuf extension
All checks were successful
Check / check (push) Successful in 52s

This commit is contained in:
2025-05-16 14:58:43 -04:00
parent 92877b669e
commit 2da7526265
5 changed files with 11 additions and 9 deletions

View File

@ -81,8 +81,8 @@ jobs:
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: ${{ vars.URL }} registry: ${{ vars.URL }}
username: ${{ vars.USERNAME }} username: ${{ github.actor }}
password: ${{ secrets.PASSWORD }} password: ${{ secrets.PAT }}
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3

View File

@ -2,7 +2,7 @@
"recommendations": [ "recommendations": [
"golang.go", "golang.go",
"dorzey.vscode-sqlfluff", "dorzey.vscode-sqlfluff",
"zxh404.vscode-proto3", "bufbuild.vscode-buf",
"dbaeumer.vscode-eslint", "dbaeumer.vscode-eslint",
"svelte.svelte-vscode", "svelte.svelte-vscode",
"esbenp.prettier-vscode" "esbenp.prettier-vscode"

View File

@ -18,8 +18,8 @@
}, },
// Proto // Proto
"[proto3]": { "[proto]": {
"editor.defaultFormatter": "zxh404.vscode-proto3" "editor.defaultFormatter": "bufbuild.vscode-buf"
}, },
// ESLint // ESLint

View File

@ -68,7 +68,7 @@ func main() {
// Serve gRPC Handlers // Serve gRPC Handlers
api := http.NewServeMux() api := http.NewServeMux()
api.Handle(interceptors.WithCORS(user.NewAuthHandler(vi, sqlc, webAuthn, name, env.Key))) api.Handle(interceptors.WithCORS(user.NewAuthHandler(vi, sqlc, webAuthn, name, env.Key)))
api.Handle(interceptors.WithCORS(user.NewHandler(vi, sqlc, webAuthn, env.Key))) api.Handle(interceptors.WithCORS(user.NewHandler(vi, sqlc, webAuthn, name, env.Key)))
api.Handle(interceptors.WithCORS(item.NewHandler(vi, sqlc, env.Key))) api.Handle(interceptors.WithCORS(item.NewHandler(vi, sqlc, env.Key)))
// Serve web interface // Serve web interface

View File

@ -36,6 +36,7 @@ type Handler struct {
db *sqlc.Queries db *sqlc.Queries
webAuthn *webauthn.WebAuthn webAuthn *webauthn.WebAuthn
key []byte key []byte
name string
sessions *map[int64]*webauthn.SessionData sessions *map[int64]*webauthn.SessionData
mu sync.Mutex mu sync.Mutex
@ -132,7 +133,7 @@ func (h *Handler) GetAPIKey(ctx context.Context, req *connect.Request[userv1.Get
// Generate JWT // Generate JWT
t := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.RegisteredClaims{ t := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.RegisteredClaims{
Issuer: "trevstack", Issuer: h.name,
Subject: strconv.FormatInt(user.ID, 10), Subject: strconv.FormatInt(user.ID, 10),
IssuedAt: &jwt.NumericDate{ IssuedAt: &jwt.NumericDate{
Time: time.Now(), Time: time.Now(),
@ -341,8 +342,8 @@ func transportsToString(transports []protocol.AuthenticatorTransport) string {
return s return s
} }
func NewHandler(vi *validate.Interceptor, db *sqlc.Queries, webauth *webauthn.WebAuthn, key string) (string, http.Handler) { func NewHandler(vi *validate.Interceptor, db *sqlc.Queries, webauth *webauthn.WebAuthn, name string, key string) (string, http.Handler) {
interceptors := connect.WithInterceptors(interceptors.NewAuthInterceptor(key), vi) interceptors := connect.WithInterceptors(vi, interceptors.NewAuthInterceptor(key))
sd := map[int64]*webauthn.SessionData{} sd := map[int64]*webauthn.SessionData{}
return userv1connect.NewUserServiceHandler( return userv1connect.NewUserServiceHandler(
@ -350,6 +351,7 @@ func NewHandler(vi *validate.Interceptor, db *sqlc.Queries, webauth *webauthn.We
db: db, db: db,
webAuthn: webauth, webAuthn: webauth,
key: []byte(key), key: []byte(key),
name: name,
sessions: &sd, sessions: &sd,
mu: sync.Mutex{}, mu: sync.Mutex{},