common

package
v0.6.1-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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
}

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) 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) error

func (*Handler) PackAllowlistRequestTxData

func (h *Handler) PackAllowlistRequestTxData(reqDigestStr string, 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) NewCapabilitiesRegistryClient

func (m *MockClientFactory) NewCapabilitiesRegistryClient() (*client.CapabilitiesRegistryClient, error)

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 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