flagvalue

package
v0.1.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package flagvalue provides reusable pflag.Value implementations for the complex inputs the slsa-attester CLI accepts: resource descriptors, digest and level maps, arbitrary JSON structs, and RFC3339 timestamps.

Where it makes sense, a value can be supplied as inline JSON, as @path to a JSON file, or as a key=value shorthand.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChecksumFileSlice

type ChecksumFileSlice struct {
	Values []*intoto.ResourceDescriptor
}

ChecksumFileSlice accumulates subject resource descriptors from files in coreutils checksum format: one "<digest><whitespace><name>" entry per line, as emitted by sha256sum and friends (the same format slsa-github-generator accepted in its base64-subjects input). The digest algorithm is inferred from the digest length using the in-toto algorithm table, so sha1sum, sha256sum, sha384sum and sha512sum outputs all work. Empty lines are ignored, the coreutils binary-mode "*" name marker is stripped, and a name appearing twice is an error.

func (*ChecksumFileSlice) Set

func (c *ChecksumFileSlice) Set(path string) error

func (*ChecksumFileSlice) String

func (c *ChecksumFileSlice) String() string

func (*ChecksumFileSlice) Type

func (c *ChecksumFileSlice) Type() string

type RawJSON

type RawJSON struct {
	Data []byte
}

RawJSON holds raw JSON given inline or as @file. Only the JSON syntax is checked at flag-parse time; the schema is validated by whoever consumes the bytes (e.g. a strict proto unmarshal once the target type is known).

func (*RawJSON) Set

func (r *RawJSON) Set(in string) error

func (*RawJSON) String

func (r *RawJSON) String() string

func (*RawJSON) Type

func (r *RawJSON) Type() string

type ResourceDescriptorSlice

type ResourceDescriptorSlice struct {
	Values []*intoto.ResourceDescriptor
}

ResourceDescriptorSlice accumulates intoto ResourceDescriptors from repeated flag occurrences. Each occurrence may be inline JSON, @file, or the shorthand "name=foo,uri=...,sha256=abc" where name/uri are scalar fields and any other key is treated as a digest algorithm.

func (*ResourceDescriptorSlice) Set

func (*ResourceDescriptorSlice) String

func (r *ResourceDescriptorSlice) String() string

func (*ResourceDescriptorSlice) Type

func (r *ResourceDescriptorSlice) Type() string

type StringMap

type StringMap struct {
	Values map[string]string
}

StringMap accumulates key=value string entries. Multiple comma-separated pairs per occurrence are allowed, and the flag may be repeated; later keys win.

func (*StringMap) Set

func (m *StringMap) Set(in string) error

func (*StringMap) String

func (m *StringMap) String() string

func (*StringMap) Type

func (m *StringMap) Type() string

type Struct

type Struct struct {
	Value *structpb.Struct
}

Struct holds a structpb.Struct parsed from inline JSON or @file.

func (*Struct) Set

func (s *Struct) Set(in string) error

func (*Struct) String

func (s *Struct) String() string

func (*Struct) Type

func (s *Struct) Type() string

type SubjectSlice

type SubjectSlice struct {
	Values []*intoto.ResourceDescriptor
}

SubjectSlice accumulates subject resource descriptors from repeated flag occurrences given as algorithm:digest, e.g. sha256:<hex>. The syntax and validation mirror the slsa verifier's -s/--subject flag so digests stated at attest time can be restated verbatim at verify time: the algorithm must be one in-toto defines, the digest must be hex of the algorithm's length, and it is normalized to lower case.

func (*SubjectSlice) Set

func (s *SubjectSlice) Set(in string) error

func (*SubjectSlice) String

func (s *SubjectSlice) String() string

func (*SubjectSlice) Type

func (s *SubjectSlice) Type() string

type Time

type Time struct {
	Value *time.Time
}

Time holds a timestamp parsed from RFC3339.

func (*Time) Set

func (t *Time) Set(in string) error

func (*Time) String

func (t *Time) String() string

func (*Time) Type

func (t *Time) Type() string

type Uint64Map

type Uint64Map struct {
	Values map[string]uint64
}

Uint64Map accumulates key=value entries whose values are unsigned integers.

func (*Uint64Map) Set

func (m *Uint64Map) Set(in string) error

func (*Uint64Map) String

func (m *Uint64Map) String() string

func (*Uint64Map) Type

func (m *Uint64Map) Type() string

Jump to

Keyboard shortcuts

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