record

package
v0.0.0-...-51d629d Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2016 License: BSD-3-Clause, BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PackageBodytypeError = "Error"
)

Variables

This section is empty.

Functions

func GoodSignature

func GoodSignature(p Packer) bool

Check to see if the signature in the header is valid.

func SignPackage

func SignPackage(p Packer)

SignPackage with a base64-encoded HMAC of the body contents.

Types

type BodyInterface

type BodyInterface interface {
	Check() error
}

type Package

type Package struct {
	System   string
	Version  float32
	BodyType string

	Head head.HeaderInterface
	Body string
	// contains filtered or unexported fields
}

Package describes what is coming from a request. It is similar to, but different from, the response package. It conforms to the Packer interface

func (*Package) ClearSecret

func (p *Package) ClearSecret()

func (*Package) GetBody

func (p *Package) GetBody() string

GetBody returns the body string

func (*Package) GetBodyType

func (h *Package) GetBodyType() string

func (*Package) GetHead

func (p *Package) GetHead() head.HeaderInterface

Return the HEAD of the package

func (*Package) GetSecret

func (p *Package) GetSecret() []byte

GetSecret returns the secret used to sign the package

func (*Package) IsBodySet

func (p *Package) IsBodySet() bool

IsBodySet checks to see if the body is blank or not

func (*Package) IsHeadSet

func (p *Package) IsHeadSet() bool

CheckHead will determine if we have all the data required for a Head in the package

func (*Package) IsPackageComplete

func (p *Package) IsPackageComplete() bool

Check to see if the package is complete

func (*Package) SetBody

func (p *Package) SetBody(body string)

SetBody returns the value that is in the body. If the package is complete, it will be signed.

func (*Package) SetBodyMarshal

func (p *Package) SetBodyMarshal(body interface{}) (err error)

func (*Package) SetBodyType

func (h *Package) SetBodyType(val string)

func (*Package) SetHead

func (p *Package) SetHead(head head.HeaderInterface)

SetHead will copy the head to our head, then sign the package if it is complete.

func (*Package) SetSecret

func (p *Package) SetSecret(s []byte)

SetSecret sets the secret used to sign the package

type Packer

type Packer interface {
	SetBodyMarshal(interface{}) error
	SetBody(string)
	SetBodyType(string)
	SetHead(head.HeaderInterface)
	SetSecret([]byte)
	ClearSecret()

	GetHead() head.HeaderInterface
	GetBody() string
	GetSecret() []byte
	GetBodyType() string

	IsPackageComplete() bool
	IsHeadSet() bool
	IsBodySet() bool
}

func NewPackage

func NewPackage() Packer

NewPackage creates a new package and returns the address to the caller.

Directories

Path Synopsis
Mappers contains functions that will map an input to an output.
Mappers contains functions that will map an input to an output.

Jump to

Keyboard shortcuts

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