irma

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: 19 Imported by: 0

Documentation

Index

Constants

View Source
const ContractFormat = "irma"

ContractFormat holds the readable identifier of this signing means.

View Source
const IrmaMountPath = "/public/auth/irmaclient"

IrmaMountPath contains location the irma webserver will mount

View Source
const NutsIrmaSignedContract = "NutsIrmaSignedContract"

NutsIrmaSignedContract is the type of proof used in an Irma VP

View Source
const VerifiablePresentationType = "NutsIrmaPresentation"

VerifiablePresentationType is the irma verifiable presentation type

Variables

View Source
var ErrLegalEntityNotProvided = errors.New("legalEntity not provided")

ErrLegalEntityNotProvided indicates that the legalEntity is missing

Functions

func GetIrmaConfig

func GetIrmaConfig(validatorConfig 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(validatorConfig ValidatorConfig, irmaConfig *irma.Configuration) (*irmaserver.Server, 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, error)

GetSessionResult forwards to Irma Server instance

func (*DefaultIrmaSessionHandler) StartSession

func (d *DefaultIrmaSessionHandler) StartSession(request interface{}, handler irmaserver.SessionHandler) (*irma.Qr, irma.RequestorToken, *irma.FrontendSessionRequest, error)

StartSession forwards to Irma Server instance

type Service

type Service struct {
	IrmaSessionHandler SessionHandler
	IrmaConfig         *irma.Configuration
	IrmaServiceConfig  ValidatorConfig
	Signer             nutsCrypto.JWTSigner
	ContractTemplates  contract.TemplateStore
	StrictMode         bool
}

Service validates contracts using the IRMA logic.

func (Service) SigningSessionStatus

func (v Service) SigningSessionStatus(sessionID string) (contract.SigningSessionResult, error)

SigningSessionStatus returns the current status of a certain session. It returns nil if the session is not found

func (Service) StartSigningSession

func (v Service) StartSigningSession(rawContractText string) (contract.SessionPointer, error)

StartSigningSession accepts a rawContractText and creates an IRMA signing session.

func (Service) VerifyVP

VerifyVP expects the given raw VerifiablePresentation to be of the correct type todo: type check?

type SessionHandler

type SessionHandler interface {
	GetSessionResult(token string) (*irmaserver.SessionResult, error)
	StartSession(request interface{}, handler irmaserver.SessionHandler) (*irma.Qr, irma.RequestorToken, *irma.FrontendSessionRequest, error)
}

SessionHandler is an abstraction for the Irma Server, mainly for enabling better testing

type SessionPtr

type SessionPtr struct {
	ID         string
	QrCodeInfo irmago.Qr `json:"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
}

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() (*vc.VerifiablePresentation, error)

VerifiablePresentation returns an IRMA implementation of the contract.VerifiablePresentation interface.

type VPProof

type VPProof struct {
	Type       string `json:"type"`
	ProofValue string `json:"proofValue"`
}

VPProof is a specific IrmaProof for the specific VerifiablePresentation

type ValidatorConfig

type ValidatorConfig struct {
	// 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?
	AutoUpdateIrmaSchemas bool
}

ValidatorConfig holds the configuration for the irma validator.

Jump to

Keyboard shortcuts

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