emailpass

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunEmailPassCmd

func RunEmailPassCmd(rt mdk.Runtime, args []string) error

RunEmailPassCmd registers a new user via CLI.

Types

type AuthResponse

type AuthResponse struct {
	Token string    `json:"token"`
	Actor mdk.Actor `json:"actor"`
}

type Module

type Module struct {
	// contains filtered or unexported fields
}

func NewModule

func NewModule(secret, expiration string) *Module

func (*Module) FieldResolvers

func (m *Module) FieldResolvers() map[string]any

func (*Module) ID

func (m *Module) ID() string

func (*Module) Init

func (m *Module) Init(ctx context.Context, rt mdk.Runtime) error

func (*Module) JWTMiddleware added in v0.4.0

func (m *Module) JWTMiddleware(next http.Handler) http.Handler

func (*Module) Login

func (m *Module) Login(ctx context.Context, email, password string) (mdk.Actor, error)

Login verifies credentials and returns the actor.

func (*Module) LoginResolver

func (m *Module) LoginResolver(ctx context.Context, email string, password string) (*AuthResponse, error)

func (*Module) Me

func (m *Module) Me(ctx context.Context) (mdk.Actor, error)

func (*Module) Middlewares added in v0.4.0

func (m *Module) Middlewares() []func(http.Handler) http.Handler

Middlewares implements mdk.MiddlewareProvider interface.

func (*Module) Models

func (m *Module) Models() []any

func (*Module) Mutations

func (m *Module) Mutations() map[string]any

func (*Module) Queries

func (m *Module) Queries() map[string]any

func (*Module) Register

func (m *Module) Register(ctx context.Context, email, password, name string) (mdk.Actor, error)

Register creates a new user and actor.

func (*Module) RegisterResolver

func (m *Module) RegisterResolver(ctx context.Context, email string, password string, name string) (*AuthResponse, error)

func (*Module) Routes

func (m *Module) Routes() []mdk.Route

func (*Module) Shutdown

func (m *Module) Shutdown(ctx context.Context) error

func (*Module) Store

func (m *Module) Store() *jwt.AuthStore

func (*Module) ValidateActor

func (m *Module) ValidateActor(ctx context.Context, input any) (any, error)

ValidateActor is a workflow handler that verifies an actor exists and is active.

func (*Module) ValidateActorStep

func (m *Module) ValidateActorStep(sCtx mdk.StepContext) mdk.StepResult

ValidateActorStep wraps ValidateActor to conform to mdk.StepHandler.

func (*Module) ValidateToken

func (m *Module) ValidateToken(ctx context.Context, token string) (mdk.Actor, error)

ValidateToken implements mdk.TokenValidator interface.

type User

type User struct {
	ID           string         `gorm:"primaryKey" json:"id"`
	Email        string         `gorm:"uniqueIndex;not null" json:"email"`
	PasswordHash string         `gorm:"not null" json:"-"`
	ActorID      string         `gorm:"not null" json:"actor_id"`
	Actor        auth.Actor     `gorm:"foreignKey:ActorID" json:"actor"`
	CreatedAt    time.Time      `json:"created_at"`
	UpdatedAt    time.Time      `json:"updated_at"`
	DeletedAt    gorm.DeletedAt `gorm:"index" json:"-"`
}

User represents a human entity in the system.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL