Documentation
¶
Overview ¶
Package sealcli hosts the flag, key and payload plumbing the seal-payload and seal-event commands share: the four key-source flags with their help text, the exactly-one-of-per-pair refusal keymaterial deliberately leaves to its callers, and the file-or-stdin payload read. Each command keeps only its own flags, its own required-flag checks and its own sealing call.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUsage = errors.New("usage error")
ErrUsage marks flag-parse failures whose message the FlagSet already printed to stderr itself — a command must not print them a second time.
Functions ¶
func PositionalPath ¶
PositionalPath parses args with fs and returns the single optional positional argument: the payload path ReadPayload then consumes, "" when absent. A parse failure is wrapped in ErrUsage so the caller can tell the already-reported ones apart; a second positional argument is refused here.
Types ¶
type KeySources ¶
type KeySources struct {
SignFile, SignValue, EncryptFile, EncryptValue string
}
KeySources holds the four key-source flags a seal CLI takes.
func KeyFlags ¶
func KeyFlags(fs *flag.FlagSet, signUse, encryptUse string) *KeySources
KeyFlags registers -sign-key-file, -sign-key-value, -encrypt-key-file and -encrypt-key-value on fs and returns the struct they bind to. signUse and encryptUse are the per-CLI purpose clauses appended to the two -key-file help strings ("used to sign the outbound JWS", "used to encrypt the subject member"), so each command keeps naming what its own keys are for.
func (*KeySources) Load ¶
func (k *KeySources) Load(signKid, encryptKid string) (*keymaterial.ProducerKeys, error)
Load re-runs Validate — so the type is safe to use without the CLI-side call — then loads and parses both keys and returns the producer-role resolver under the given kids. The refusals precede any I/O, so a mistyped invocation costs no file read.
func (*KeySources) Validate ¶
func (k *KeySources) Validate() error
Validate enforces exactly-one-of per key-source pair. keymaterial's loaders let the file source win when both are set, so the choice has to be refused by the caller; each CLI runs this first in its own flag validation, which is what keeps the refusals ahead of the required-flag messages in stderr.