keypair

package
v0.0.0-...-bec2589 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSON

type JSON struct {
	SignKey bool   `json:"signKey"`
	Key     string `json:"key"`
}

JSON structure

type KeyPair

type KeyPair struct {
	// contains filtered or unexported fields
}

KeyPair structure

func FromPrivKey

func FromPrivKey(b string) (*KeyPair, error)

FromPrivKey restore key pair in base64

func FromPubKey

func FromPubKey(b string) (*KeyPair, error)

FromPubKey restore key pair in base64, this is verify only

func LoadFromFile

func LoadFromFile(fileName string) (*KeyPair, error)

LoadFromFile save key pair to file

func New

func New() (*KeyPair, error)

New define new key pair

func (*KeyPair) GetID

func (k *KeyPair) GetID() (peer.ID, error)

GetID of this key pair

func (*KeyPair) GetPrivateKey

func (k *KeyPair) GetPrivateKey() p2pCrypto.PrivKey

GetPrivateKey of this key pair

func (*KeyPair) GetPublicKey

func (k *KeyPair) GetPublicKey() p2pCrypto.PubKey

GetPublicKey of this key pair

func (*KeyPair) SaveToFile

func (k *KeyPair) SaveToFile(fileName string) (bool, error)

SaveToFile save key pair to file

func (*KeyPair) Sign

func (k *KeyPair) Sign(data []byte) (signature []byte, err error)

Sign data

func (*KeyPair) Verify

func (k *KeyPair) Verify(data []byte, signature []byte) (bool, error)

Verify data

Jump to

Keyboard shortcuts

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