services

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package services is a generated GoMock package.

Index

Constants

View Source
const (
	// IrmaFormat is used to indicate a contract is in he form of a base64 encoded IRMA signature
	IrmaFormat ContractFormat = "irma"
	// Valid is used to indicate a contract was valid on the time of testing
	Valid ValidationState = "VALID"
	// Invalid is used to indicate a contract was invalid on the time of testing
	Invalid ValidationState = "INVALID"
)
View Source
const EidasIALClaim = "eidas_ial"

EidasIALClaim is the EIDAS identity assurance level claim: Low - to - High

View Source
const EmailTokenClaim = "email"

EmailTokenClaim is the JWT claim for email

View Source
const FamilyNameTokenClaim = "familyname"

FamilyNameTokenClaim is the JWT claim for the family name

View Source
const InitialsTokenClaim = "initials"

InitialsTokenClaim is the JWT claim for initials

View Source
const OAuthEndpointType = "oauth"

OAuthEndpointType defines the type identifier for oauth endpoints (RFCtodo)

View Source
const PrefixTokenClaim = "prefix"

PrefixTokenClaim is the JWT claim for the name prefix

Variables

View Source
var ErrSessionNotFound = errors.New("session not found")

ErrSessionNotFound is returned when there is no contract signing session found for a certain SessionID

Functions

This section is empty.

Types

type AccessTokenResult

type AccessTokenResult struct {
	// AccessToken contains the JWT in compact serialization form
	AccessToken string
	// ExpiresIn defines the expiration in seconds
	ExpiresIn int
}

AccessTokenResult defines the return value back to the api for the CreateAccessToken method

type CompoundServiceClient

type CompoundServiceClient interface {
	GetCompoundService(id did.DID, serviceType string) (*did.Service, error)
}

CompoundServiceClient defines a function to get a compoundservice by its servicetype

type ContractFormat

type ContractFormat string

ContractFormat describes the format of a signed contract. Based on the format an appropriate validator can be selected.

type ContractNotary

type ContractNotary interface {
	contract.VPVerifier

	// DrawUpContract draws up a contract from a template and returns a Contract which than can be signed by the user.
	DrawUpContract(template contract.Template, orgID did.DID, validFrom time.Time, validDuration time.Duration) (*contract.Contract, error)

	// CreateSigningSession creates a signing session for the requested contract and means
	CreateSigningSession(sessionRequest CreateSessionRequest) (contract.SessionPointer, error)

	// SigningSessionStatus returns the status of the current signing session or ErrSessionNotFound is sessionID is unknown
	SigningSessionStatus(sessionID string) (contract.SigningSessionResult, error)

	Configure() error

	// HandlerFunc returns the Irma server handler func
	HandlerFunc() http.HandlerFunc
}

ContractNotary defines the functions for creating, validating verifiable credentials and draw up a contract.

type ContractValidationResult

type ContractValidationResult struct {
	ValidationResult ValidationState `json:"validation_result"`
	ContractFormat   ContractFormat  `json:"contract_format"`
	// DisclosedAttributes contain the attributes used to sign this contract
	DisclosedAttributes map[string]string `json:"disclosed_attributes"`
	// ContractAttributes contain the attributes used to fill the contract
	ContractAttributes map[string]string `json:"contract_attributes"`
}

ContractValidationResult contains the result of a contract validation

type CreateAccessTokenRequest

type CreateAccessTokenRequest struct {
	RawJwtBearerToken string
}

CreateAccessTokenRequest contains all information to create an access token from a JwtBearerToken

type CreateJwtGrantRequest

type CreateJwtGrantRequest struct {
	Requester   string
	Authorizer  string
	IdentityVP  *vc.VerifiablePresentation
	Service     string
	Credentials []vc.VerifiableCredential
}

CreateJwtGrantRequest contains all information to create a JwtBearerToken

type CreateSessionRequest

type CreateSessionRequest struct {
	SigningMeans string
	// Message to sign
	Message string
}

CreateSessionRequest is used to create a contract signing session.

type CreateSessionResult

type CreateSessionResult struct {
	QrCodeInfo irma.Qr
	SessionID  string
}

CreateSessionResult contains the results needed to setup an irma flow

type JwtBearerTokenResult

type JwtBearerTokenResult struct {
	BearerToken string
}

JwtBearerTokenResult defines the return value back to the api for the createJwtBearerToken method

type MockCompoundServiceClient

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

MockCompoundServiceClient is a mock of CompoundServiceClient interface.

func NewMockCompoundServiceClient

func NewMockCompoundServiceClient(ctrl *gomock.Controller) *MockCompoundServiceClient

NewMockCompoundServiceClient creates a new mock instance.

func (*MockCompoundServiceClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockCompoundServiceClient) GetCompoundService

func (m *MockCompoundServiceClient) GetCompoundService(id did.DID, serviceType string) (*did.Service, error)

GetCompoundService mocks base method.

type MockCompoundServiceClientMockRecorder

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

MockCompoundServiceClientMockRecorder is the mock recorder for MockCompoundServiceClient.

func (*MockCompoundServiceClientMockRecorder) GetCompoundService

func (mr *MockCompoundServiceClientMockRecorder) GetCompoundService(id, serviceType interface{}) *gomock.Call

GetCompoundService indicates an expected call of GetCompoundService.

type MockContractNotary

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

MockContractNotary is a mock of ContractNotary interface.

func NewMockContractNotary

func NewMockContractNotary(ctrl *gomock.Controller) *MockContractNotary

NewMockContractNotary creates a new mock instance.

func (*MockContractNotary) Configure

func (m *MockContractNotary) Configure() error

Configure mocks base method.

func (*MockContractNotary) CreateSigningSession

func (m *MockContractNotary) CreateSigningSession(sessionRequest CreateSessionRequest) (contract.SessionPointer, error)

CreateSigningSession mocks base method.

func (*MockContractNotary) DrawUpContract

func (m *MockContractNotary) DrawUpContract(template contract.Template, orgID did.DID, validFrom time.Time, validDuration time.Duration) (*contract.Contract, error)

DrawUpContract mocks base method.

func (*MockContractNotary) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockContractNotary) HandlerFunc

func (m *MockContractNotary) HandlerFunc() http.HandlerFunc

HandlerFunc mocks base method.

func (*MockContractNotary) SigningSessionStatus

func (m *MockContractNotary) SigningSessionStatus(sessionID string) (contract.SigningSessionResult, error)

SigningSessionStatus mocks base method.

func (*MockContractNotary) VerifyVP

VerifyVP mocks base method.

type MockContractNotaryMockRecorder

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

MockContractNotaryMockRecorder is the mock recorder for MockContractNotary.

func (*MockContractNotaryMockRecorder) Configure

func (mr *MockContractNotaryMockRecorder) Configure() *gomock.Call

Configure indicates an expected call of Configure.

func (*MockContractNotaryMockRecorder) CreateSigningSession

func (mr *MockContractNotaryMockRecorder) CreateSigningSession(sessionRequest interface{}) *gomock.Call

CreateSigningSession indicates an expected call of CreateSigningSession.

func (*MockContractNotaryMockRecorder) DrawUpContract

func (mr *MockContractNotaryMockRecorder) DrawUpContract(template, orgID, validFrom, validDuration interface{}) *gomock.Call

DrawUpContract indicates an expected call of DrawUpContract.

func (*MockContractNotaryMockRecorder) HandlerFunc

func (mr *MockContractNotaryMockRecorder) HandlerFunc() *gomock.Call

HandlerFunc indicates an expected call of HandlerFunc.

func (*MockContractNotaryMockRecorder) SigningSessionStatus

func (mr *MockContractNotaryMockRecorder) SigningSessionStatus(sessionID interface{}) *gomock.Call

SigningSessionStatus indicates an expected call of SigningSessionStatus.

func (*MockContractNotaryMockRecorder) VerifyVP

func (mr *MockContractNotaryMockRecorder) VerifyVP(vp, checkTime interface{}) *gomock.Call

VerifyVP indicates an expected call of VerifyVP.

type MockOAuthClient

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

MockOAuthClient is a mock of OAuthClient interface.

func NewMockOAuthClient

func NewMockOAuthClient(ctrl *gomock.Controller) *MockOAuthClient

NewMockOAuthClient creates a new mock instance.

func (*MockOAuthClient) Configure

func (m *MockOAuthClient) Configure(clockSkewInMilliseconds int) error

Configure mocks base method.

func (*MockOAuthClient) CreateAccessToken

func (m *MockOAuthClient) CreateAccessToken(request CreateAccessTokenRequest) (*AccessTokenResult, error)

CreateAccessToken mocks base method.

func (*MockOAuthClient) CreateJwtGrant

func (m *MockOAuthClient) CreateJwtGrant(request CreateJwtGrantRequest) (*JwtBearerTokenResult, error)

CreateJwtGrant mocks base method.

func (*MockOAuthClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockOAuthClient) GetOAuthEndpointURL

func (m *MockOAuthClient) GetOAuthEndpointURL(service string, authorizer did.DID) (url.URL, error)

GetOAuthEndpointURL mocks base method.

func (*MockOAuthClient) IntrospectAccessToken

func (m *MockOAuthClient) IntrospectAccessToken(token string) (*NutsAccessToken, error)

IntrospectAccessToken mocks base method.

type MockOAuthClientMockRecorder

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

MockOAuthClientMockRecorder is the mock recorder for MockOAuthClient.

func (*MockOAuthClientMockRecorder) Configure

func (mr *MockOAuthClientMockRecorder) Configure(clockSkewInMilliseconds interface{}) *gomock.Call

Configure indicates an expected call of Configure.

func (*MockOAuthClientMockRecorder) CreateAccessToken

func (mr *MockOAuthClientMockRecorder) CreateAccessToken(request interface{}) *gomock.Call

CreateAccessToken indicates an expected call of CreateAccessToken.

func (*MockOAuthClientMockRecorder) CreateJwtGrant

func (mr *MockOAuthClientMockRecorder) CreateJwtGrant(request interface{}) *gomock.Call

CreateJwtGrant indicates an expected call of CreateJwtGrant.

func (*MockOAuthClientMockRecorder) GetOAuthEndpointURL

func (mr *MockOAuthClientMockRecorder) GetOAuthEndpointURL(service, authorizer interface{}) *gomock.Call

GetOAuthEndpointURL indicates an expected call of GetOAuthEndpointURL.

func (*MockOAuthClientMockRecorder) IntrospectAccessToken

func (mr *MockOAuthClientMockRecorder) IntrospectAccessToken(token interface{}) *gomock.Call

IntrospectAccessToken indicates an expected call of IntrospectAccessToken.

type MockSignedToken

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

MockSignedToken is a mock of SignedToken interface.

func NewMockSignedToken

func NewMockSignedToken(ctrl *gomock.Controller) *MockSignedToken

NewMockSignedToken creates a new mock instance.

func (*MockSignedToken) Contract

func (m *MockSignedToken) Contract() contract.Contract

Contract mocks base method.

func (*MockSignedToken) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockSignedToken) SignerAttributes

func (m *MockSignedToken) SignerAttributes() (map[string]string, error)

SignerAttributes mocks base method.

type MockSignedTokenMockRecorder

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

MockSignedTokenMockRecorder is the mock recorder for MockSignedToken.

func (*MockSignedTokenMockRecorder) Contract

func (mr *MockSignedTokenMockRecorder) Contract() *gomock.Call

Contract indicates an expected call of Contract.

func (*MockSignedTokenMockRecorder) SignerAttributes

func (mr *MockSignedTokenMockRecorder) SignerAttributes() *gomock.Call

SignerAttributes indicates an expected call of SignerAttributes.

type MockVPProofValueParser

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

MockVPProofValueParser is a mock of VPProofValueParser interface.

func NewMockVPProofValueParser

func NewMockVPProofValueParser(ctrl *gomock.Controller) *MockVPProofValueParser

NewMockVPProofValueParser creates a new mock instance.

func (*MockVPProofValueParser) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockVPProofValueParser) Parse

func (m *MockVPProofValueParser) Parse(rawAuthToken string) (SignedToken, error)

Parse mocks base method.

func (*MockVPProofValueParser) Verify

func (m *MockVPProofValueParser) Verify(token SignedToken) error

Verify mocks base method.

type MockVPProofValueParserMockRecorder

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

MockVPProofValueParserMockRecorder is the mock recorder for MockVPProofValueParser.

func (*MockVPProofValueParserMockRecorder) Parse

func (mr *MockVPProofValueParserMockRecorder) Parse(rawAuthToken interface{}) *gomock.Call

Parse indicates an expected call of Parse.

func (*MockVPProofValueParserMockRecorder) Verify

func (mr *MockVPProofValueParserMockRecorder) Verify(token interface{}) *gomock.Call

Verify indicates an expected call of Verify.

type NutsAccessToken

type NutsAccessToken struct {
	Service    string  `json:"service"`
	Initials   *string `json:"initials,omitempty"`
	Prefix     *string `json:"prefix,omitempty"`
	FamilyName *string `json:"family_name,omitempty"`
	Email      *string `json:"email,omitempty"`
	EidasIAL   *string `json:"eidas_ial,omitempty"`

	KeyID       string   `json:"-"`
	Expiration  int64    `json:"exp"`
	IssuedAt    int64    `json:"iat"`
	Issuer      string   `json:"iss"`
	Subject     string   `json:"sub"`
	Audience    string   `json:"aud"`
	Credentials []string `json:"vcs,omitempty"`
}

NutsAccessToken is a OAuth 2.0 access token which provides context to a request. Its contents are derived from a Jwt Bearer token. The Jwt Bearer token is verified by the authorization server and stripped from the proof to make it compact.

func (*NutsAccessToken) FromMap

func (t *NutsAccessToken) FromMap(m map[string]interface{}) error

FromMap sets the values of the token from the given map.

type NutsIdentityToken

type NutsIdentityToken struct {
	// KeyID identifies the key that was used to sign the token
	KeyID string `json:"kid"`
	// What kind of signature? Currently only IRMA is supported
	Type ContractFormat `json:"type"`
	// The base64 encoded signature
	Signature string `json:"sig"`
}

NutsIdentityToken contains the signed identity of the user performing the request

func (*NutsIdentityToken) FromMap

func (t *NutsIdentityToken) FromMap(m map[string]interface{}) error

FromMap sets the values of the token from the given map.

type OAuthClient

type OAuthClient interface {
	Configure(clockSkewInMilliseconds int) error
	CreateAccessToken(request CreateAccessTokenRequest) (*AccessTokenResult, error)
	CreateJwtGrant(request CreateJwtGrantRequest) (*JwtBearerTokenResult, error)
	GetOAuthEndpointURL(service string, authorizer did.DID) (url.URL, error)
	IntrospectAccessToken(token string) (*NutsAccessToken, error)
}

OAuthClient is the client interface for the OAuth service

type SessionID

type SessionID string

SessionID contains a number to uniquely identify a contract signing session

type SignedToken

type SignedToken interface {
	// SignerAttributes extracts a map of attribute names and their values from the signature
	SignerAttributes() (map[string]string, error)
	// Contract extracts the Contract from the SignedToken
	Contract() contract.Contract
}

SignedToken defines the uniform interface to crypto specific implementations such as Irma or x509 tokens.

type TestVPVerificationResult

type TestVPVerificationResult struct {
	Val         contract.State
	Type        string
	DAttributes map[string]string
	CAttributes map[string]string
}

func (TestVPVerificationResult) ContractAttribute

func (t TestVPVerificationResult) ContractAttribute(key string) string

func (TestVPVerificationResult) ContractAttributes

func (t TestVPVerificationResult) ContractAttributes() map[string]string

func (TestVPVerificationResult) DisclosedAttribute

func (t TestVPVerificationResult) DisclosedAttribute(key string) string

func (TestVPVerificationResult) DisclosedAttributes

func (t TestVPVerificationResult) DisclosedAttributes() map[string]string

func (TestVPVerificationResult) VPType

func (t TestVPVerificationResult) VPType() string

func (TestVPVerificationResult) Validity

type VPProofValueParser

type VPProofValueParser interface {
	// Parse accepts a raw ProofValue from the VP as a string. The parser tries to parse the value into a SignedToken.
	Parse(rawAuthToken string) (SignedToken, error)

	// Verify accepts a SignedToken and verifies the signature using the crypto for the specific implementation of this interface.
	Verify(token SignedToken) error
}

VPProofValueParser provides a uniform interface for Authentication services like IRMA or x509 signed tokens

type ValidationState

type ValidationState string

ValidationState contains the outcome of the validation. It van be VALID or INVALID. This makes it human readable.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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