Documentation ¶
Index ¶
- Variables
- type BaseModel
- type ClientModel
- type ClientRepository
- type DB
- type OAuthRepository
- type OAuthTokenCategory
- type OAuthTokenModel
- type Passkey
- type PermissionsModel
- type SessionModel
- type SessionRepository
- type SystemRepository
- type TokenCategory
- type TokenModel
- type TokenRepository
- type UserModel
- type UserRepository
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoRecord = errors.New("no matching record found") ErrExists = errors.New("already exists") )
Functions ¶
This section is empty.
Types ¶
type ClientModel ¶
type ClientRepository ¶
type ClientRepository interface { Find(ctx context.Context, id ulid.ULID) (*ClientModel, error) FindByUserAndID(ctx context.Context, userID, id ulid.ULID) (*ClientModel, error) FindByUser(ctx context.Context, userID ulid.ULID) ([]*ClientModel, error) Create(ctx context.Context, userID ulid.ULID, name, description string, website *url.URL, redirectURIs []*url.URL, secretHash []byte) (*ClientModel, error) Update(ctx context.Context, userID, id ulid.ULID, name, description string, website *url.URL, redirectURIs []*url.URL) (*ClientModel, error) UpdateSecret(ctx context.Context, userID, id ulid.ULID, newSecretHash []byte) error Delete(ctx context.Context, userID, id ulid.ULID) error }
type DB ¶
type DB interface { NewSystemRepository() SystemRepository NewUserRepository() UserRepository NewSessionRepository() SessionRepository NewTokenRepository() TokenRepository NewClientRepository() ClientRepository NewOAuthRepository() OAuthRepository Close() error }
type OAuthRepository ¶
type OAuthRepository interface { Create(ctx context.Context, clientID, userID ulid.ULID, category OAuthTokenCategory, tokenHash []byte, redirectURI *url.URL, scopes []string, data []byte, lifetime time.Duration) (*OAuthTokenModel, error) Find(ctx context.Context, category OAuthTokenCategory, tokenHash []byte) (*OAuthTokenModel, error) Use(ctx context.Context, clientID ulid.ULID, category OAuthTokenCategory, tokenHash []byte) error Delete(ctx context.Context, clientID ulid.ULID, category OAuthTokenCategory, tokenHash []byte) error DeleteByUser(ctx context.Context, clientID, userID ulid.ULID) error SetPermissions(ctx context.Context, clientID, userID ulid.ULID, scopes []string) (*PermissionsModel, error) FindPermissions(ctx context.Context, clientID, userID ulid.ULID) (*PermissionsModel, error) RevokePermissions(ctx context.Context, clientID, userID ulid.ULID) error }
type OAuthTokenCategory ¶
type OAuthTokenCategory string
var ( OAuthTokenCode OAuthTokenCategory = "code" OAuthTokenAccess OAuthTokenCategory = "access" OAuthTokenRefresh OAuthTokenCategory = "refresh" )
type OAuthTokenModel ¶
type Passkey ¶
type Passkey struct { BaseModel Name string UserID ulid.ULID Credential webauthn.Credential }
type PermissionsModel ¶
type SessionRepository ¶
type SessionRepository interface { scs.Store scs.CtxStore scs.IterableStore scs.IterableCtxStore }
type SystemRepository ¶
type TokenCategory ¶
type TokenCategory string
var ( TokenConfirmEmail TokenCategory = "confirm-email" TokenForgotPassword TokenCategory = "forgot-password" TokenInvitation TokenCategory = "invitation" )
type TokenModel ¶
type TokenRepository ¶
type TokenRepository interface { Create(ctx context.Context, category TokenCategory, key string, valueHash []byte, lifetime time.Duration) (*TokenModel, error) Find(ctx context.Context, category TokenCategory, key string) (*TokenModel, error) FindByValue(ctx context.Context, category TokenCategory, valueHash []byte) (*TokenModel, error) Delete(ctx context.Context, category TokenCategory, key string) error }
type UserRepository ¶
type UserRepository interface { Find(ctx context.Context, id ulid.ULID) (*UserModel, error) FindAll(ctx context.Context) ([]*UserModel, error) FindByEmail(ctx context.Context, email string) (*UserModel, error) FindByChangeEmailToken(ctx context.Context, tokenHash []byte) (*UserModel, error) GetPasswordHash(ctx context.Context, userID ulid.ULID) ([]byte, error) GetOTP(ctx context.Context, userID ulid.ULID) (active bool, key *otp.Key, err error) Create(ctx context.Context, name, email string, passwordHash []byte) (*UserModel, error) UpdateName(ctx context.Context, id ulid.ULID, name string) error UpdatePassword(ctx context.Context, id ulid.ULID, passwordHash []byte) error UpdateEmailConfirmed(ctx context.Context, id ulid.ULID, confirmed bool) error UpdateOTP(ctx context.Context, id ulid.ULID, active bool, otpKey *otp.Key) error CreateChangeEmailRequest(ctx context.Context, userID ulid.ULID, newEmail string, tokenHash []byte, lifetime time.Duration) error UpdateEmail(ctx context.Context, changeTokenHash []byte) (string, error) CreateRecoveryCodes(ctx context.Context, userID ulid.ULID, codeHashes [][]byte) error CountRecoveryCodes(ctx context.Context, userID ulid.ULID) (int, error) DeleteRecoveryCode(ctx context.Context, userID ulid.ULID, codeHash []byte) error DeleteRecoveryCodes(ctx context.Context, userID ulid.ULID) error CreateRemember2FAToken(ctx context.Context, userID ulid.ULID, codeHash []byte, lifetime time.Duration) error DeleteRemember2FAToken(ctx context.Context, userID ulid.ULID, codeHash []byte) error DeleteRemember2FATokens(ctx context.Context, userID ulid.ULID) error CheckRemember2FAToken(ctx context.Context, userID ulid.ULID, codeHash []byte) (bool, error) CreatePasskey(ctx context.Context, userID ulid.ULID, name string, credential webauthn.Credential) error GetPasskeys(ctx context.Context, userID ulid.ULID) ([]*Passkey, error) GetPasskey(ctx context.Context, userID, id ulid.ULID) (*Passkey, error) UpdatePasskeyCredential(ctx context.Context, userID ulid.ULID, credential webauthn.Credential) error UpdatePasskey(ctx context.Context, userID, id ulid.ULID, name string) error DeletePasskey(ctx context.Context, userID, id ulid.ULID) error UpdateAdminStatus(ctx context.Context, userID ulid.ULID, isAdmin bool) error Delete(ctx context.Context, id ulid.ULID) error }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.