commonManagers

package
v1.1.80 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2021 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Copyright 2021 Fundación UNID

Copyright 2021 Fundación UNID

Index

Constants

View Source
const (
	MessagingSystemName   = "UNID"
	MessagingSoftwareName = "UHC"
	MessagingEventSystem  = "http://unid.es/fhir/message-events"
)
View Source
const (
	IPSCompositionMetaProfile      = "http://hl7.org/fhir/uv/ips/StructureDefinition/Composition-uv-ips"
	IPSCompositionIdentifierSystem = "urn:oid:2.16.724.4.8.10.200.10"
	IPSCompositionTypeCodeLOINC    = "60591-5"

	HL7SystemValueSetDocTypeCodes    = "http://hl7.org/fhir/ValueSet/doc-typecodes"
	HL7ValueSetDocTypeMedicalRecords = "11503-0"

	HL7SystemValueSetActCodeSystem  = "http://terminology.hl7.org/CodeSystem/v3-ActStatus"
	HL7ValueSetActCodeCareProvision = "PCPR" // for IPS document composition
	HL7ValueSetActCodeEncounter     = "ENC"
	HL7ValueSetActCodeProcedure     = "PROC"
	HL7ValueSetActCodeObservation   = "OBS"
	HL7ValueSetActCodeClinicalDoc   = "DOCCLIN" // Clinical document
	HL7ValueSetActCodeAct           = "ACT"
)

Variables

This section is empty.

Functions

func BuildJWS

func BuildJWS(signer jose.Signer, claims interface{}) (string, error)

func CreateDefaultDID

func CreateDefaultDID(signKeyPair models.Key, encryptKeyPair models.Key) (*didDocument.Doc, error)

The ID of the DID Document is the KeyPair.PublicKeyInfo.ControllerDID of both sign and encryption key pairs

func CreateEd25519SignKeyPair

func CreateEd25519SignKeyPair(walletId string, uhcOwnerId string, purposes []string, tag string) (*models.Key, error)

func CreateX25519EncryptKeyPair

func CreateX25519EncryptKeyPair(walletId string, uhcOwnerId string, purposes []string, tag string) (*models.Key, error)

func DocDigestForEd25519Signature2018

func DocDigestForEd25519Signature2018(doc []byte) []byte

func GenerateX25519KeyPair added in v1.0.61

func GenerateX25519KeyPair() (publicKeyBase64 string, privateKeyBase64 string, err error)

func GetCanonicalDocument

func GetCanonicalDocument(doc map[string]interface{}, opts ...jsonld.ProcessorOpts) ([]byte, error)

GetCanonicalDocument will return normalized/canonical version of the document.

func GetJWTHeader

func GetJWTHeader(jwt string) (string, error)

func GetJwtHeaderMap

func GetJwtHeaderMap(jwtHeaderB64 string) map[string]interface{}

func GetKeyResolver

func GetKeyResolver(pubKey *signVerifier.PublicKey, err error) jwt.KeyResolver

func SignDidDocument

func SignDidDocument(privKey, pubKey []byte, doc *didDocument.Doc, proofCreator string) ([]byte, error)

func SignWithAriesProof

func SignWithAriesProof(signKeyPair models.Key, serializedJson string, jws bool, purpose string) ([]byte, error)

Ed25519Signature2018 signature suite for the Linked Data Signatures [LD-SIGNATURES] specification. It uses the RDF Dataset Normalization Algorithm [RDF-DATASET-NORMALIZATION] to transform the input document into its canonical form. It uses SHA-256 [RFC6234] as the message digest algorithm and Ed25519 [ED25519] as the signature algorithm. https://godoc.org/github.com/hyperledger/aries-framework-go/pkg/doc/signature/suite/ed25519signature2018

func SignWithJcs2020Proof

func SignWithJcs2020Proof(jsonSerialized string, signKeyPair models.Key) ([]byte, error)

func VerifyEd25519ViaGoJose

func VerifyEd25519ViaGoJose(jws string, pubKey ed25519.PublicKey, claims interface{}) (bool, error)

func ZKP

func ZKP(fileBytes []byte) func(w http.ResponseWriter, r *http.Request)

ZKP returns an http.Handler that computes an interactive zero-knowledge proof-of-posession protocol.

Types

type CryptoManager

type CryptoManager struct {
}

func (*CryptoManager) CreateX25519KeyPair

func (manager *CryptoManager) CreateX25519KeyPair(walletId string, uhcUserId string, purposes []string, tag string) (*models.Key, error)

func (*CryptoManager) DecryptBase64WithSharedKeyInBase64

func (manager *CryptoManager) DecryptBase64WithSharedKeyInBase64(encryptedMessage, sharedKey *string) (decryptedMessage string, err error)

func (*CryptoManager) DecryptBytesWithSharedKey

func (manager *CryptoManager) DecryptBytesWithSharedKey(messageBytes []byte, sharedKeyBytes *[32]byte) (decryptedMessage []byte, err error)

func (*CryptoManager) DecryptMessage

func (manager *CryptoManager) DecryptMessage(senderPublicKeyBase64, recipientPrivateKeyBase64, encryptedMessageBase64 string) (decryptedMessage string, err error)

func (*CryptoManager) DecryptStringUTF8

func (manager *CryptoManager) DecryptStringUTF8(senderPublicKey, recipientPrivateKey, encryptedMessage string) (decryptedMessage string, err error)

func (*CryptoManager) DecryptUsingEncryptionKey

func (manager *CryptoManager) DecryptUsingEncryptionKey(encryptionKey *models.Key, decryptionRequest *models.DecryptionRequest) (decryptionResult *models.DecryptedResult, err error)

func (*CryptoManager) EncryptBytesWithSharedKey

func (manager *CryptoManager) EncryptBytesWithSharedKey(messageBytes *[]byte, sharedKeyBytes *[32]byte) (encryptedMessage []byte, err error)

func (*CryptoManager) EncryptMessage

func (manager *CryptoManager) EncryptMessage(recipientPublicKey, senderPrivateKey, message string) (encryptedMessageBase64 string, err error)

func (*CryptoManager) EncryptToBase64WithSharedKeyInBase64

func (manager *CryptoManager) EncryptToBase64WithSharedKeyInBase64(message, sharedKey *string) (encryptedMessage string, err error)

func (*CryptoManager) EncryptToStringUTF8

func (manager *CryptoManager) EncryptToStringUTF8(recipientPublicKey, senderSecretKey, message string) (encryptedMessage string, err error)

func (*CryptoManager) EncryptUsingEncryptionKey

func (manager *CryptoManager) EncryptUsingEncryptionKey(encryptionKey *models.Key, encryptionRequest *models.EncryptionRequest) (encryptionResult *models.EncryptedResult, err error)

func (*CryptoManager) GenerateX25519KeyPair added in v1.0.70

func (manager *CryptoManager) GenerateX25519KeyPair() (publicKeyBase64 string, privateKeyBase64 string, err error)

func (*CryptoManager) GetSharedEncryptionKey

func (manager *CryptoManager) GetSharedEncryptionKey(recipientPublicKey, senderPrivateKey string) (sharedKey64String string, err error)

func (*CryptoManager) GetSharedKeyInBytesByBase64Keys

func (manager *CryptoManager) GetSharedKeyInBytesByBase64Keys(recipientPublicKey, senderSecretKey *string) (sharedKey [32]byte, err error)

type FhirBundleManager added in v1.0.82

type FhirBundleManager struct{}

func (*FhirBundleManager) AddRawResourceToBundle added in v1.0.82

func (fhirManager *FhirBundleManager) AddRawResourceToBundle(fhirBundle *fhir4.Bundle, resourceRaw *json.RawMessage)

Method AddRawResourceToBundle puts 'urn:uuid:<resourceID>' to BundleEntry.FullUrl

func (*FhirBundleManager) AddRawResourcesToBundle added in v1.0.82

func (fhirManager *FhirBundleManager) AddRawResourcesToBundle(fhirBundle *fhir4.Bundle, rawResources *[]json.RawMessage)

Method AddRawResourcesToBundle adds resources to FHIR Bundle with 'fullUrl'

func (*FhirBundleManager) CreateBundleDocument added in v1.0.82

func (fhirManager *FhirBundleManager) CreateBundleDocument(rawResources *[]json.RawMessage, authorID, subjectID, categoryCodeLOINC, language *string) (fhir4.Bundle, error)

Method CreateBundleDocument creates FHIR.Bundle with mandatory authorID

func (*FhirBundleManager) CreateDefaultFhirMessage added in v1.0.82

func (fhirManager *FhirBundleManager) CreateDefaultFhirMessage(messageID, authorID, entererID,
	responsibleID, senderID, receiverID, targetDeviceID, focusResourceID *string) (fhir4.Bundle, error)

'authorID' is the source of the decision and 'entererID' is the PractitionerRole source of the data entry

func (*FhirBundleManager) CreateFhirMessageWithBundleDocument added in v1.0.82

func (fhirManager *FhirBundleManager) CreateFhirMessageWithBundleDocument(fhirBundleDoc *fhir4.Bundle, messageID, authorID, entererID,
	responsibleID, senderID, receiverID, targetDeviceID, focusResourceID *string) (fhir4.Bundle, error)

'authorID' is the source of the decision and 'entererID' is the PractitionerRole source of the data entry

func (*FhirBundleManager) CreateFhirMessageWithRawResources added in v1.0.82

func (fhirManager *FhirBundleManager) CreateFhirMessageWithRawResources(rawResources *[]json.RawMessage, messageID, authorID, entererID,
	responsibleID, senderID, receiverID, targetDeviceID, focusResourceID *string) (fhir4.Bundle, error)

'authorID' is the source of the decision and 'entererID' is the PractitionerRole source of the data entry

func (*FhirBundleManager) ResourceBytesToRawJson added in v1.0.82

func (fhirManager *FhirBundleManager) ResourceBytesToRawJson(bytes *[]byte) (json.RawMessage, error)

type GenericJsonProvableWithJCS

type GenericJsonProvableWithJCS struct {
	Data  map[string]interface{}
	Proof jcsProof.Proof `json:"proof"`
}

func (*GenericJsonProvableWithJCS) GetProof

func (gp *GenericJsonProvableWithJCS) GetProof() *jcsProof.Proof

func (*GenericJsonProvableWithJCS) SetProof

func (gp *GenericJsonProvableWithJCS) SetProof(p jcsProof.Proof)

type KeyPairManager

type KeyPairManager struct {
}

func (*KeyPairManager) CreateEd25519SignKeyPair

func (manager *KeyPairManager) CreateEd25519SignKeyPair(walletId string, uhcOwnerId string, purposes []string, tag string) (*models.Key, error)

func (*KeyPairManager) CreateX25519EncryptKeyPair

func (manager *KeyPairManager) CreateX25519EncryptKeyPair(walletId string, uhcOwnerId string, purposes []string, tag string) (*models.Key, error)

Jump to

Keyboard shortcuts

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