Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Identity ¶
type Identity struct {
// TLS is the staking certificate and its private key, presented on every
// dial and every accept.
TLS tls.Certificate
// Cert is the parsed leaf, kept because the node id is derived from its
// exact DER and re-parsing per use would be a second chance to disagree.
Cert *x509.Certificate
// NodeID is RIPEMD160(SHA256(cert DER)) — the derivation in luxfi/ids, not a
// local copy of it.
NodeID ids.NodeID
// Signer holds the BLS staking key. Nil when the node has no signing key,
// which makes it a follower: it reads the network and never votes.
Signer *localsigner.LocalSigner
}
Identity is who this node is on the network: one staking certificate, which names it, and one BLS key, which is how it votes.
The two are not interchangeable and neither substitutes for the other. The certificate is what a peer authenticates the TLS session against and what the node id is derived from; the BLS key is what a validator set holds and what a finality certificate is assembled out of. A node whose certificate is known and whose BLS key is not is a peer that cannot vote, which is a real and intended state — so they are loaded together and kept apart.
func LoadIdentity ¶
LoadIdentity reads a staking directory.
The certificate and its key are required — without them the node has no name and cannot open a session. The BLS key is optional for the reason above.
func (*Identity) PublicKey ¶
PublicKey returns the BLS public key this node votes under, or nil when it holds no signing key.