Back to godoc.org

Package entity

v0.2011.3
Latest Go to latest

The latest major version is .

Published: Oct 16, 2020 | License: Apache-2.0 | Module: github.com/oasisprotocol/oasis-core/go

Overview

Package entity implements common entity routines.

Index

Constants

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

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.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier