Documentation
¶
Index ¶
- Constants
- type Definition
- func (d *Definition) Algorithm() string
- func (d *Definition) Components() []component.Identifier
- func (d *Definition) Created() (int64, bool)
- func (d *Definition) CreatedTime() (time.Time, bool)
- func (d *Definition) Expires() (int64, bool)
- func (d *Definition) ExpiresTime() (time.Time, bool)
- func (d *Definition) GetParameter(key string, dst any) error
- func (d *Definition) KeyID() string
- func (d *Definition) Label() string
- func (d *Definition) MarshalSFV() ([]byte, error)
- func (d *Definition) Nonce() (string, bool)
- func (d *Definition) Parameters() []string
- func (d *Definition) SFV() (*sfv.InnerList, error)
- func (d *Definition) SetAlgorithm(algorithm string) *Definition
- func (d *Definition) SetCreated(timestamp int64) *Definition
- func (d *Definition) SetCreatedTime(t time.Time) *Definition
- func (d *Definition) SetExpires(timestamp int64) *Definition
- func (d *Definition) SetExpiresTime(t time.Time) *Definition
- func (d *Definition) SetKeyID(keyid string) *Definition
- func (d *Definition) SetLabel(label string) *Definition
- func (d *Definition) SetNonce(nonce string) *Definition
- func (d *Definition) SetTag(tag string) *Definition
- func (d *Definition) Tag() (string, bool)
- type DefinitionBuilder
- func (b *DefinitionBuilder) Algorithm(algorithm string) *DefinitionBuilder
- func (b *DefinitionBuilder) Build() (*Definition, error)
- func (b *DefinitionBuilder) Components(components ...component.Identifier) *DefinitionBuilder
- func (b *DefinitionBuilder) Created(timestamp int64) *DefinitionBuilder
- func (b *DefinitionBuilder) CreatedTime(t time.Time) *DefinitionBuilder
- func (b *DefinitionBuilder) Expires(timestamp int64) *DefinitionBuilder
- func (b *DefinitionBuilder) ExpiresTime(t time.Time) *DefinitionBuilder
- func (b *DefinitionBuilder) KeyID(keyid string) *DefinitionBuilder
- func (b *DefinitionBuilder) Label(label string) *DefinitionBuilder
- func (b *DefinitionBuilder) MustBuild() *Definition
- func (b *DefinitionBuilder) Nonce(nonce string) *DefinitionBuilder
- func (b *DefinitionBuilder) Parameter(key string, value any) *DefinitionBuilder
- func (b *DefinitionBuilder) ResetComponents() *DefinitionBuilder
- func (b *DefinitionBuilder) Tag(tag string) *DefinitionBuilder
- type Value
- type ValueBuilder
Constants ¶
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) 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) 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 ¶
func (b *DefinitionBuilder) Tag(tag string) *DefinitionBuilder
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 (*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) MarshalSFV ¶
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