ioeither

package
v1.0.39 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ReadContract reads a contract document from a YAML file, parses and validates it
	// and returns it as a strongly typed data structure
	ReadContract = F.Flow2(
		file.ReadFile,
		IOE.ChainEitherK(SE.ParseAndValidateContract),
	)
)

Functions

func EncryptAndSignContract

func EncryptAndSignContract(
	enc func(data []byte) IOE.IOEither[error, string],
	signer func([]byte) func([]byte) IOE.IOEither[error, []byte],
	pubKey func([]byte) E.Either[error, []byte],
) func(privKey []byte) ContractEncrypter

EncryptAndSignContract returns a function that signs the workload and env part of a contract and that adds the public key of the signature

- enc encrypts a piece of data - signer signs a piece of data - pubKey extracts the public key from the private key

func EncryptContract

func EncryptContract(encBasic func(pubKey []byte) func(data []byte) IOE.IOEither[error, string]) func(pubkey []byte) ContractEncrypter

EncryptContract encrypts the field in a contract with the given public key

Types

type ContractEncrypter

type ContractEncrypter = func(ctr *T.Contract) IOE.IOEither[error, SC.EncryptedContract]

ContractEncrypter is the type of a function that takes a contract and that encrypts it

Jump to

Keyboard shortcuts

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