p2pkey

package
v2.2.0-mercury-20230602 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: MIT Imports: 17 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EncryptedP2PKey

type EncryptedP2PKey struct {
	ID               int32
	PeerID           PeerID
	PubKey           PublicKeyBytes
	EncryptedPrivKey []byte
	CreatedAt        time.Time
	UpdatedAt        time.Time
	DeletedAt        *time.Time
}

func (EncryptedP2PKey) Decrypt

func (ep2pk EncryptedP2PKey) Decrypt(auth string) (k Key, err error)

Decrypt returns the PrivateKey in e, decrypted via auth, or an error

func (*EncryptedP2PKey) SetID

func (ep2pk *EncryptedP2PKey) SetID(value string) error

type EncryptedP2PKeyExport

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

func (EncryptedP2PKeyExport) GetCrypto

type Key

type Key struct {
	cryptop2p.PrivKey
}

Key represents a libp2p private key

func (Key) GetPeerID

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

func (Key) PeerID

func (k Key) PeerID() PeerID

func (Key) ToV2

func (k Key) ToV2() KeyV2

type KeyV2

type KeyV2 struct {
	cryptop2p.PrivKey
	// contains filtered or unexported fields
}

func FromEncryptedJSON

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

func MustNewV2XXXTestingOnly

func MustNewV2XXXTestingOnly(k *big.Int) KeyV2

func NewV2

func NewV2() (KeyV2, error)

func (KeyV2) GoString

func (key KeyV2) GoString() string

func (KeyV2) ID

func (key KeyV2) ID() string

func (KeyV2) PeerID

func (key KeyV2) PeerID() PeerID

func (KeyV2) PublicKeyHex

func (key KeyV2) PublicKeyHex() string

func (KeyV2) Raw

func (key KeyV2) Raw() Raw

func (KeyV2) String

func (key KeyV2) String() string

func (KeyV2) ToEncryptedJSON

func (key KeyV2) ToEncryptedJSON(password string, scryptParams utils.ScryptParams) (export []byte, err error)

type PeerID

type PeerID peer.ID

func MakePeerID

func MakePeerID(s string) (PeerID, error)

func (PeerID) MarshalJSON

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

func (*PeerID) MarshalText

func (p *PeerID) MarshalText() ([]byte, error)

func (PeerID) Raw

func (p PeerID) Raw() string

func (*PeerID) Scan

func (p *PeerID) Scan(value interface{}) error

func (PeerID) String

func (p PeerID) String() string

func (*PeerID) UnmarshalJSON

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

func (*PeerID) UnmarshalString

func (p *PeerID) UnmarshalString(s string) error

func (*PeerID) UnmarshalText

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

func (PeerID) Value

func (p PeerID) Value() (driver.Value, error)

type PublicKeyBytes

type PublicKeyBytes []byte

PublicKeyBytes is generated using cryptop2p.PubKey.Raw()

func (PublicKeyBytes) MarshalJSON

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

func (*PublicKeyBytes) Scan

func (pkb *PublicKeyBytes) Scan(value interface{}) error

func (PublicKeyBytes) String

func (pkb PublicKeyBytes) String() string

func (*PublicKeyBytes) UnmarshalJSON

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

func (PublicKeyBytes) Value

func (pkb PublicKeyBytes) Value() (driver.Value, error)

type Raw

type Raw []byte

func (Raw) GoString

func (raw Raw) GoString() string

func (Raw) Key

func (raw Raw) Key() KeyV2

func (Raw) String

func (raw Raw) String() string

Jump to

Keyboard shortcuts

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