resterr

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDataNotFound                     = NewCustomError(DataNotFound, errors.New("data not found"))
	ErrOpStateKeyDuplication            = NewCustomError(OpStateKeyDuplication, errors.New("op state key duplication"))
	ErrProfileInactive                  = NewCustomError(ProfileInactive, errors.New("profile not active"))
	ErrProfileNotFound                  = NewCustomError(ProfileNotFound, errors.New("profile doesn't exist"))
	ErrCredentialTemplateNotFound       = NewCustomError(CredentialTemplateNotFound, errors.New("credential template not found"))           //nolint:lll
	ErrCredentialTemplateNotConfigured  = NewCustomError(CredentialTemplateNotConfigured, errors.New("credential template not configured")) //nolint:lll
	ErrCredentialTemplateIDRequired     = NewCustomError(CredentialTemplateIDRequired, errors.New("credential template ID is required"))    //nolint:lll
	ErrAuthorizedCodeFlowNotSupported   = NewCustomError(AuthorizedCodeFlowNotSupported, errors.New("authorized code flow not supported"))  //nolint:lll
	ErrResponseTypeMismatch             = NewCustomError(ResponseTypeMismatch, errors.New("response type mismatch"))
	ErrInvalidScope                     = NewCustomError(InvalidScope, errors.New("invalid scope"))
	ErrCredentialTypeNotSupported       = NewCustomError(CredentialTypeNotSupported, errors.New("credential type not supported"))             //nolint:lll
	ErrCredentialFormatNotSupported     = NewCustomError(CredentialFormatNotSupported, errors.New("credential format not supported"))         //nolint:lll
	ErrInvalidCredentialConfigurationID = NewCustomError(InvalidCredentialConfigurationID, errors.New("invalid credential configuration ID")) //nolint:lll
	ErrVCOptionsNotConfigured           = NewCustomError(VCOptionsNotConfigured, errors.New("vc options not configured"))
	ErrInvalidIssuerURL                 = NewCustomError(InvalidIssuerURL, errors.New("invalid issuer url"))
)

Functions

func HTTPErrorHandler

func HTTPErrorHandler(tracer trace.Tracer) func(err error, c echo.Context)

Types

type Component added in v1.5.0

type Component = string
const (
	IssuerSvcComponent          Component = "issuer.service"
	IssuerProfileSvcComponent   Component = "issuer.profile-service"
	IssueCredentialSvcComponent Component = "issuer.issue-credential-service"
	IssuerOIDC4ciSvcComponent   Component = "issuer.oidc4ci-service"

	VerifierVerifyCredentialSvcComponent  Component = "verifier.verify-credential-service"
	VerifierOIDC4vpSvcComponent           Component = "verifier.oidc4vp-service"
	VerifierProfileSvcComponent           Component = "verifier.profile-service"
	VerifierTxnMgrComponent               Component = "verifier.txn-mgr"
	VerifierVCSignerComponent             Component = "verifier.vc-signer"
	VerifierKMSRegistryComponent          Component = "verifier.kms-registry"
	VerifierPresentationVerifierComponent Component = "verifier.presentation-verifier"
	VerifierDataIntegrityVerifier         Component = "verifier.data-integrity-verifier"

	ClientIDSchemeSvcComponent             Component = "client-id-scheme-service"
	ClientManagerComponent                 Component = "client-manager"
	WellKnownSvcComponent                  Component = "well-known-service"
	DataProtectorComponent                 Component = "data-protector"
	ClaimDataStoreComponent                Component = "claim-data-store"
	TransactionStoreComponent              Component = "transaction-store"
	CryptoJWTSignerComponent               Component = "crypto-jwt-signer"
	CredentialOfferReferenceStoreComponent Component = "credential-offer-reference-store"
	RedisComponent                         Component = "redis-service"
)

func GetErrorDetails added in v1.5.0

func GetErrorDetails(err error) (string, string, Component)

GetErrorDetails extracts the error message, error code and component from the given error. If the error is not a CustomError implementation then the error code and component will be empty.

type CustomError

type CustomError struct {
	Code            ErrorCode
	IncorrectValue  string
	FailedOperation string
	Component       Component
	Err             error
}

func NewCustomError

func NewCustomError(code ErrorCode, err error) *CustomError

func NewOIDCError

func NewOIDCError(message string, raw error) *CustomError

func NewSystemError

func NewSystemError(component Component, failedOperation string, err error) *CustomError

func NewUnauthorizedError

func NewUnauthorizedError(err error) *CustomError

func NewValidationError

func NewValidationError(code ErrorCode, incorrectValue string, err error) *CustomError

func (*CustomError) Error

func (e *CustomError) Error() string

func (*CustomError) HTTPCodeMsg

func (e *CustomError) HTTPCodeMsg() (int, interface{})

func (*CustomError) Unwrap added in v1.5.0

func (e *CustomError) Unwrap() error

type ErrorCode

type ErrorCode string
const (
	SystemError                      ErrorCode = "system-error"
	Unauthorized                     ErrorCode = "unauthorized"
	InvalidValue                     ErrorCode = "invalid-value"
	AlreadyExist                     ErrorCode = "already-exist"
	DoesntExist                      ErrorCode = "doesnt-exist"
	ConditionNotMet                  ErrorCode = "condition-not-met"
	OIDCError                        ErrorCode = "oidc-error"
	OIDCTxNotFound                   ErrorCode = "oidc-tx-not-found"
	OIDCPreAuthorizeDoesNotExpectPin ErrorCode = "oidc-pre-authorize-does-not-expect-pin"
	OIDCPreAuthorizeExpectPin        ErrorCode = "oidc-pre-authorize-expect-pin"
	OIDCPreAuthorizeInvalidPin       ErrorCode = "oidc-pre-authorize-invalid-pin"
	OIDCPreAuthorizeInvalidClientID  ErrorCode = "oidc-pre-authorize-invalid-client-id"
	OIDCCredentialFormatNotSupported ErrorCode = "oidc-credential-format-not-supported"
	OIDCCredentialTypeNotSupported   ErrorCode = "oidc-credential-type-not-supported"
	OIDCClientAuthenticationFailed   ErrorCode = "oidc-client-authentication-failed"
	InvalidOrMissingProofOIDCErr     ErrorCode = "invalid_or_missing_proof"
	OIDCInvalidEncryptionParameters  ErrorCode = "oidc-invalid-encryption-parameters"
	OIDCInvalidCredentialRequest     ErrorCode = "invalid_credential_request"

	ProfileNotFound                  ErrorCode = "profile-not-found"
	ProfileInactive                  ErrorCode = "profile-inactive"
	TransactionNotFound              ErrorCode = "transaction-not-found"
	CredentialTemplateNotFound       ErrorCode = "credential-template-not-found"
	PresentationVerificationFailed   ErrorCode = "presentation-verification-failed"
	DuplicatePresentationID          ErrorCode = "duplicate-presentation-id"
	PresentationDefinitionMismatch   ErrorCode = "presentation-definition-mismatch"
	ClaimsNotReceived                ErrorCode = "claims-not-received"
	ClaimsNotFound                   ErrorCode = "claims-not-found"
	ClaimsValidationErr              ErrorCode = "invalid-claims"
	DataNotFound                     ErrorCode = "data-not-found"
	OpStateKeyDuplication            ErrorCode = "op-state-key-duplication"
	CredentialTemplateNotConfigured  ErrorCode = "credential-template-not-configured"
	CredentialTemplateIDRequired     ErrorCode = "credential-template-id-required"
	AuthorizedCodeFlowNotSupported   ErrorCode = "authorized-code-flow-not-supported"
	ResponseTypeMismatch             ErrorCode = "response-type-mismatch"
	InvalidScope                     ErrorCode = "invalid-scope"
	InvalidCredentialConfigurationID ErrorCode = "invalid-credential-configuration-id"
	CredentialTypeNotSupported       ErrorCode = "credential-type-not-supported"
	CredentialFormatNotSupported     ErrorCode = "credential-format-not-supported"
	VCOptionsNotConfigured           ErrorCode = "vc-options-not-configured"
	InvalidIssuerURL                 ErrorCode = "invalid-issuer-url"
	InvalidStateTransition           ErrorCode = "invalid-state-transition"
)

func (ErrorCode) Name

func (c ErrorCode) Name() string

type FositeError

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

func NewFositeError

func NewFositeError(code FositeErrorCode, ctx echo.Context, w fositeErrorWriter, err error) *FositeError

func (*FositeError) Error

func (e *FositeError) Error() string

func (*FositeError) WithAccessRequester

func (e *FositeError) WithAccessRequester(requester fosite.AccessRequester) *FositeError

func (*FositeError) WithAuthorizeRequester

func (e *FositeError) WithAuthorizeRequester(requester fosite.AuthorizeRequester) *FositeError

func (*FositeError) Write

func (e *FositeError) Write() error

type FositeErrorCode

type FositeErrorCode int
const (
	FositeAuthorizeError FositeErrorCode = iota
	FositeAccessError
	FositeIntrospectionError
	FositePARError
)

type RegistrationError added in v1.1.0

type RegistrationError struct {
	Code string
	Err  error
}

RegistrationError is used to indicate a validation error during dynamic client registration. When a registration error condition occurs, the authorization server returns an HTTP 400 status code with content type "application/json" consisting of a JSON object describing the error in the response body.

func (*RegistrationError) Error added in v1.1.0

func (e *RegistrationError) Error() string

Jump to

Keyboard shortcuts

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