in

package
v1.36.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter

func NewRouter(lg mlog.Logger, tl *mopentelemetry.Telemetry, cc *mcasdoor.CasdoorConnection, th *TrillianHandler) *fiber.App

func WithSwaggerEnvConfig

func WithSwaggerEnvConfig() fiber.Handler

WithSwaggerEnvConfig sets the Swagger configuration for the API documentation from environment variables if they are set.

Types

type HashValidationResponse

type HashValidationResponse struct {
	AuditID        string `json:"auditId"`
	ExpectedHash   string `json:"expectedHash"`
	CalculatedHash string `json:"calculatedHash"`
	IsTampered     bool   `json:"isTampered"`

} // @Name HashValidationResponse

HashValidationResponse encapsulates auditing validation results

swagger:model HashValidationResponse @Description HashValidationResponse show if any of the logs has been tampered

type Leaf

type Leaf struct {
	LeafID string          `json:"leaf_id"`
	Body   json.RawMessage `json:"body"`

} // @Name Leaf

Leaf encapsulates audit log values

swagger:model Leaf @Description Leaf stores each audit log

type LogsResponse

type LogsResponse struct {
	TreeID int64  `json:"tree_id"`
	Leaves []Leaf `json:"leaves"`

} // @name LogsResponse

LogsResponse is a struct to encapsulate audit logs response

swagger:model LogsResponse @Description LogsResponse is the response with audit log values

type TrillianHandler

type TrillianHandler struct {
	UseCase *services.UseCase
}

func (*TrillianHandler) AuditLogs

func (th *TrillianHandler) AuditLogs(c *fiber.Ctx) error

AuditLogs compares leaf hash with a hash generated from the leaf value

@Summary		Audit logs by reference ID
@Description	Audit logs to check if any was tampered
@Tags			Audit
@Produce		json
@Param			Authorization	header		string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string	false	"Request ID"
@Param			organization_id	path		string	true	"Organization ID"
@Param			ledger_id		path		string	true	"Ledger ID"
@Param			audit_id		path		string	true	"Audit ID"
@Success		200				{object}	HashValidationResponse
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/audit/{audit_id}/audit-logs [get]

func (*TrillianHandler) ReadLogs

func (th *TrillianHandler) ReadLogs(c *fiber.Ctx) error

ReadLogs retrieves log values by the audit id

@Summary		Get 	logs by reference ID
@Description	Get log values from Trillian by reference ID
@Tags			Audit
@Produce		json
@Param			Authorization	header		string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string	false	"Request ID"
@Param			organization_id	path		string	true	"Organization ID"
@Param			ledger_id		path		string	true	"Ledger ID"
@Param			audit_id		path		string	true	"Audit ID"
@Success		200				{object}	LogsResponse
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/audit/{audit_id}/read-logs [get]

Jump to

Keyboard shortcuts

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