From 66bd5d2f7fd84eec39d69f4a8f5c435fc978804f Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Thu, 19 Mar 2026 17:14:20 +0000 Subject: Add site passwords --- pkg/auth/provider.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pkg/auth/provider.go') diff --git a/pkg/auth/provider.go b/pkg/auth/provider.go index 0d515ab..e521c8c 100644 --- a/pkg/auth/provider.go +++ b/pkg/auth/provider.go @@ -1,6 +1,7 @@ package auth import ( + "crypto/rand" "time" "github.com/golang-jwt/jwt/v5" @@ -11,9 +12,12 @@ type Authenticator struct { parser *jwt.Parser } -func NewAuthenticator(secretKey []byte) *Authenticator { +func NewAuthenticator() *Authenticator { parser := jwt.NewParser(jwt.WithIssuer("scrapbook"), jwt.WithExpirationRequired()) + secretKey := make([]byte, 32) + rand.Read(secretKey) + a := &Authenticator{ secretKey: secretKey, parser: parser, -- cgit v1.2.3-70-g09d2