p2pkey

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: MIT Imports: 14 Imported by: 0

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 `gorm:"primary_key"`
	PeerID           models.PeerID
	PubKey           PublicKeyBytes `gorm:"type:bytea"`
	EncryptedPrivKey []byte
	CreatedAt        time.Time
	UpdatedAt        time.Time
	DeletedAt        gorm.DeletedAt
}

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

func (EncryptedP2PKey) TableName

func (EncryptedP2PKey) TableName() string

type EncryptedP2PKeyExport

type EncryptedP2PKeyExport struct {
	PublicKey PublicKeyBytes      `json:"publicKey"`
	PeerID    models.PeerID       `json:"peerID"`
	Crypto    keystore.CryptoJSON `json:"crypto"`
}

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

func (EncryptedP2PKeyExport) DecryptPrivateKey

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

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

type Key

type Key struct {
	cryptop2p.PrivKey
}

Key represents a libp2p private key

func CreateKey

func CreateKey() (Key, error)

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

func (Key) GetPeerID

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

func (Key) MustGetPeerID

func (k Key) MustGetPeerID() models.PeerID

func (Key) ToEncryptedExport

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

func (Key) ToEncryptedP2PKey

func (k Key) ToEncryptedP2PKey(auth string, scryptParams utils.ScryptParams) (s EncryptedP2PKey, err error)

type PublicKeyBytes

type PublicKeyBytes []byte

PublicKeyBytes is generated using cryptop2p.PubKey.Raw()

func (PublicKeyBytes) GormDBDataType

func (PublicKeyBytes) GormDBDataType(db *gorm.DB, field *schema.Field) string

GormDBDataType gorm db data type

func (PublicKeyBytes) GormDataType

func (PublicKeyBytes) GormDataType() string

GormDataType gorm common data type

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)

Jump to

Keyboard shortcuts

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