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
with:
registry: ${{ vars.URL }}
username: ${{ vars.USERNAME }}
password: ${{ secrets.PASSWORD }}
username: ${{ github.actor }}
password: ${{ secrets.PAT }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

View File

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

View File

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

View File

@ -68,7 +68,7 @@ func main() {
// Serve gRPC Handlers
api := http.NewServeMux()
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)))
// Serve web interface

View File

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