Versions in this module Expand all Collapse all v0 v0.0.14 Jan 4, 2026 v0.0.13 Jan 3, 2026 v0.0.12 Jan 3, 2026 v0.0.11 Jan 3, 2026 v0.0.10 Jan 3, 2026 v0.0.9 Jan 3, 2026 v0.0.8 Dec 31, 2025 v0.0.7 Dec 29, 2025 v0.0.6 Dec 17, 2025 v0.0.5 Dec 12, 2025 v0.0.4 Dec 8, 2025 v0.0.3 Dec 8, 2025 v0.0.2 Nov 24, 2025 v0.0.1 Nov 20, 2025 Changes in this version + const CodeCannotSignWithoutPrivate + const CodeCannotVerifyWithoutPublic + const CodeInvalidJWTAlgorithm + const CodeInvalidJWTAudience + const CodeInvalidJWTClaims + const CodeInvalidJWTKeyType + const CodeInvalidJWTTokenType + const CodeJWKSGenerationFailed + const CodeJWTGenerationFailed + const CodeJWTKeyAlreadyExists + const CodeJWTKeyDecryptionFailed + const CodeJWTKeyEncryptionFailed + const CodeJWTKeyExpired + const CodeJWTKeyGenerationFailed + const CodeJWTKeyInactive + const CodeJWTKeyNotFound + const CodeJWTParsingFailed + const CodeJWTSigningFailed + const CodeJWTVerificationFailed + const CodeMissingKIDHeader + const CodeNoActiveSigningKey + var ErrCannotSignWithoutPrivate = &errs.AuthsomeError + var ErrCannotVerifyWithoutPublic = &errs.AuthsomeError + var ErrInvalidJWTAlgorithm = &errs.AuthsomeError + var ErrInvalidJWTAudience = &errs.AuthsomeError + var ErrInvalidJWTClaims = &errs.AuthsomeError + var ErrInvalidJWTKeyType = &errs.AuthsomeError + var ErrInvalidJWTTokenType = &errs.AuthsomeError + var ErrJWKSGenerationFailed = &errs.AuthsomeError + var ErrJWTGenerationFailed = &errs.AuthsomeError + var ErrJWTKeyAlreadyExists = &errs.AuthsomeError + var ErrJWTKeyDecryptionFailed = &errs.AuthsomeError + var ErrJWTKeyEncryptionFailed = &errs.AuthsomeError + var ErrJWTKeyExpired = &errs.AuthsomeError + var ErrJWTKeyGenerationFailed = &errs.AuthsomeError + var ErrJWTKeyInactive = &errs.AuthsomeError + var ErrJWTKeyNotFound = &errs.AuthsomeError + var ErrJWTParsingFailed = &errs.AuthsomeError + var ErrJWTSigningFailed = &errs.AuthsomeError + var ErrJWTVerificationFailed = &errs.AuthsomeError + var ErrMissingKIDHeader = &errs.AuthsomeError + var ErrNoActiveSigningKey = &errs.AuthsomeError + func CannotSignWithoutPrivateKey() *errs.AuthsomeError + func CannotVerifyWithoutPublicKey() *errs.AuthsomeError + func InvalidJWTAlgorithm(algorithm string) *errs.AuthsomeError + func InvalidJWTAudience(expected, actual []string) *errs.AuthsomeError + func InvalidJWTClaims(reason string) *errs.AuthsomeError + func InvalidJWTKeyType(keyType string) *errs.AuthsomeError + func InvalidJWTTokenType(expected, actual string) *errs.AuthsomeError + func JWKSGenerationFailed(err error) *errs.AuthsomeError + func JWTGenerationFailed(reason string) *errs.AuthsomeError + func JWTKeyAlreadyExists(keyID string) *errs.AuthsomeError + func JWTKeyDecryptionFailed(err error) *errs.AuthsomeError + func JWTKeyEncryptionFailed(err error) *errs.AuthsomeError + func JWTKeyExpired(keyID string) *errs.AuthsomeError + func JWTKeyGenerationFailed(err error) *errs.AuthsomeError + func JWTKeyInactive(keyID string) *errs.AuthsomeError + func JWTKeyNotFound() *errs.AuthsomeError + func JWTParsingFailed(err error) *errs.AuthsomeError + func JWTSigningFailed(err error) *errs.AuthsomeError + func JWTVerificationFailed(reason string) *errs.AuthsomeError + func MissingKIDHeader() *errs.AuthsomeError + func NoActiveSigningKey(appID string) *errs.AuthsomeError + type Config struct + DefaultTTL string + EncryptionKey string + type CreateJWTKeyRequest struct + Algorithm string + AppID xid.ID + Curve string + ExpiresAt *time.Time + IsPlatformKey bool + KeyType string + Metadata map[string]interface{} + type GenerateTokenRequest struct + AppID xid.ID + Audience []string + ExpiresIn time.Duration + Metadata map[string]interface{} + Permissions []string + Scopes []string + SessionID string + TokenType string + UserID string + type GenerateTokenResponse struct + ExpiresAt time.Time + ExpiresIn int64 + Token string + TokenType string + type JWK struct + Algorithm string + Curve string + E string + KeyID string + KeyOps []string + KeyType string + N string + Use string + X string + Y string + type JWKSResponse = pagination.PageResponse[JWK] + type JWTKey struct + Algorithm string + AppID xid.ID + CreatedAt time.Time + Curve string + DeletedAt *time.Time + ExpiresAt *time.Time + ID xid.ID + IsActive bool + IsPlatformKey bool + KeyID string + KeyType string + LastUsedAt *time.Time + Metadata map[string]interface{} + PrivateKey string + PublicKey string + UpdatedAt time.Time + UsageCount int64 + func FromSchemaJWTKey(sk *schema.JWTKey) *JWTKey + func FromSchemaJWTKeys(keys []*schema.JWTKey) []*JWTKey + func (k *JWTKey) CanSign() bool + func (k *JWTKey) CanVerify() bool + func (k *JWTKey) IsExpired() bool + func (k *JWTKey) ToSchema() *schema.JWTKey + type ListJWTKeysFilter struct + Active *bool + AppID xid.ID + IsPlatformKey *bool + type ListJWTKeysResponse = pagination.PageResponse[*JWTKey] + type Repository interface + CleanupExpiredJWTKeys func(ctx context.Context) (int64, error) + CountJWTKeys func(ctx context.Context, appID xid.ID) (int, error) + CreateJWTKey func(ctx context.Context, key *schema.JWTKey) error + DeactivateJWTKey func(ctx context.Context, id xid.ID) error + DeleteJWTKey func(ctx context.Context, id xid.ID) error + FindJWTKeyByID func(ctx context.Context, id xid.ID) (*schema.JWTKey, error) + FindJWTKeyByKeyID func(ctx context.Context, keyID string, appID xid.ID) (*schema.JWTKey, error) + FindPlatformJWTKeyByKeyID func(ctx context.Context, keyID string) (*schema.JWTKey, error) + ListJWTKeys func(ctx context.Context, filter *ListJWTKeysFilter) (*pagination.PageResponse[*schema.JWTKey], error) + ListPlatformJWTKeys func(ctx context.Context, filter *ListJWTKeysFilter) (*pagination.PageResponse[*schema.JWTKey], error) + UpdateJWTKey func(ctx context.Context, key *schema.JWTKey) error + UpdateJWTKeyUsage func(ctx context.Context, keyID string) error + type Service struct + func NewService(config Config, repo Repository, auditSvc *audit.Service) *Service + func (s *Service) CleanupExpired(ctx context.Context) (int64, error) + func (s *Service) CreateJWTKey(ctx context.Context, req *CreateJWTKeyRequest) (*JWTKey, error) + func (s *Service) GenerateToken(ctx context.Context, req *GenerateTokenRequest) (*GenerateTokenResponse, error) + func (s *Service) GetJWKS(ctx context.Context, appID xid.ID) (*JWKSResponse, error) + func (s *Service) ListJWTKeys(ctx context.Context, filter *ListJWTKeysFilter) (*ListJWTKeysResponse, error) + func (s *Service) VerifyToken(ctx context.Context, req *VerifyTokenRequest) (*VerifyTokenResponse, error) + type TokenClaims struct + AppID string + Audience []string + ExpiresAt *jwt.NumericDate + IssuedAt *jwt.NumericDate + Issuer string + JwtID string + KeyID string + Metadata map[string]interface{} + NotBefore *jwt.NumericDate + Permissions []string + Scopes []string + SessionID string + Subject string + TokenType string + UserID string + type VerifyTokenRequest struct + AppID xid.ID + Audience []string + Token string + TokenType string + type VerifyTokenResponse struct + AppID string + Claims *TokenClaims + Error string + ExpiresAt *time.Time + Permissions []string + Scopes []string + SessionID string + UserID string + Valid bool