Documentation
¶
Index ¶
- func CalculateDigest[I any](r jsonrpc2.Request[I]) ([32]byte, error)
- func DeriveBundleFilename(digest [32]byte) string
- func EncryptSecret(secret, masterPublicKeyHex string, ownerAddress string) (string, error)
- func HexToBytes32(h string) ([32]byte, error)
- func SaveBundle(path string, b *UnsignedBundle) error
- type GatewayClient
- type HTTPClient
- type Handler
- func (h *Handler) EncryptSecrets(rawSecrets UpsertSecretsInputs) ([]*vault.EncryptedSecret, error)
- func (h *Handler) EnsureOwnerLinkedOrFail() error
- func (h *Handler) Execute(inputs UpsertSecretsInputs, method string, duration time.Duration, ...) error
- func (h *Handler) LogMSIGNextSteps(txData string, digest [32]byte, bundlePath string) error
- func (h *Handler) PackAllowlistRequestTxData(reqDigest [32]byte, duration time.Duration) (string, error)
- func (h *Handler) ParseVaultGatewayResponse(method string, respBody []byte) error
- func (h *Handler) ResolveInputs() (UpsertSecretsInputs, error)
- func (h *Handler) ValidateInputs(inputs UpsertSecretsInputs) error
- type MockClientFactory
- type SecretItem
- type SecretsYamlConfig
- type UnsignedBundle
- type UpsertSecretsInputs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeriveBundleFilename ¶
func EncryptSecret ¶
func HexToBytes32 ¶
func SaveBundle ¶
func SaveBundle(path string, b *UnsignedBundle) error
Types ¶
type GatewayClient ¶
type HTTPClient ¶
type Handler ¶
type Handler struct {
Log *zerolog.Logger
ClientFactory client.Factory
SecretsFilePath string
PrivateKey *ecdsa.PrivateKey
OwnerAddress string
EnvironmentSet *environments.EnvironmentSet
Gw GatewayClient
Wrc *client.WorkflowRegistryV2Client
Credentials *credentials.Credentials
}
func NewHandler ¶
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) EnsureOwnerLinkedOrFail ¶
EnsureOwnerLinkedOrFail TODO this reuses the same logic as in autoLink.go which is tied to deploy; consider refactoring to avoid duplication
func (*Handler) Execute ¶
func (h *Handler) Execute( inputs UpsertSecretsInputs, method string, duration time.Duration, ownerType string, ) error
Execute is shared for 'create' and 'update' (YAML-only). - MSIG => step 1: build request, save bundle, print instructions - EOA => build request, allowlist if needed, POST
func (*Handler) LogMSIGNextSteps ¶
func (*Handler) PackAllowlistRequestTxData ¶
func (h *Handler) PackAllowlistRequestTxData(reqDigest [32]byte, duration time.Duration) (string, error)
TODO: use TxType interface
func (*Handler) ParseVaultGatewayResponse ¶
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 loads secrets from a YAML file. Errors if the path is not .yaml/.yml — MSIG step 2 is handled by `cre secrets execute`.
func (*Handler) ValidateInputs ¶
func (h *Handler) ValidateInputs(inputs UpsertSecretsInputs) error
ValidateInputs validates the input structure.
type MockClientFactory ¶
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 UnsignedBundle ¶
type UnsignedBundle struct {
RequestID string `json:"request_id"`
Method string `json:"method"`
DigestHex string `json:"digest_hex"`
RequestBody json.RawMessage `json:"request_body"`
CreatedAt time.Time `json:"created_at"`
}
func LoadBundle ¶
func LoadBundle(path string) (*UnsignedBundle, error)
type UpsertSecretsInputs ¶
type UpsertSecretsInputs []SecretItem
UpsertSecretsInputs holds the secrets passed to the CLI.