aidk
This commit is contained in:
@@ -20,7 +20,7 @@ func GetToken(client *Client) (string, error) {
|
||||
return token.SignedString(secretKey)
|
||||
}
|
||||
|
||||
func GetDataFromToken(token *string) (uint32, error) {
|
||||
func GetClientIdFromToken(token *string) (uint32, error) {
|
||||
parsed, err := jwt.ParseWithClaims(*token, &jwt.RegisteredClaims{}, func(t *jwt.Token) (any, error) {
|
||||
if _, ok := t.Method.(*jwt.SigningMethodHMAC); !ok {
|
||||
return nil, jwt.ErrSignatureInvalid
|
||||
@@ -42,12 +42,3 @@ func GetDataFromToken(token *string) (uint32, error) {
|
||||
}
|
||||
return uint32(id), nil
|
||||
}
|
||||
|
||||
func SetClientFromToken(client *Client, token string) error {
|
||||
id, err := GetDataFromToken(&token)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
client.Id = id
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user