Documentation ¶
Index ¶
- Constants
- type Nonce
- type PrivateKey
- func (key PrivateKey) Decrypt(data []byte) (PublicKey, []byte, error)
- func (key PrivateKey) Encrypt(peersPublicKey PublicKey, data []byte) []byte
- func (key PrivateKey) MarshalYAML() (interface{}, error)
- func (key PrivateKey) PublicKey() PublicKey
- func (key PrivateKey) String() string
- func (key *PrivateKey) UnmarshalYAML(unmarshal func(interface{}) error) error
- type PublicKey
Constants ¶
View Source
const ( // KeySize is the size of an encryption key in bytes KeySize = 32 // NonceSize is the size of a nonce in bytes NonceSize = 24 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PrivateKey ¶
PrivateKey is a private encryption key
func NewPrivateKey ¶
func NewPrivateKey(str string) (key PrivateKey, err error)
NewKey creates a new key from a base58 string.
func (PrivateKey) Decrypt ¶
func (key PrivateKey) Decrypt(data []byte) (PublicKey, []byte, error)
Decrypt decrypts data that was encrypted via a private key. The peer's public key is sent along with the data.
func (PrivateKey) Encrypt ¶
func (key PrivateKey) Encrypt(peersPublicKey PublicKey, data []byte) []byte
Encrypt encrypts data using the private key intended for the peer public key.
func (PrivateKey) MarshalYAML ¶
func (key PrivateKey) MarshalYAML() (interface{}, error)
MarshalYAML marshales the key for use in a YAML file.
func (PrivateKey) PublicKey ¶
func (key PrivateKey) PublicKey() PublicKey
func (PrivateKey) String ¶
func (key PrivateKey) String() string
String returns the base58 encoded representation of the private key.
func (*PrivateKey) UnmarshalYAML ¶
func (key *PrivateKey) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshales the key from a YAML file.
type PublicKey ¶
PublicKey is a public encryption key
func NewPublicKey ¶
NewKey creates a new key from a base58 string.
func (PublicKey) MarshalYAML ¶
MarshalYAML marshals the public key for a YAML file.
func (*PublicKey) UnmarshalYAML ¶
UnmarshalYAML unmarshals the public key from a YAML file.
Click to show internal directories.
Click to hide internal directories.