Documentation ¶
Index ¶
- Constants
- Variables
- func Commands() []*cli.Command
- func ContractEncrypterFromConfig(cfg *EncryptAndSignConfig) IOE.IOEither[error, SVIOE.ContractEncrypter]
- func DownloadCertificatesCommand() *cli.Command
- func DownloadCertificatesFromConfig(cfg *DownloadCertificatesConfig) IOE.IOEither[error, map[string]string]
- func EncryptAndSignCommand() *cli.Command
- type DownloadCertificatesConfig
- type EncryptAndSignConfig
- type KeyConfig
- type OutputConfig
Constants ¶
View Source
const ( // execution modes ModeOpenSSL = "openssl" ModeCrypto = "crypto" ModeAuto = "auto" // serialization formats FormatJson = "json" FormatYaml = "yaml" )
Variables ¶
View Source
var ( // ContractEncrypterFromContext returns a [SVIOE.ContractEncrypter] based on a [cli.Context] ContractEncrypterFromContext = F.Flow2( EncryptAndSignConfigFromContext, ContractEncrypterFromConfig, ) // ValidatedContractFromContext returns a [types.Contract] from a [cli.Context] and validates it against the schema ValidatedContractFromContext = F.Flow3( lookupInput, CFIOE.ReadFromInput, IOE.ChainEitherK(F.Flow2( Y.Parse[types.AnyMap], E.Chain(types.ValidateContract), )), ) // EncryptAndSignFromContext returns an [SC.EncryptedContract] from information on the [cli.Context] EncryptAndSignFromContext = F.Flow4( T.Replicate2[*cli.Context], T.Map2(ContractEncrypterFromContext, ValidatedContractFromContext), T.Tupled2(IOE.MonadAp[IOE.IOEither[error, SC.EncryptedContract], error, *types.Contract]), IOE.Flatten[error, SC.EncryptedContract], ) // EncryptSignAndWriteFromContext transforms an unencrypted contract into an encrypted and signed contract from information on the [cli.Context] EncryptSignAndWriteFromContext = F.Flow3( T.Replicate2[*cli.Context], T.Map2(EncryptAndSignFromContext, writeFromContext[SC.EncryptedContract]), T.Tupled2(IOE.MonadChain[error, SC.EncryptedContract, []byte]), ) DownloadCertificatesFromContext = F.Flow2( DownloadCertificatesConfigFromContext, DownloadCertificatesFromConfig, ) DownloadCertificatesAndWriteFromContext = F.Flow3( T.Replicate2[*cli.Context], T.Map2(DownloadCertificatesFromContext, writeFromContext[map[string]string]), T.Tupled2(IOE.MonadChain[error, map[string]string, []byte]), ) )
Functions ¶
func ContractEncrypterFromConfig ¶
func ContractEncrypterFromConfig(cfg *EncryptAndSignConfig) IOE.IOEither[error, SVIOE.ContractEncrypter]
ContractEncrypterFromConfig constructs a [SVIOE.ContractEncrypter] based on a config object
func DownloadCertificatesCommand ¶
func DownloadCertificatesCommand() *cli.Command
EncryptAndSignCommand returns a command that encrypts and signs a contract
func DownloadCertificatesFromConfig ¶
func DownloadCertificatesFromConfig(cfg *DownloadCertificatesConfig) IOE.IOEither[error, map[string]string]
DownloadCertificatesFromConfig dowloads certificates based on some config
func EncryptAndSignCommand ¶
func EncryptAndSignCommand() *cli.Command
EncryptAndSignCommand returns a command that encrypts and signs a contract
Types ¶
type DownloadCertificatesConfig ¶
type DownloadCertificatesConfig struct { Versions []string // possible versions to download UrlTemplate string // the URL template for the download URL }
func DownloadCertificatesConfigFromContext ¶
func DownloadCertificatesConfigFromContext(ctx *cli.Context) *DownloadCertificatesConfig
DownloadCertificatesConfigFromContext decodes the DownloadCertificatesConfig from a cli.Context
type EncryptAndSignConfig ¶
type EncryptAndSignConfig struct { Mode string // one of the mode flags PrivKey KeyConfig // private key used for signing PubCert KeyConfig // public key used for encryption }
func EncryptAndSignConfigFromContext ¶
func EncryptAndSignConfigFromContext(ctx *cli.Context) *EncryptAndSignConfig
EncryptAndSignConfigFromContext decodes an EncryptAndSignConfig from a cli.Context
type OutputConfig ¶
type OutputConfig struct { Format string // output format (e.g. json, or yaml) Output string // target of the output (e.g. a filename, or stdout) }
OutputConfig specifies aspects of the output
func OutputConfigFromContext ¶
func OutputConfigFromContext(ctx *cli.Context) *OutputConfig
OutputConfigFromContext returns an OutputConfig based on the cli.Context
Click to show internal directories.
Click to hide internal directories.