Documentation ¶
Overview ¶
Package entity implements common entity routines.
Index ¶
- Constants
- type Entity
- func Generate(baseDir string, signerFactory signature.SignerFactory, template *Entity) (*Entity, signature.Signer, error)
- func GenerateWithSigner(baseDir string, signer signature.Signer, template *Entity) (*Entity, error)
- func Load(baseDir string, signerFactory signature.SignerFactory) (*Entity, signature.Signer, error)
- func LoadDescriptor(f string) (*Entity, error)
- func TestEntity() (*Entity, signature.Signer, error)
- type SignedEntity
Constants ¶
const ( // LatestDescriptorVersion is the latest descriptor version that should be // used for all new descriptors. Using earlier versions may be rejected. LatestDescriptorVersion = 2 // MinDescriptorVersion is the minimum descriptor version that is allowed. MinDescriptorVersion = 1 // MaxDescriptorVersion is the maximum descriptor version that is allowed. MaxDescriptorVersion = LatestDescriptorVersion )
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"` }
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 ¶
GenerateWithSigner generates a new entity using an existing signer and serializes it to disk.
func LoadDescriptor ¶
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 ¶
TestEntity returns the built-in test entity and signer.
func (*Entity) UnmarshalCBOR ¶ added in v0.2100.0
UnmarshalCBOR is a custom deserializer that handles both v1 and v2 Entity structures. A v1 structure is converted to v2 seamlessly if the field AllowEntitySignedNodes is false or missing, otherwise an error is returned.
func (*Entity) ValidateBasic ¶
ValidateBasic performs basic descriptor validity checks.
type SignedEntity ¶
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 ¶
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.