Documentation ¶
Index ¶
- Constants
- Variables
- func GetIrmaConfig(config ValidatorConfig) (irmaConfig *irma.Configuration, err error)
- func GetIrmaServer(config ValidatorConfig) (irmaServer *irmaserver.Server, err error)
- type DefaultIrmaSessionHandler
- type Service
- func (v Service) CreateIdentityTokenFromIrmaContract(contract *SignedIrmaContract, legalEntity core.PartyID) (string, error)
- func (v Service) IsInitialized() bool
- func (v Service) SessionStatus(id services.SessionID) (*services.SessionStatusResult, error)
- func (v Service) SigningSessionStatus(sessionID string) (contract.SigningSessionResult, error)
- func (v Service) StartSession(request interface{}, handler irmaserver.SessionHandler) (*irma.Qr, string, error)
- func (v Service) StartSigningSession(rawContractText string) (contract.SessionPointer, error)
- func (v Service) ValidateContract(b64EncodedContract string, format services.ContractFormat, ...) (*services.ContractValidationResult, error)
- func (v Service) ValidateJwt(rawJwt string, actingPartyCN *string, checkTime *time.Time) (*services.ContractValidationResult, error)
- func (v Service) VerifyVP(rawVerifiablePresentation []byte, checkTime *time.Time) (*contract.VPVerificationResult, error)
- type SessionHandler
- type SessionPtr
- type SignedIrmaContract
- type SigningSessionResult
- type VPProof
- type ValidatorConfig
- type VerifiablePresentation
Constants ¶
const ConfIrmaConfigPath = "irmaConfigPath"
ConfIrmaConfigPath is the config key to provide the irma configuration path
const ConfIrmaSchemeManager = "irmaSchemeManager"
ConfIrmaSchemeManager allows selecting an IRMA scheme manager. During development this can ben irma-demo. Production should be pdfb
const ConfSkipAutoUpdateIrmaSchemas = "skipAutoUpdateIrmaSchemas"
ConfSkipAutoUpdateIrmaSchemas is the config key to provide an option to skip auto updating the irma schemas
const ContractFormat = contract.SigningMeans("irma")
ContractFormat holds the readable identifier of this signing means.
const IrmaMountPath = "/auth/irmaclient"
The location the irma webserver will mount
const NutsIrmaSignedContract = "NutsIrmaSignedContract"
NutsIrmaSignedContract is the type of proof used in an Irma VP
const VerifiablePresentationType = contract.VPType("NutsIrmaPresentation")
VerifiablePresentationType is the irma verifiable presentation type
Variables ¶
var ErrLegalEntityNotProvided = errors.New("legalEntity not provided")
ErrLegalEntityNotProvided indicates that the legalEntity is missing
Functions ¶
func GetIrmaConfig ¶
func GetIrmaConfig(config ValidatorConfig) (irmaConfig *irma.Configuration, err error)
GetIrmaConfig creates and returns an IRMA config. The config sets the given irma path or a temporary folder. Then it downloads the schemas.
func GetIrmaServer ¶
func GetIrmaServer(config ValidatorConfig) (irmaServer *irmaserver.Server, err error)
GetIrmaServer creates and starts the irma server instance. The server can be used by a IRMA client like the app to handle IRMA sessions
Types ¶
type DefaultIrmaSessionHandler ¶
type DefaultIrmaSessionHandler struct {
I *irmaserver2.Server
}
DefaultIrmaSessionHandler is a wrapper for the Irma Server It implements the SessionHandler interface
func (*DefaultIrmaSessionHandler) GetSessionResult ¶
func (d *DefaultIrmaSessionHandler) GetSessionResult(token string) *irmaserver.SessionResult
GetSessionResult forwards to Irma Server instance
func (*DefaultIrmaSessionHandler) StartSession ¶
func (d *DefaultIrmaSessionHandler) StartSession(request interface{}, handler irmaserver.SessionHandler) (*irma.Qr, string, error)
StartSession forwards to Irma Server instance
type Service ¶
type Service struct { IrmaSessionHandler SessionHandler IrmaConfig *irma.Configuration IrmaServiceConfig ValidatorConfig // todo: remove this when the deprecated ValidateJwt is removed Registry registry.RegistryClient Crypto nutscrypto.Client ContractTemplates contract.TemplateStore }
Service validates contracts using the IRMA logic.
func (Service) CreateIdentityTokenFromIrmaContract ¶
func (v Service) CreateIdentityTokenFromIrmaContract(contract *SignedIrmaContract, legalEntity core.PartyID) (string, error)
CreateIdentityTokenFromIrmaContract from a signed irma contract. Returns a JWT signed with the provided legalEntity.
func (Service) IsInitialized ¶
IsInitialized is a helper function to determine if the validator has been initialized properly.
func (Service) SessionStatus ¶
SessionStatus returns the current status of a certain session. It returns nil if the session is not found deprecated
func (Service) SigningSessionStatus ¶
func (v Service) SigningSessionStatus(sessionID string) (contract.SigningSessionResult, error)
func (Service) StartSession ¶
func (v Service) StartSession(request interface{}, handler irmaserver.SessionHandler) (*irma.Qr, string, error)
StartSession starts an irma session. This is mainly a wrapper around the irma.SessionHandler.StartSession
func (Service) StartSigningSession ¶
func (v Service) StartSigningSession(rawContractText string) (contract.SessionPointer, error)
StartSigningSession accepts a rawContractText and creates an IRMA signing session.
func (Service) ValidateContract ¶
func (v Service) ValidateContract(b64EncodedContract string, format services.ContractFormat, actingPartyCN *string, checkTime *time.Time) (*services.ContractValidationResult, error)
ValidateContract is the entry point for contract validation. It decodes the base64 encoded contract, parses the contract string, and validates the contract. Returns nil, ErrUnknownContractFormat if the contract used in the message is unknown deprecated
func (Service) ValidateJwt ¶
func (v Service) ValidateJwt(rawJwt string, actingPartyCN *string, checkTime *time.Time) (*services.ContractValidationResult, error)
ValidateJwt validates a JWT formatted identity token deprecated
type SessionHandler ¶
type SessionHandler interface { GetSessionResult(token string) *irmaserver.SessionResult StartSession(request interface{}, handler irmaserver.SessionHandler) (*irma.Qr, string, error) }
SessionHandler is an abstraction for the Irma Server, mainly for enabling better testing
type SessionPtr ¶
SessionPtr should be made private when v0 is removed
func (SessionPtr) MarshalJSON ¶
func (s SessionPtr) MarshalJSON() ([]byte, error)
MarshalJSON marshals a custom session pointer json object for the IRMA means.
func (SessionPtr) Payload ¶
func (s SessionPtr) Payload() []byte
Payload renders the IrmaQRCode as json according to irmago.Qr
func (SessionPtr) SessionID ¶
func (s SessionPtr) SessionID() string
SessionID returns the SessionID of the SessionPtr
type SignedIrmaContract ¶
type SignedIrmaContract struct { IrmaContract irma.SignedMessage // contains filtered or unexported fields }
SignedIrmaContract holds the contract and additional methods to parse and validate.
func (SignedIrmaContract) Contract ¶
func (s SignedIrmaContract) Contract() contract.Contract
Contract returns the signed contract.Contract by the irma contract
func (SignedIrmaContract) SignerAttributes ¶
func (s SignedIrmaContract) SignerAttributes() (map[string]string, error)
SignerAttributes returns a map of irma attributes minus the root:
{ "gemeente.personalData.fullname": "Henk de Vries", "sidn-pbdf.email.email": "henk.devries@example.com", },
type SigningSessionResult ¶
type SigningSessionResult struct { server.SessionResult // NutsAuthToken contains the JWT if the sessionStatus is DONE NutsAuthToken string `json:"nuts_auth_token"` }
SigningSessionResult implements the SigningSessionResult interface and contains the SigningSessionResult from the IRMA means.
func (SigningSessionResult) Status ¶
func (s SigningSessionResult) Status() string
Status returns the IRMA signing status
func (SigningSessionResult) VerifiablePresentation ¶
func (s SigningSessionResult) VerifiablePresentation() (contract.VerifiablePresentation, error)
VerifiablePresentation returns an IRMA implementation of the contract.VerifiablePresentation interface.
type ValidatorConfig ¶
type ValidatorConfig struct { // Address to bind the http server to. Default localhost:1323 Address string // PublicURL is used for discovery for the IRMA app. PublicURL string // Where to find the IrmaConfig files including the schemas IrmaConfigPath string // Which scheme manager to use IrmaSchemeManager string // Auto update the schemas every x minutes or not? SkipAutoUpdateIrmaSchemas bool }
ValidatorConfig holds the configuration for the irma validator.
type VerifiablePresentation ¶
type VerifiablePresentation struct { contract.VerifiablePresentationBase Proof VPProof `json:"proof"` }
VerifiablePresentation is a specific proof for irma signatures