common

package
v0.6.4-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: MIT Imports: 33 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateDigest

func CalculateDigest[I any](r jsonrpc2.Request[I]) ([32]byte, error)

func EncryptSecret

func EncryptSecret(secret, masterPublicKeyHex string) (string, error)

func HexToBytes32

func HexToBytes32(h string) ([32]byte, error)

HexToBytes32 converts a hex string (with or without 0x prefix) to a [32]byte. Returns an error if the input isn't precisely 32 bytes after decoding.

Types

type GatewayClient

type GatewayClient interface {
	Post(body []byte) (respBody []byte, status int, err error)
}

type HTTPClient

type HTTPClient struct {
	URL           string
	Client        *http.Client
	RetryAttempts uint
	RetryDelay    time.Duration
}

func (*HTTPClient) Post

func (g *HTTPClient) Post(body []byte) ([]byte, int, error)

type Handler

type Handler struct {
	Log             *zerolog.Logger
	ClientFactory   client.Factory
	SecretsFilePath string
	PrivateKey      *ecdsa.PrivateKey
	OwnerAddress    string
	EnvironmentSet  *environments.EnvironmentSet
	Gw              GatewayClient
}

func NewHandler

func NewHandler(ctx *runtime.Context, secretsFilePath string) (*Handler, error)

NewHandler creates a new handler instance.

func (*Handler) EncryptSecrets

func (h *Handler) EncryptSecrets(rawSecrets UpsertSecretsInputs) ([]*vault.EncryptedSecret, error)

EncryptSecrets takes the raw secrets and encrypts them, returning pointers.

func (*Handler) Execute

func (h *Handler) Execute(
	inputs UpsertSecretsInputs,
	method string,
	duration time.Duration,
	ownerType string,
	requestIDFlag string,
) error

Execute is a shared method for both 'create' and 'update' commands. It encapsulates the core logic of validation, encryption, and sending data.

func (*Handler) LogMSIGNextSteps

func (h *Handler) LogMSIGNextSteps(txData string, requestID string) error

func (*Handler) PackAllowlistRequestTxData

func (h *Handler) PackAllowlistRequestTxData(reqDigest [32]byte, duration time.Duration) (string, error)

TODO: use TxType interface

func (*Handler) ParseVaultGatewayResponse

func (h *Handler) ParseVaultGatewayResponse(method string, respBody []byte) error

ParseVaultGatewayResponse parses the JSON-RPC response, decodes the SignedOCRResponse payload into the appropriate proto type (CreateSecretsResponse, UpdateSecretsResponse, DeleteSecretsResponse), and logs one line per secret with id/owner/namespace/success/error.

func (*Handler) ResolveInputs

func (h *Handler) ResolveInputs() (UpsertSecretsInputs, error)

ResolveInputs unmarshals the JSON string into the UpsertSecretsInputs struct.

func (*Handler) ValidateInputs

func (h *Handler) ValidateInputs(inputs UpsertSecretsInputs) error

ValidateInputs validates the input structure.

type MockClientFactory

type MockClientFactory struct {
	mock.Mock
}

func (*MockClientFactory) GetSkipConfirmation

func (m *MockClientFactory) GetSkipConfirmation() bool

func (*MockClientFactory) GetTxType

func (m *MockClientFactory) GetTxType() client.TxType

func (*MockClientFactory) NewWorkflowRegistryV2Client

func (m *MockClientFactory) NewWorkflowRegistryV2Client() (*client.WorkflowRegistryV2Client, error)

type SecretItem

type SecretItem struct {
	ID        string `json:"id" validate:"required"`
	Value     string `json:"value" validate:"required"`
	Namespace string `json:"namespace"`
}

SecretItem represents a single secret with its ID, value, and optional namespace.

type SecretsYamlConfig

type SecretsYamlConfig struct {
	SecretsNames map[string][]string `yaml:"secretsNames"`
}

type UpsertSecretsInputs

type UpsertSecretsInputs []SecretItem

UpsertSecretsInputs holds the secrets passed to the CLI.

Jump to

Keyboard shortcuts

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