Documentation ¶
Index ¶
- Constants
- Variables
- type Base58PublicKey
- type KeyPair
- type PeerID
- type PublicKey
- func (p PublicKey) Hash() string
- func (p PublicKey) MarshalJSON() ([]byte, error)
- func (p PublicKey) String() string
- func (p *PublicKey) ToBase58PublicKey() Base58PublicKey
- func (p PublicKey) TypeByte() byte
- func (p *PublicKey) UnmarshalJSON(b []byte) error
- func (p PublicKey) Value() []byte
- func (p *PublicKey) Verify(data []byte, signature signature.Signature) (ok bool, err error)
- type PublicKeyType
Constants ¶
View Source
const ( RawKeyTypeED25519 byte = iota RawKeyTypeSECP256K1 )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Base58PublicKey ¶
type Base58PublicKey struct { Type PublicKeyType Value string // contains filtered or unexported fields }
func NewBase58PublicKey ¶
func NewBase58PublicKey(raw string) (pk Base58PublicKey, err error)
func (Base58PublicKey) MarshalJSON ¶
func (pk Base58PublicKey) MarshalJSON() ([]byte, error)
func (Base58PublicKey) String ¶
func (pk Base58PublicKey) String() string
func (*Base58PublicKey) ToPublicKey ¶
func (pk *Base58PublicKey) ToPublicKey() PublicKey
Copies Base58PublicKey to PublicKey
func (*Base58PublicKey) UnmarshalJSON ¶
func (pk *Base58PublicKey) UnmarshalJSON(b []byte) (err error)
type KeyPair ¶
type KeyPair struct { Type PublicKeyType PublicKey Base58PublicKey PrivateKey ed25519.PrivateKey }
func CreateKeyPair ¶
func CreateKeyPair(keyType PublicKeyType, pub Base58PublicKey, priv ed25519.PrivateKey) KeyPair
func GenerateKeyPair ¶
func GenerateKeyPair(keyType PublicKeyType, rand io.Reader) (kp KeyPair, err error)
func NewBase58KeyPair ¶
func (*KeyPair) PrivateEncoded ¶
func (*KeyPair) UnmarshalJSON ¶
type PublicKey ¶
type PublicKey [33]byte
TODO: SECP256K1
func PublicKeyFromBytes ¶
func WrapED25519 ¶
func WrapRawKey ¶
func WrapRawKey(keyType PublicKeyType, key []byte) (pk PublicKey, err error)
func (PublicKey) MarshalJSON ¶
func (*PublicKey) ToBase58PublicKey ¶
func (p *PublicKey) ToBase58PublicKey() Base58PublicKey
func (*PublicKey) UnmarshalJSON ¶
type PublicKeyType ¶
type PublicKeyType string
const ( KeyTypeED25519 PublicKeyType = "ed25519" KeyTypeSECP256K1 PublicKeyType = "secp256k1" )
Click to show internal directories.
Click to hide internal directories.