func (u Claims) ValidateOwnerClaim(ownerClaim string, userID string) error {
	v, ok := u[ownerClaim]
	if !ok {
		return fmt.Errorf("owner claim '%v' is not present", ownerClaim)
	}
	owner, ok := v.(string)
	if !ok {
		return fmt.Errorf("owner claim '%v' is present, but it has an invalid type '%T'", ownerClaim, v)
	}
	if owner != userID {
		return fmt.Errorf("owner identifier from the token '%v' doesn't match userID '%v' from the device", owner, userID)
	}
	return nil
}
/ Validate that ownerClaim is set and that it matches given user ID
package jwt
import (
	"fmt"
	"time"
	"github.com/golang-jwt/jwt/v4"
	"github.com/plgd-dev/hub/pkg/strings"
	pkgTime "github.com/plgd-dev/hub/pkg/time"
)
type Claims jwt.MapClaims
const (
	ClaimExpiresAt = "exp"
	ClaimScope     = "scope"
	ClaimAudience  = "aud"
	ClaimId        = "jti"
	ClaimIssuer    = "iss"
	ClaimSubject   = "sub"
	ClaimIssuedAt  = "iat"
	ClaimNotBefore = "nbf"
	ClaimClientID  = "client_id"
	ClaimEmail     = "email"
	ClaimName      = "n"
)
func toNum(v interface{}) (time.Time, error) {
	switch val := v.(type) {
	case int64:
		return pkgTime.Unix(val, 0), nil
	case float64:
		return pkgTime.Unix(int64(val), 0), nil
	default:
		return time.Time{}, fmt.Errorf("invalid type '%T'", val)
	}
}
func (u Claims) ExpiresAt() (time.Time, error) {
	const expKey = ClaimExpiresAt
	v, ok := u[expKey]
	if !ok {
		return time.Time{}, nil
	}
	exp, err := toNum(v)
	if err != nil {
		return time.Time{}, fmt.Errorf("expiration claim('%v') is present, but it has an %w", v, err)
	}
	return exp, nil
}