bertyvcissuer

package
v2.460.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0, MIT Imports: 34 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNewConfigMissing                  = fmt.Errorf("config is required")
	ErrNewConfigPrivateKeyMissing        = fmt.Errorf("issuer private key is required")
	ErrNewConfigFlowMissing              = fmt.Errorf("flow is missing")
	ErrNewConfigFlowTypeUnimplemented    = fmt.Errorf("unimplemented flow type")
	ErrNewConfigFlowTypeMissing          = fmt.Errorf("flow type is missing")
	ErrNewConfigFlowCodeGeneratorMissing = fmt.Errorf("code generator is missing")
	ErrNewConfigFlowCodeSenderMissing    = fmt.Errorf("code emitter endpoint is required")

	ErrFlowStateMissing       = fmt.Errorf("a state is required")
	ErrFlowRedirectURIMissing = fmt.Errorf("a redirect_uri is required")
	ErrChallengeAuthenticity  = fmt.Errorf("unable to certify challenge")
	ErrChallengeVerify        = fmt.Errorf("unable to verify challenge")
	ErrChallengeExpired       = fmt.Errorf("expired challenge")
	ErrChallengeFailed        = fmt.Errorf("unable to verify challenge signature")

	ErrMsgInvalidIdentifier    = "Invalid identifier"
	ErrMsgUnableToSendCode     = "Unable to send code"
	ErrMsgUnableToGenerateCode = "Unable to generate code"
	ErrMsgInvalidCode          = "Invalid code submitted"
)

Functions

func CodeGeneratorEightDigits added in v2.442.0

func CodeGeneratorEightDigits(secret []byte) func(state *verifiablecredstypes.StateCode) (string, error)

func CodeGeneratorZero

func CodeGeneratorZero(_ *verifiablecredstypes.StateCode) (string, error)

Types

type Config

type Config struct {
	ServerRootURL string
	IssuerID      string
	IssuerSignKey *[32]byte
	Flow          *FlowConfig
	Logger        *zap.Logger
}

type CredentialSubject

type CredentialSubject struct {
	ID string `json:"id"`
}

type FlowConfig

type FlowConfig struct {
	Type             verifiablecredstypes.FlowType
	CodeGenerator    func(state *verifiablecredstypes.StateCode) (string, error)
	CodeSenderClient VerificationCodeSender
}

type JSONChallenge

type JSONChallenge struct {
	Challenge string `json:"challenge"`
}

type JSONError

type JSONError struct {
	Error string `json:"error"`
}

type PhoneCodeSenderMockService

type PhoneCodeSenderMockService struct {
	Logger *zap.Logger
}

func (*PhoneCodeSenderMockService) SendVerificationCode

func (m *PhoneCodeSenderMockService) SendVerificationCode(ctx context.Context, in SendVerificationCodeData) error

func (*PhoneCodeSenderMockService) ValidateIdentifier

func (m *PhoneCodeSenderMockService) ValidateIdentifier(ctx context.Context, rawIdentifier string) (string, error)

type SendVerificationCodeData

type SendVerificationCodeData struct {
	Recipient      string
	Code           string
	NetworkContext string
	Context        string
}

type VCIssuer

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

func New

func New(config *Config) (*VCIssuer, error)

func (*VCIssuer) CreateSignedProof added in v2.433.0

func (i *VCIssuer) CreateSignedProof(bertyID string, identifier string) ([]byte, error)

func (*VCIssuer) CreateSignedProofForPeriod added in v2.433.0

func (i *VCIssuer) CreateSignedProofForPeriod(bertyID string, identifier string, issued time.Time, expired time.Time) ([]byte, error)

func (*VCIssuer) GetIssuerID added in v2.452.0

func (i *VCIssuer) GetIssuerID() string

func (*VCIssuer) GetServerRootURL added in v2.452.0

func (i *VCIssuer) GetServerRootURL() string

func (*VCIssuer) ServeHTTP

func (i *VCIssuer) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*VCIssuer) TestHelperIssueTokenCallbackURI added in v2.452.0

func (i *VCIssuer) TestHelperIssueTokenCallbackURI(t *testing.T, initURL string, identifier string) string

type VerificationCodeSender

type VerificationCodeSender interface {
	SendVerificationCode(ctx context.Context, verificationData SendVerificationCodeData) error
	ValidateIdentifier(ctx context.Context, rawIdentifier string) (sanitized string, err error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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