Documentation
¶
Overview ¶
Package identity manages libp2p node identity keys on disk.
Index ¶
Constants ¶
View Source
const KeyFilename = "p2p.key"
Variables ¶
This section is empty.
Functions ¶
func EnsureIdentity ¶
EnsureIdentity generates an identity key file in given directory.
func GenIdentityEd25519 ¶
GenIdentityEd25519 creates a new random Ed25519 private key.
func GenerateIdentitySecp256k1 ¶
GenerateIdentitySecp256k1 creates a new random Secp256k1 private key.
Types ¶
type IdentityInfo ¶
type IdentityInfo struct {
Key []byte
ID peer.ID // this is needed only to simplify integration with some testing tools
}
IdentityInfo contains the serialized private key and peer ID. The ID field is included to simplify integration with testing tools.
func ExtractIdentityFromDir ¶
func ExtractIdentityFromDir(dir string) (*IdentityInfo, error)
ExtractIdentityFromDir loads an existing identity from the specified directory. Returns an error if the identity file does not exist or cannot be read/parsed.
Click to show internal directories.
Click to hide internal directories.