Documentation ¶
Overview ¶
Package identity implements a node's identity, consisting out of id and public key. A LocalIdentity additionally contains the private key and enables signing messages.
Index ¶
Constants ¶
const IDLength = sha256.Size
IDLength defines the length of an ID.
Variables ¶
This section is empty.
Functions ¶
func RegisterIDAlias ¶
RegisterIDAlias registers an alias that will modify the String() output of the ID to show a human readable string instead of the base58 encoded version of itself.
func UnregisterIDAliases ¶
func UnregisterIDAliases()
UnregisterIDAliases removes all aliases registered through the RegisterIDAlias function.
Types ¶
type ID ¶
ID is a unique identifier for each peer.
func DecodeIDBase58 ¶
DecodeIDBase58 decodes a base58 encoded ID.
func IDFromMarshalUtil ¶
func IDFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (id ID, err error)
IDFromMarshalUtil unmarshals an ID using a MarshalUtil (for easier unmarshaling).
func RandomIDInsecure ¶
RandomIDInsecure creates a random id which can for example be used in unit tests. The result is not cryptographically secure.
func (ID) EncodeBase58 ¶
EncodeBase58 returns a full version of the ID as a base58 encoded string.
type Identity ¶
type Identity struct {
// contains filtered or unexported fields
}
LocalIdentity is a node's identity.
func GenerateIdentity ¶
func GenerateIdentity() *Identity
func Parse ¶
func Parse(marshalUtil *marshalutil.MarshalUtil, optionalTargetObject ...*Identity) (result *Identity, err error)
type LocalIdentity ¶
type LocalIdentity struct { *Identity // contains filtered or unexported fields }
LocalIdentity is a local node's identity.
func GenerateLocalIdentity ¶
func GenerateLocalIdentity() *LocalIdentity
func NewLocalIdentity ¶
func NewLocalIdentity(publicKey ed25519.PublicKey, privateKey ed25519.PrivateKey) *LocalIdentity
NewLocalIdentity creates a new LocalIdentity.
func NewLocalIdentityWithIdentity ¶
func NewLocalIdentityWithIdentity(identity *Identity, privateKey ed25519.PrivateKey) *LocalIdentity
NewLocalIdentityWithIdentity creates a new LocalIdentity with a given LocalIdentity.