usecase

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	Init() error
	Shutdown()

	// Scan
	SendScanRequest(req *model.ScanRepositoryRequest) error

	// Invoke thread
	InvokeScanThread()

	// DB access proxy
	RegisterRepository(ctx *model.Context, repo *ent.Repository) (*ent.Repository, error)
	UpdateVulnStatus(ctx *model.Context, req *model.UpdateVulnStatusRequest) error
	LookupScanReport(ctx *model.Context, scanID string) (*ent.Scan, error)
	GetRepositories(ctx *model.Context) ([]*ent.Repository, error)
	GetVulnerabilities(ctx *model.Context, offset, limit int64) ([]*ent.Vulnerability, error)
	GetVulnerabilityCount(ctx *model.Context) (int, error)
	GetVulnerability(ctx *model.Context, vulnID string) (*model.RespVulnerability, error)

	// Handle GitHub App Webhook event
	HandleGitHubPushEvent(ctx *model.Context, event *github.PushEvent) error
	HandleGitHubPullReqEvent(ctx *model.Context, event *github.PullRequestEvent) error
	HandleGitHubInstallationEvent(ctx *model.Context, event *github.InstallationEvent) error
	VerifyGitHubSecret(sigSHA256 string, body []byte) error

	// Auth
	CreateAuthState(ctx *model.Context) (string, error)
	AuthGitHubUser(ctx *model.Context, code, state string) (*ent.User, error)
	LookupUser(ctx *model.Context, userID int) (*ent.User, error)
	CreateSession(ctx *model.Context, user *ent.User) (*ent.Session, error)
	ValidateSession(ctx *model.Context, ssnID string) (*ent.Session, error)
	RevokeSession(ctx *model.Context, token string) error

	// Error handling
	HandleError(ctx *model.Context, err error)

	// Config proxy
	GetGitHubAppClientID() string
	FrontendURL() string
	WebhookOnly() bool
}

func New

func New(cfg *model.Config) Interface

Jump to

Keyboard shortcuts

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