Skip to content

ibm-hyper-protect/contract-go

Repository files navigation

Contract Go

Utility functions to encrypt and decrypt an Hyper Protect Container Runtime contract.

Usage

Refer to main.go for an example

Design

The API design is based on functional and monadic interfaces exposed by the fp-go library.

Error Handling

Functions that can produce an error return an Either instead of the idiomatic golang tuple, because an Either can be used in functiona composition but the tuple cannot.

Side Effects

Functions with side effects are represented as IOEither, i.e. the actual execution of the side effect is deferred until the function gets executed

Idiomatic golang style

  • Either: to convert a function returning Either to a function in golang style, call Either.UneitherizeXXX

References

  • contract-schema - JSON schema for the contract
  • fp-go - implementation of the functional programming layer