aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/auth/jwt.go
diff options
context:
space:
mode:
Diffstat (limited to 'backend/auth/jwt.go')
-rw-r--r--backend/auth/jwt.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/backend/auth/jwt.go b/backend/auth/jwt.go
index e1852da..510656b 100644
--- a/backend/auth/jwt.go
+++ b/backend/auth/jwt.go
@@ -33,6 +33,14 @@ func NewJWT(user *db.User) (string, error) {
return token.SignedString([]byte("TODO"))
}
+func NewAnonymousJWT() (string, error) {
+ claims := jwt.RegisteredClaims{
+ ExpiresAt: jwt.NewNumericDate(time.Now().Add(time.Minute * 5)),
+ }
+ token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
+ return token.SignedString([]byte("TODO"))
+}
+
func NewShortLivedJWT(claims *JWTClaims) (string, error) {
newClaims := &JWTClaims{
UserID: claims.UserID,