api

package
v0.0.2501 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Overview

The api package implements the REST API defined in https://github.com/veraison/docs/blob/main/api/challenge-response

Copyright 2022-2023 Contributors to the Veraison project. SPDX-License-Identifier: Apache-2.0

Copyright 2022-2024 Contributors to the Veraison project. SPDX-License-Identifier: Apache-2.0

Copyright 2022-2023 Contributors to the Veraison project. SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	ChallengeResponseSessionMediaType = "application/vnd.veraison.challenge-response-session+json"
)

Variables

View Source
var (
	ConfigNonceSize     uint8 = 32
	ConfigSessionTTL, _       = time.ParseDuration("2m30s")
)
View Source
var (
	ErrInternal = errors.New("internal error")
)

Functions

func NewRouter

func NewRouter(handler IHandler) *gin.Engine

func ReportProblem

func ReportProblem(c *gin.Context, status int, details ...string)

Types

type ChallengeResponseSession

type ChallengeResponseSession struct {
	Status   Status        `json:"status"`
	Nonce    []byte        `json:"nonce"`
	Expiry   time.Time     `json:"expiry"`
	Accept   []string      `json:"accept"`
	Evidence *EvidenceBlob `json:"evidence,omitempty"`
	Result   *string       `json:"result,omitempty"`
	// contains filtered or unexported fields
}

func (*ChallengeResponseSession) SetEvidence

func (o *ChallengeResponseSession) SetEvidence(mt string, evidence []byte)

func (*ChallengeResponseSession) SetResult

func (o *ChallengeResponseSession) SetResult(result []byte)

func (*ChallengeResponseSession) SetStatus

func (o *ChallengeResponseSession) SetStatus(status Status)

type EvidenceBlob

type EvidenceBlob struct {
	Type  string `json:"type"`
	Value []byte `json:"value"`
}

type Handler

type Handler struct {
	SessionManager sessionmanager.ISessionManager
	Verifier       verifier.IVerifier
	// contains filtered or unexported fields
}

func (*Handler) DelSession

func (o *Handler) DelSession(c *gin.Context)

func (*Handler) GetSession

func (o *Handler) GetSession(c *gin.Context)

func (*Handler) GetWellKnownVerificationInfo

func (o *Handler) GetWellKnownVerificationInfo(c *gin.Context)

func (*Handler) NewChallengeResponse

func (o *Handler) NewChallengeResponse(c *gin.Context)

func (*Handler) SubmitEvidence

func (o *Handler) SubmitEvidence(c *gin.Context)

type IHandler

type IHandler interface {
	NewChallengeResponse(c *gin.Context)
	SubmitEvidence(c *gin.Context)
	GetSession(c *gin.Context)
	DelSession(c *gin.Context)
	GetWellKnownVerificationInfo(c *gin.Context)
}

type Status

type Status uint8
const (
	StatusWaiting Status = iota
	StatusProcessing
	StatusComplete
	StatusFailed
)

func (*Status) FromString

func (o *Status) FromString(s string) error

func (Status) MarshalJSON

func (o Status) MarshalJSON() ([]byte, error)

func (Status) String

func (o Status) String() string

func (*Status) UnmarshalJSON

func (o *Status) UnmarshalJSON(b []byte) error

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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