Versions in this module Expand all Collapse all v0 v0.10.0 Sep 6, 2026 Changes in this version + const APIKeyBytes + const APIKeyPrefix + type CreateAPIKeyInput struct + ExpiresAt *time.Time + Metadata map[string]any + Name string + PrincipalID uuid.UUID + Scopes []string + type CreateClientSecretInput struct + ExpiresAt *time.Time + Metadata map[string]any + Name string + PrincipalID uuid.UUID + type CreateKeypairInput struct + ExpiresAt *time.Time + KeyAlgorithm string + Metadata map[string]any + Name string + PrincipalID uuid.UUID + PublicKeyPEM string + Scopes []string + type CreatePasswordInput struct + Password string + PrincipalID uuid.UUID + type Credential struct + Active bool + CreatedAt time.Time + ExpiresAt *time.Time + ID uuid.UUID + Identifier string + LastUsedAt *time.Time + LastUsedIP string + Metadata map[string]any + Name string + PrincipalID uuid.UUID + Revoked bool + RevokedAt *time.Time + RevokedReason string + Scopes []string + Type Type + UpdatedAt time.Time + type DefaultService struct + func (s *DefaultService) CreateAPIKey(ctx context.Context, input CreateAPIKeyInput) (*GeneratedAPIKey, error) + func (s *DefaultService) CreateClientSecret(ctx context.Context, input CreateClientSecretInput) (*GeneratedClientSecret, error) + func (s *DefaultService) CreateKeypair(ctx context.Context, input CreateKeypairInput) (*KeypairCredential, error) + func (s *DefaultService) CreatePassword(ctx context.Context, input CreatePasswordInput) error + func (s *DefaultService) GetByID(ctx context.Context, id uuid.UUID) (*Credential, error) + func (s *DefaultService) GetKeypairByKeyID(ctx context.Context, keyID string) (*KeypairCredential, error) + func (s *DefaultService) ListAPIKeys(ctx context.Context, principalID uuid.UUID) ([]*Credential, error) + func (s *DefaultService) ListKeypairs(ctx context.Context, principalID uuid.UUID) ([]*KeypairCredential, error) + func (s *DefaultService) Revoke(ctx context.Context, id uuid.UUID, reason string) error + func (s *DefaultService) UpdateLastUsed(ctx context.Context, id uuid.UUID, ip string) error + func (s *DefaultService) UpdatePassword(ctx context.Context, principalID uuid.UUID, newPassword string) error + func (s *DefaultService) ValidateAPIKey(ctx context.Context, plainKey string) (*Credential, error) + func (s *DefaultService) ValidateClientSecret(ctx context.Context, clientID, plainSecret string) (*Credential, error) + func (s *DefaultService) VerifyPassword(ctx context.Context, principalID uuid.UUID, password string) (bool, error) + type GeneratedAPIKey struct + Credential *Credential + PlainKey string + Prefix string + type GeneratedClientSecret struct + Credential *Credential + PlainSecret string + Prefix string + type KeypairCredential struct + Credential *Credential + KeyAlgorithm string + KeyID string + PublicKeyPEM string + type Service interface + CreateAPIKey func(ctx context.Context, input CreateAPIKeyInput) (*GeneratedAPIKey, error) + CreateClientSecret func(ctx context.Context, input CreateClientSecretInput) (*GeneratedClientSecret, error) + CreateKeypair func(ctx context.Context, input CreateKeypairInput) (*KeypairCredential, error) + CreatePassword func(ctx context.Context, input CreatePasswordInput) error + GetByID func(ctx context.Context, id uuid.UUID) (*Credential, error) + GetKeypairByKeyID func(ctx context.Context, keyID string) (*KeypairCredential, error) + ListAPIKeys func(ctx context.Context, principalID uuid.UUID) ([]*Credential, error) + ListKeypairs func(ctx context.Context, principalID uuid.UUID) ([]*KeypairCredential, error) + Revoke func(ctx context.Context, id uuid.UUID, reason string) error + UpdateLastUsed func(ctx context.Context, id uuid.UUID, ip string) error + UpdatePassword func(ctx context.Context, principalID uuid.UUID, newPassword string) error + ValidateAPIKey func(ctx context.Context, plainKey string) (*Credential, error) + ValidateClientSecret func(ctx context.Context, clientID, plainSecret string) (*Credential, error) + VerifyPassword func(ctx context.Context, principalID uuid.UUID, password string) (bool, error) + func NewService(client *ent.Client) Service + type Type string + const TypeAPIKey + const TypeClientSecret + const TypeKeypair + const TypePassword + const TypeTOTP + const TypeWebAuthn