Documentation
¶
Overview ¶
Package identity provides agent identity management and certificate generation utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LocalHostname ¶
LocalHostname returns the hostname for this host. If override is provided, that value is used. Otherwise, auto-detects the hostname using os.Hostname(). Returns empty string if detection fails.
Types ¶
type Identity ¶
type Identity struct {
Nonce []byte
CACert *x509.Certificate
PublicKey *ed25519.PublicKey
PrivateKey *ed25519.PrivateKey
ClientCert *x509.Certificate
// contains filtered or unexported fields
}
Identity represents the identity material stored on disk for the agent.
func Load ¶
Load loads identity material from dir for use as a client. Requires ca.crt, identity.crt, and identity.key to exist. Returns an error if any required file is missing.
func LoadOrCreate ¶
LoadOrCreate loads identity material from dir. Missing files are left nil, errors reading existing files are returned. If the identity keypair is missing it is generated automatically.
func (*Identity) BuildTLSConfig ¶
BuildTLSConfig creates a TLS config using the identity's certificate and key. Requires CACert, ClientCert, and PrivateKey to be set.
func (*Identity) DeleteNonce ¶
DeleteNonce removes the nonce file from disk.
func (*Identity) GenerateKeypair ¶
GenerateKeypair creates a new identity keypair, stores it on disk, and updates the struct.
func (*Identity) StoreClientCertificate ¶
StoreClientCertificate saves the provided certificate and updates the in-memory copy.