entity

package
v0.2010.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2020 License: Apache-2.0 Imports: 11 Imported by: 11

Documentation

Overview

Package entity implements common entity routines.

Index

Constants

View Source
const (
	// LatestEntityDescriptorVersion is the latest entity descriptor version that should be used for
	// all new descriptors. Using earlier versions may be rejected.
	LatestEntityDescriptorVersion = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity

type Entity struct {
	cbor.Versioned

	// ID is the public key identifying the entity.
	ID signature.PublicKey `json:"id"`

	// Nodes is the vector of node identity keys owned by this entity, that
	// will sign the descriptor with the node signing key rather than the
	// entity signing key.
	Nodes []signature.PublicKey `json:"nodes,omitempty"`

	// AllowEntitySignedNodes is true iff nodes belonging to this entity
	// may be signed with the entity signing key.
	AllowEntitySignedNodes bool `json:"allow_entity_signed_nodes,omitempty"`
}

Entity represents an entity that controls one or more Nodes and or services.

func Generate

func Generate(baseDir string, signerFactory signature.SignerFactory, template *Entity) (*Entity, signature.Signer, error)

Generate generates a new entity and serializes it to disk.

func GenerateWithSigner

func GenerateWithSigner(baseDir string, signer signature.Signer, template *Entity) (*Entity, error)

GenerateWithSigner generates a new entity using an existing signer and serializes it to disk.

func Load

func Load(baseDir string, signerFactory signature.SignerFactory) (*Entity, signature.Signer, error)

Load loads an existing entity from disk.

func LoadDescriptor

func LoadDescriptor(f string) (*Entity, error)

LoadDescriptor loads an existing entity from disk, without loading the signer. Note: This takes the path to the descriptor rather than a base directory.

func TestEntity

func TestEntity() (*Entity, signature.Signer, error)

TestEntity returns the built-in test entity and signer.

func (*Entity) Save

func (e *Entity) Save(baseDir string) error

Save saves the JSON serialized entity descriptor.

func (Entity) String

func (e Entity) String() string

String returns a string representation of itself.

func (*Entity) ValidateBasic

func (e *Entity) ValidateBasic(strictVersion bool) error

ValidateBasic performs basic descriptor validity checks.

type SignedEntity

type SignedEntity struct {
	signature.Signed
}

SignedEntity is a signed blob containing a CBOR-serialized Entity.

func SignEntity

func SignEntity(signer signature.Signer, context signature.Context, entity *Entity) (*SignedEntity, error)

SignEntity serializes the Entity and signs the result.

func (*SignedEntity) Open

func (s *SignedEntity) Open(context signature.Context, entity *Entity) error

Open first verifies the blob signature and then unmarshals the blob.

func (SignedEntity) PrettyPrint

func (s SignedEntity) PrettyPrint(ctx context.Context, prefix string, w io.Writer)

PrettyPrint writes a pretty-printed representation of the type to the given writer.

func (SignedEntity) PrettyType

func (s SignedEntity) PrettyType() (interface{}, error)

PrettyType returns a representation of the type that can be used for pretty printing.

Jump to

Keyboard shortcuts

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