privacy

package
v0.0.0-...-bdfed93 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteArchive

func WriteArchive(w io.Writer, data ExportData, files map[string][]byte) error

WriteArchive builds a standard ZIP archive containing formatted JSON files and decrypted documents.

Types

type AnswerSummary

type AnswerSummary struct {
	Question string `json:"question"`
	Answer   string `json:"answer"`
}

AnswerSummary is one entry in the answer bank.

type ApplicationService

type ApplicationService interface {
	UserApplications(ctx context.Context, userID uuid.UUID) ([]application.ApplicationSummary, error)
	UserScreenshots(ctx context.Context, userID uuid.UUID) ([]string, error)
	Settings(ctx context.Context, userID uuid.UUID) (application.Settings, error)
	PurgeExpiredScreenshots(ctx context.Context, blobs application.ScreenshotDeleter) (int, error)
}

ApplicationService supplies application history and screenshot keys.

type ApplicationSummary

type ApplicationSummary struct {
	ID        uuid.UUID      `json:"id"`
	JobID     int64          `json:"job_id"`
	State     string         `json:"state"`
	Company   string         `json:"company"`
	Title     string         `json:"title"`
	Location  string         `json:"location"`
	URL       string         `json:"url,omitempty"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	Events    []EventSummary `json:"events,omitempty"`
}

ApplicationSummary holds application history.

type AuditSummary

type AuditSummary struct {
	Actor     string         `json:"actor"`
	Code      string         `json:"code"`
	Params    map[string]any `json:"params,omitempty"`
	CreatedAt time.Time      `json:"created_at"`
}

AuditSummary holds audit log entries for the user.

type BlobStore

type BlobStore interface {
	Delete(ctx context.Context, userID uuid.UUID, key string) error
}

BlobStore removes stored files and screenshots.

type DocumentService

type DocumentService interface {
	List(ctx context.Context, userID uuid.UUID) ([]profile.Document, error)
	Read(ctx context.Context, userID, id uuid.UUID) (profile.Document, []byte, error)
}

DocumentService manages the user's uploaded files.

type DocumentSummary

type DocumentSummary struct {
	ID        uuid.UUID `json:"id"`
	Kind      string    `json:"kind"`
	Name      string    `json:"name"`
	Mime      string    `json:"mime"`
	Size      int       `json:"size"`
	CreatedAt time.Time `json:"created_at"`
}

DocumentSummary holds document metadata.

type EventSummary

type EventSummary struct {
	Event string         `json:"event"`
	From  string         `json:"from"`
	To    string         `json:"to"`
	Actor string         `json:"actor"`
	At    time.Time      `json:"at"`
	Data  map[string]any `json:"data,omitempty"`
}

EventSummary is one timeline event of an application.

type ExportData

type ExportData struct {
	ExportedAt   time.Time            `json:"exported_at"`
	User         UserSummary          `json:"user"`
	Passkeys     []PasskeySummary     `json:"passkeys,omitempty"`
	Sessions     []SessionSummary     `json:"sessions,omitempty"`
	Profile      any                  `json:"profile,omitempty"`
	Preferences  any                  `json:"preferences,omitempty"`
	Answers      []AnswerSummary      `json:"answers,omitempty"`
	Texts        []TextSummary        `json:"texts,omitempty"`
	Documents    []DocumentSummary    `json:"documents,omitempty"`
	Matches      []MatchSummary       `json:"matches,omitempty"`
	Applications []ApplicationSummary `json:"applications,omitempty"`
	Settings     SettingsSummary      `json:"settings,omitempty"`
	AuditEvents  []AuditSummary       `json:"audit_events,omitempty"`
}

ExportData is the complete portable data dump of a user.

type IdentityService

type IdentityService interface {
	UserByID(ctx context.Context, id uuid.UUID) (identity.User, error)
	Passkeys(ctx context.Context, userID uuid.UUID) ([]identity.PasskeyInfo, error)
	Sessions(ctx context.Context, userID uuid.UUID, currentToken string) ([]identity.SessionInfo, error)
	AuditEvents(ctx context.Context, userID uuid.UUID) ([]identity.AuditEvent, error)
	DeleteUser(ctx context.Context, userID uuid.UUID) error
	Cleanup(ctx context.Context) error
}

IdentityService supplies identity data and handles user lifecycle.

type ItemService

type ItemService interface {
	Answers(ctx context.Context, userID uuid.UUID) ([]profile.Answer, error)
	TextBlocks(ctx context.Context, userID uuid.UUID) ([]profile.TextBlock, error)
}

ItemService supplies answer bank and text blocks.

type KeyManager

type KeyManager interface {
	Forget(ctx context.Context, userID uuid.UUID) (bool, error)
}

KeyManager handles cryptographic shredding of per-user keys.

type MatchSummary

type MatchSummary struct {
	JobID      int64     `json:"job_id"`
	Title      string    `json:"title"`
	Company    string    `json:"company"`
	Location   string    `json:"location"`
	Workplace  string    `json:"workplace"`
	Score      int       `json:"score"`
	Decision   string    `json:"decision"`
	Reasons    any       `json:"reasons,omitempty"`
	ComputedAt time.Time `json:"computed_at"`
}

MatchSummary holds matched job postings.

type MatchingService

type MatchingService interface {
	UserMatches(ctx context.Context, userID uuid.UUID) ([]matching.MatchSummary, error)
}

MatchingService supplies matched postings.

type PasskeySummary

type PasskeySummary struct {
	Name       string    `json:"name"`
	CreatedAt  time.Time `json:"created_at"`
	LastUsedAt time.Time `json:"last_used_at,omitempty"`
}

PasskeySummary holds passkey metadata without secret credentials.

type PortalSummary

type PortalSummary struct {
	Portal     string    `json:"portal"`
	Status     string    `json:"status"`
	LastUsedAt time.Time `json:"last_used_at,omitempty"`
}

PortalSummary holds portal session metadata.

type ProfileService

type ProfileService interface {
	Get(ctx context.Context, userID uuid.UUID) (profile.Snapshot, error)
}

ProfileService supplies the personal applicant profile.

type Service

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

Service coordinates data export, account erasure with cryptographic shredding, and retention cleanup.

func NewService

func NewService(
	identity IdentityService,
	profile ProfileService,
	items ItemService,
	docs DocumentService,
	apps ApplicationService,
	matching MatchingService,
	keys KeyManager,
	blobs BlobStore,
) *Service

NewService returns a new privacy service.

func (*Service) Cleanup

func (s *Service) Cleanup(ctx context.Context) error

Cleanup performs periodic data retention tasks: expired auth tokens/challenges, unaccepted invitations, and run screenshots past 90 days retention.

func (*Service) DeleteAccount

func (s *Service) DeleteAccount(ctx context.Context, userID uuid.UUID) error

DeleteAccount permanently deletes the user's data from PostgreSQL, deletes all documents and screenshots from the blob store, and cryptographically shreds the per-user data key.

func (*Service) Export

func (s *Service) Export(ctx context.Context, userID uuid.UUID, w io.Writer) error

Export bundles all personal data, history, and uploaded files into a portable ZIP archive.

func (*Service) WithClock

func (s *Service) WithClock(now func() time.Time) *Service

WithClock sets the clock (tests).

type SessionSummary

type SessionSummary struct {
	Method     string    `json:"method"`
	CreatedAt  time.Time `json:"created_at"`
	LastSeenAt time.Time `json:"last_seen_at"`
}

SessionSummary holds session metadata.

type SettingsSummary

type SettingsSummary struct {
	AutonomyLevel    string          `json:"autonomy_level,omitempty"`
	DailyLimit       int             `json:"daily_limit,omitempty"`
	RunnerChoice     string          `json:"runner_choice,omitempty"`
	EasyApplyEnabled bool            `json:"easy_apply_enabled,omitempty"`
	Portals          []PortalSummary `json:"portals,omitempty"`
}

SettingsSummary holds user configuration.

type TextSummary

type TextSummary struct {
	Name     string `json:"name"`
	Language string `json:"language,omitempty"`
	Body     string `json:"body"`
}

TextSummary is one reusable text block.

type UserSummary

type UserSummary struct {
	ID          uuid.UUID `json:"id"`
	Email       string    `json:"email"`
	DisplayName string    `json:"display_name"`
	Role        string    `json:"role"`
	Locale      string    `json:"locale"`
	CreatedAt   time.Time `json:"created_at"`
}

UserSummary holds user account basics.

Jump to

Keyboard shortcuts

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