signature

package
v0.0.0-...-eac9d76 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package signature implements the CACAO 2.0 signature object.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSigningMethodsVocab

func GetSigningMethodsVocab() []string

GetSigningMethodsVocab - This will return a slice of officially supported signing methods

Types

type Signature

type Signature struct {
	ObjectType      string     `json:"type,omitempty"`
	ID              string     `json:"id,omitempty"`
	CreatedBy       string     `json:"created_by,omitempty"`
	Created         string     `json:"created,omitempty"`
	Modified        string     `json:"modified,omitempty"`
	Revoked         bool       `json:"revoked,omitempty"`
	Signee          string     `json:"signee,omitempty"`
	ValidFrom       string     `json:"valid_from,omitempty"`
	ValidUntil      string     `json:"valid_until,omitempty"`
	RelatedTo       string     `json:"related_to,omitempty"`
	RelatedVersion  string     `json:"related_version,omitempty"`
	HashAlgorithm   string     `json:"hash_algorithm,omitempty"`
	Algorithm       string     `json:"algorithm,omitempty"`
	PublicKey       string     `json:"public_key,omitempty"`
	PublicCertChain []string   `json:"public_cert_chain,omitempty"`
	CertURL         string     `json:"cert_url,omitempty"`
	Thumbprint      string     `json:"thumbprint,omitempty"`
	Value           string     `json:"value,omitempty"`
	Signature       *Signature `json:"signature,omitempty"`
}

Signature - This type defines the digital signature for a playbook object

func New

func New() *Signature

New - This function will create a new signature object and return it as a pointer. It will also initialize the object by setting all of the basic properties.

func (*Signature) Encode

func (s *Signature) Encode() ([]byte, error)

Encode - This method is a simple wrapper for encoding an object into JSON

func (*Signature) EncodeToString

func (s *Signature) EncodeToString() (string, error)

EncodeToString - This method is a simple wrapper for encoding an object into JSON

func (*Signature) GetCurrentTime

func (s *Signature) GetCurrentTime(precision string) string

GetCurrentTime - This method takes in a value of either milli or micro and returns the current time in RFC 3339 format

func (*Signature) SetCreated

func (s *Signature) SetCreated(t interface{}) error

SetCreated - This method takes in a timestamp in either time.Time or string format and updates the created property with it. The value is stored as a string, so if the value is in time.Time format, it will be converted to the correct timestamp format.

func (*Signature) SetModified

func (s *Signature) SetModified(t interface{}) error

SetModified - This method takes in a timestamp in either time.Time or string format and updates the modified property with it. The value is stored as a string, so if the value is in time.Time format, it will be converted to the correct timestamp format.

func (*Signature) SetNewID

func (s *Signature) SetNewID(objType string) error

SetNewID - This method takes in a string value representing an object type and creates a new ID based on the specification format and updates the id property for the object.

Jump to

Keyboard shortcuts

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