func GetUserIDFromAPIKey(apiKey string) (string, error) {
	claims := &APIKeyClaims{}
	token, err := jwt.ParseWithClaims(apiKey, claims, func(t *jwt.Token) (interface{}, error) {
		return config.GetInstance().GetJWTSignKey(), nil
	})

	if err != nil {
		return "", err
	}

	if !token.Valid {
		return "", ErrInvalidToken
	}

	return claims.UserID, nil
}
// GetUserIDFromAPIKey validates the provided api key and returns the user ID
GetUserIDFromAPIKey validates the provided api key and returns the user ID
// GetUserIDFromAPIKey validates the provided api key and returns the user ID
func GetUserIDFromAPIKey(apiKey string) (string, error) {
	claims := &APIKeyClaims{}
	token, err := jwt.ParseWithClaims(apiKey, claims, func(t *jwt.Token) (interface{}, error) {
		return config.GetInstance().GetJWTSignKey(), nil
	})
	if err != nil {
		return "", err
	}
	if !token.Valid {
		return "", ErrInvalidToken
	}
	return claims.UserID, nil
}
func GetUserIDFromAPIKey ( apiKey string ) ( string , error ) { claims := & APIKeyClaims { } token , err := jwt . ParseWithClaims ( apiKey , claims , func ( t * jwt . Token ) ( interface { } , error ) { return config . GetInstance ( ) . GetJWTSignKey ( ) , nil } ) if err != nil { return " " , err } if ! token . Valid { return " " , ErrInvalidToken } return claims . UserID , nil }
GetUserIDFromAPIKey validates the provided api key and returns the user ID
GetUserIDFromAPIKey validates the provided api key and returns the user ID