pkg

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsentLogic

type ConsentLogic struct {
	NutsRegistry     pkg.RegistryClient
	NutsCrypto       crypto.Client
	NutsConsentStore cStore.ConsentStoreClient
	NutsEventOctopus events.EventOctopusClient
	Config           ConsentLogicConfig
	EventPublisher   events.IEventPublisher
}

func ConsentLogicInstance

func ConsentLogicInstance() *ConsentLogic

func NewConsentLogicInstance added in v0.15.0

func NewConsentLogicInstance(config ConsentLogicConfig, cryptoClient crypto.Client, registryClient pkg.RegistryClient, consentStoreClient cStore.ConsentStoreClient, eventOctopusClient events.EventOctopusClient) *ConsentLogic

func NewTestConsentLogicInstance added in v0.15.0

func NewTestConsentLogicInstance(testDirectory string) *ConsentLogic

func (ConsentLogic) Configure

func (ConsentLogic) Configure() error

func (ConsentLogic) HandleEventConsentDistributed

func (cl ConsentLogic) HandleEventConsentDistributed(event *events.Event)

HandleEventConsentDistributed handles EventConsentDistributed. This is the final step in the distributed consent state-machine. It decodes the payload, performs final tests and stores the relevant consentRules in the consent-store.

func (ConsentLogic) HandleEventConsentRequestAcked

func (cl ConsentLogic) HandleEventConsentRequestAcked(event *events.Event)

HandleEventConsentRequestAcked handles the Event Consent Request Acked event. It passes a copy of the event to the signing step and if everything is ok, it publishes this new event to ChannelConsentRequest. In case of an error, it publishes the event to ChannelConsentErrored.

func (ConsentLogic) HandleEventConsentRequestValid

func (cl ConsentLogic) HandleEventConsentRequestValid(event *events.Event)

HandleEventConsentRequestValid republishes every event as acked. TODO: This should be made optional so the ECD can perform checks and publish the ack or nack

func (ConsentLogic) HandleIncomingCordaEvent

func (cl ConsentLogic) HandleIncomingCordaEvent(event *events.Event)

HandleIncomingCordaEvent auto-acks ConsentRequests with the missing signatures * Get the consentRequestState by id from the consentBridge * For each legalEntity get its public key

func (ConsentLogic) PatientConsentFromFHIRRecord

func (ConsentLogic) PatientConsentFromFHIRRecord(fhirConsents map[string]FHIRResourceWithHash) cStore.PatientConsent

PatientConsentFromFHIRRecord extracts the PatientConsent from a FHIR consent record encoded as json string.

func (ConsentLogic) Shutdown

func (ConsentLogic) Shutdown() error

Shutdown is currently a placeholder method. It an be used for unsubscription or other things.

func (*ConsentLogic) Start

func (cl *ConsentLogic) Start() error

Start starts a new ConsentLogic engine. It populates the ConsentLogic struct with client from other engines and subscribes to nats.io event.

func (ConsentLogic) StartConsentFlow

func (cl ConsentLogic) StartConsentFlow(createConsentRequest *CreateConsentRequest) (*uuid.UUID, error)

StartConsentFlow is the start of the consentFlow. It is a a blocking method which will fire the first event.

type ConsentLogicClient

type ConsentLogicClient interface {
	StartConsentFlow(*CreateConsentRequest) (*uuid.UUID, error)
	HandleIncomingCordaEvent(*events.Event)
}

func NewConsentLogicClient

func NewConsentLogicClient() ConsentLogicClient

type ConsentLogicConfig

type ConsentLogicConfig struct {
}

type CreateConsentRequest

type CreateConsentRequest struct {
	Actor     core.PartyID
	Custodian core.PartyID
	Subject   core.PartyID
	Performer core.PartyID
	Records   []Record
}

type DocumentReference

type DocumentReference struct {
	ID          string
	Title       string
	ContentType *string
	URL         *string
	Hash        *string
}

DocumentReference defines component schema for DocumentReference.

type FHIRResourceWithHash

type FHIRResourceWithHash struct {
	FHIRResource string
	// Hash represents the attachment hash (zip of cipherText and metadata) from the distributed event model
	Hash string
	// PreviousHash represents the previous attachment hash from the distributed event model (in the case of updates)
	PreviousHash *string
}

intermediate struct to keep FHIR resource and hash together

type Period

type Period struct {
	End   *time.Time
	Start time.Time
}

Period defines component schema for Period.

type Record

type Record struct {
	// RecordHash refers to the current hash of the decoded fhir record
	RecordHash *string
	// PreviousRecordhash refers to a previous record.
	PreviousRecordhash *string
	ConsentProof       *DocumentReference
	DataClass          []string
	Period             Period
}

Record contains derived values from a consent record for a custodian/subject/actor triple. There can be multiple records per triple, each with their own proof and details. More values can be added to this struct later.

Jump to

Keyboard shortcuts

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