p2pkey

package
v0.0.0-...-cce48a0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EncryptedP2PKeyExport

type EncryptedP2PKeyExport struct {
	KeyType   string               `json:"keyType"`
	PublicKey PublicKeyBytes       `json:"publicKey"`
	PeerID    PeerID               `json:"peerID"`
	Crypto    *keystore.CryptoJSON `json:"crypto,omitempty"`
}

EncryptedP2PKeyExport represents the structure of P2P keys exported and imported to/from the disk

func (EncryptedP2PKeyExport) DecryptPrivateKey

func (export EncryptedP2PKeyExport) DecryptPrivateKey(passphrase string) (k *Key, err error)

DecryptPrivateKey returns the PrivateKey in export, decrypted via passphrase, or an error

type Key

type Key struct {
	cryptop2p.PrivKey
}

Key represents a libp2p private key

func Base64ToPrivKey

func Base64ToPrivKey(b64 string) Key

func CreateKey

func CreateKey() (Key, error)

CreateKey makes a new libp2p keypair from a crytographically secure entropy source

func FromEncryptedJSON

func FromEncryptedJSON(keyJSON []byte, password string) (Key, error)

func (Key) GetPeerID

func (k Key) GetPeerID() (PeerID, error)

func (Key) MustGetPeerID

func (k Key) MustGetPeerID() PeerID

func (Key) PrivKeyToBase64

func (k Key) PrivKeyToBase64() string

func (Key) ToEncryptedExport

func (k Key) ToEncryptedExport(passphrase string, scryptParams utils.ScryptParams) (export []byte, err error)

type PeerID

type PeerID peer.ID

func (PeerID) MarshalJSON

func (p PeerID) MarshalJSON() ([]byte, error)

func (PeerID) Raw

func (p PeerID) Raw() string

func (PeerID) String

func (p PeerID) String() string

func (*PeerID) UnmarshalJSON

func (p *PeerID) UnmarshalJSON(input []byte) error

func (*PeerID) UnmarshalText

func (p *PeerID) UnmarshalText(bs []byte) error

type PublicKeyBytes

type PublicKeyBytes []byte

PublicKeyBytes is generated using cryptop2p.PubKey.Raw()

func (PublicKeyBytes) MarshalJSON

func (pkb PublicKeyBytes) MarshalJSON() ([]byte, error)

func (PublicKeyBytes) String

func (pkb PublicKeyBytes) String() string

func (*PublicKeyBytes) UnmarshalJSON

func (pkb *PublicKeyBytes) UnmarshalJSON(input []byte) error

type Raw

type Raw []byte

func (Raw) Key

func (r Raw) Key() Key

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL