Documentation
¶
Overview ¶
Package identity contains the byte-oriented identity rules shared by the Go and TypeScript SDKs.
Index ¶
- Variables
- func Libp2pPublicKey(raw []byte) (libp2pcrypto.PubKey, error)
- func ParsePrivateKeyHex(value string) ([]byte, error)
- func PeerIDFromPublicKey(raw []byte) (peer.ID, error)
- func PrivateKeyBytes(raw []byte) error
- func PublicKeyBytes(raw []byte) ([]byte, error)
- func PublicKeyFromPeerID(id peer.ID) ([]byte, error)
- func PublicKeyFromPrivateKey(raw []byte) ([]byte, error)
- func PublicKeyHex(raw []byte) (string, error)
- func ValidateIdentity(publicKey []byte, id peer.ID, address string) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidPrivateKey = errors.New("invalid secp256k1 private key") ErrInvalidPublicKey = errors.New("invalid compressed secp256k1 public key") ErrInvalidPeerID = errors.New("invalid peer id") ErrPeerIDMismatch = errors.New("peer id does not match public key") ErrInvalidMultiaddr = errors.New("invalid p2p multiaddr") )
Functions ¶
func Libp2pPublicKey ¶
func Libp2pPublicKey(raw []byte) (libp2pcrypto.PubKey, error)
Libp2pPublicKey converts validated bytes into the native libp2p public-key object used by PeerId, Noise and Identify.
func ParsePrivateKeyHex ¶
ParsePrivateKeyHex validates the configuration-only hexadecimal form.
func PeerIDFromPublicKey ¶
PeerIDFromPublicKey uses the native libp2p key serialization and PeerId implementation. No protobuf, multihash or Base58 is assembled here.
func PrivateKeyBytes ¶
PrivateKeyBytes is the only private-key input accepted by the identity package. It is intentionally not returned by any public identity helper.
func PublicKeyBytes ¶
PublicKeyBytes validates a compressed SEC1 public key and returns a copy.
func PublicKeyFromPeerID ¶
PublicKeyFromPeerID extracts the inline secp256k1 public key and checks the resulting identity. Hashed peer IDs deliberately fail closed because their public key cannot be authenticated from the ID alone.
func PublicKeyFromPrivateKey ¶
PublicKeyFromPrivateKey derives the canonical compressed public key. This helper is intended for a trusted local signer and test fixtures.
func PublicKeyHex ¶
PublicKeyHex returns the configuration/logging representation of a public key. Bytes remain the identity truth inside the SDK.
Types ¶
This section is empty.