Use uuid.UUID everywhere and have postgres generate ids
This commit is contained in:
@ -7,6 +7,7 @@ import (
|
||||
"git.javil.eu/jacob1123/budgeteer"
|
||||
"git.javil.eu/jacob1123/budgeteer/postgres"
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// TokenVerifier verifies Tokens
|
||||
@ -18,7 +19,7 @@ type Token struct {
|
||||
username string
|
||||
name string
|
||||
expiry float64
|
||||
id string
|
||||
id uuid.UUID
|
||||
}
|
||||
|
||||
const (
|
||||
@ -65,7 +66,7 @@ func (tv *TokenVerifier) VerifyToken(tokenString string) (budgeteer.Token, error
|
||||
username: claims["usr"].(string),
|
||||
name: claims["name"].(string),
|
||||
expiry: claims["exp"].(float64),
|
||||
id: claims["id"].(string),
|
||||
id: uuid.MustParse(claims["id"].(string)),
|
||||
}
|
||||
return tkn, nil
|
||||
}
|
||||
@ -99,6 +100,6 @@ func (t *Token) GetExpiry() float64 {
|
||||
return t.expiry
|
||||
}
|
||||
|
||||
func (t *Token) GetID() string {
|
||||
func (t *Token) GetID() uuid.UUID {
|
||||
return t.id
|
||||
}
|
||||
|
Reference in New Issue
Block a user