input

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: MIT Imports: 6 Imported by: ? modules, 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

View Source
const (
	// Predefined derived components
	AuthorityComponent           = "@authority"
	MethodComponent              = "@method"
	PathComponent                = "@path"
	QueryComponent               = "@query"
	RequestTargetComponent       = "@request-target"
	SchemeComponent              = "@scheme"
	SignatureParametersComponent = "@signature-params"
	StatusComponent              = "@status"
	TargetURIComponent           = "@target-uri"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Definition

type Definition struct {
	// contains filtered or unexported fields
}

Definition represents a single signature definition within a Value. A Definition must contain:

  • a label (the signature label)
  • a list of components (the signature components) this list needs to have at least one member at the time of signing
  • a key ID (the identifier for the key material used to sign)
  • an algorithm (the algorithm used to sign)

Everything else is optional, but can be used to provide additional information about the signature.

func (*Definition) Algorithm

func (d *Definition) Algorithm() string

Algorithm returns the signature algorithm

func (*Definition) Components

func (d *Definition) Components() []component.Identifier

Components returns the list of covered components

func (*Definition) Created

func (d *Definition) Created() (int64, bool)

Created returns the created timestamp

func (*Definition) CreatedTime

func (d *Definition) CreatedTime() (time.Time, bool)

CreatedTime returns the created timestamp as a time.Time

func (*Definition) Expires

func (d *Definition) Expires() (int64, bool)

Expires returns the expires timestamp

func (*Definition) ExpiresTime

func (d *Definition) ExpiresTime() (time.Time, bool)

ExpiresTime returns the expires timestamp as a time.Time

func (*Definition) GetParameter

func (d *Definition) GetParameter(key string, dst any) error

Parameter returns an additional parameter

func (*Definition) KeyID

func (d *Definition) KeyID() string

KeyID returns the key identifier

func (*Definition) Label

func (d *Definition) Label() string

Label returns the signature label

func (*Definition) MarshalSFV

func (d *Definition) MarshalSFV() ([]byte, error)

MarshalSFV implements the sfv.Marshaler interface for Definition A Definition marshals to an InnerList with components and parameters

func (*Definition) Nonce

func (d *Definition) Nonce() (string, bool)

Nonce returns the nonce parameter

func (*Definition) Parameters

func (d *Definition) Parameters() []string

func (*Definition) SFV

func (d *Definition) SFV() (*sfv.InnerList, error)

func (*Definition) SetAlgorithm

func (d *Definition) SetAlgorithm(algorithm string) *Definition

SetAlgorithm sets the signature algorithm

func (*Definition) SetCreated

func (d *Definition) SetCreated(timestamp int64) *Definition

SetCreated sets the created timestamp

func (*Definition) SetCreatedTime

func (d *Definition) SetCreatedTime(t time.Time) *Definition

SetCreatedTime sets the created timestamp from a time.Time

func (*Definition) SetExpires

func (d *Definition) SetExpires(timestamp int64) *Definition

SetExpires sets the expires timestamp

func (*Definition) SetExpiresTime

func (d *Definition) SetExpiresTime(t time.Time) *Definition

SetExpiresTime sets the expires timestamp from a time.Time

func (*Definition) SetKeyID

func (d *Definition) SetKeyID(keyid string) *Definition

SetKeyID sets the key identifier

func (*Definition) SetLabel

func (d *Definition) SetLabel(label string) *Definition

SetLabel sets the signature label

func (*Definition) SetNonce

func (d *Definition) SetNonce(nonce string) *Definition

SetNonce sets the nonce parameter

func (*Definition) SetTag

func (d *Definition) SetTag(tag string) *Definition

SetTag sets the application-specific tag

func (*Definition) Tag

func (d *Definition) Tag() (string, bool)

Tag returns the application-specific tag

type DefinitionBuilder

type DefinitionBuilder struct {
	// contains filtered or unexported fields
}

DefinitionBuilder helps build Definition objects

func NewDefinitionBuilder

func NewDefinitionBuilder() *DefinitionBuilder

NewDefinitionBuilder creates a new DefinitionBuilder

func (*DefinitionBuilder) Algorithm

func (b *DefinitionBuilder) Algorithm(algorithm string) *DefinitionBuilder

Algorithm sets the signature algorithm

func (*DefinitionBuilder) Build

func (b *DefinitionBuilder) Build() (*Definition, error)

Build creates the Definition with validation

func (*DefinitionBuilder) Components

func (b *DefinitionBuilder) Components(components ...component.Identifier) *DefinitionBuilder

Components adds the covered components.

func (*DefinitionBuilder) Created

func (b *DefinitionBuilder) Created(timestamp int64) *DefinitionBuilder

Created sets the created timestamp

func (*DefinitionBuilder) CreatedTime

func (b *DefinitionBuilder) CreatedTime(t time.Time) *DefinitionBuilder

CreatedTime sets the created timestamp from a time.Time

func (*DefinitionBuilder) Expires

func (b *DefinitionBuilder) Expires(timestamp int64) *DefinitionBuilder

Expires sets the expires timestamp

func (*DefinitionBuilder) ExpiresTime

func (b *DefinitionBuilder) ExpiresTime(t time.Time) *DefinitionBuilder

ExpiresTime sets the expires timestamp from a time.Time

func (*DefinitionBuilder) KeyID

func (b *DefinitionBuilder) KeyID(keyid string) *DefinitionBuilder

KeyID sets the key identifier

func (*DefinitionBuilder) Label

func (b *DefinitionBuilder) Label(label string) *DefinitionBuilder

Label sets the signature label

func (*DefinitionBuilder) MustBuild

func (b *DefinitionBuilder) MustBuild() *Definition

MustBuild creates the Definition and panics if validation fails

func (*DefinitionBuilder) Nonce

func (b *DefinitionBuilder) Nonce(nonce string) *DefinitionBuilder

Nonce sets the nonce parameter

func (*DefinitionBuilder) Parameter

func (b *DefinitionBuilder) Parameter(key string, value any) *DefinitionBuilder

Parameter sets an additional parameter

func (*DefinitionBuilder) ResetComponents

func (b *DefinitionBuilder) ResetComponents() *DefinitionBuilder

func (*DefinitionBuilder) Tag

Tag sets the application-specific tag

type Value

type Value struct {
	// contains filtered or unexported fields
}

Value is a single signature input value (i.e. a single entry in the Signature-Input header field). A Value can contain multiple signature definitions.

func Parse

func Parse(data []byte) (*Value, error)

func (*Value) AddDefinition

func (v *Value) AddDefinition(def *Definition) *Value

AddDefinition adds a signature definition

func (*Value) Definitions

func (v *Value) Definitions() []*Definition

Definitions returns all signature definitions

func (*Value) GetDefinition

func (v *Value) GetDefinition(label string) (*Definition, bool)

GetDefinition returns a definition by label

func (*Value) Len

func (v *Value) Len() int

Len returns the number of definitions

func (*Value) MarshalSFV

func (v *Value) MarshalSFV() ([]byte, error)

MarshalSFV implements the sfv.Marshaler interface for Value A Value marshals to a Dictionary with signature labels as keys and InnerLists as values

type ValueBuilder

type ValueBuilder struct {
	// contains filtered or unexported fields
}

ValueBuilder helps build Value objects

func NewValueBuilder

func NewValueBuilder() *ValueBuilder

NewValueBuilder creates a new ValueBuilder

func (*ValueBuilder) AddDefinition

func (b *ValueBuilder) AddDefinition(def *Definition) *ValueBuilder

AddDefinition adds a signature definition

func (*ValueBuilder) Build

func (b *ValueBuilder) Build() (*Value, error)

Build creates the Value with validation

func (*ValueBuilder) MustBuild

func (b *ValueBuilder) MustBuild() *Value

MustBuild creates the Value and panics if validation fails

Jump to

Keyboard shortcuts

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