Documentation ¶
Index ¶
- Constants
- func DecodeMoneroBase58(data string) (result []byte)
- func EncodeMoneroBase58(data ...[]byte) (result string)
- func ValidateAddress(addr string) error
- type Address
- type PrivateKeyInfo
- type PrivateKeyPair
- func (kp *PrivateKeyPair) Address(env common.Environment) Address
- func (kp *PrivateKeyPair) AddressBytes(env common.Environment) []byte
- func (kp *PrivateKeyPair) Info(env common.Environment) *PrivateKeyInfo
- func (kp *PrivateKeyPair) PublicKeyPair() *PublicKeyPair
- func (kp *PrivateKeyPair) SpendKey() *PrivateSpendKey
- func (kp *PrivateKeyPair) SpendKeyBytes() []byte
- func (kp *PrivateKeyPair) ViewKey() *PrivateViewKey
- type PrivateSpendKey
- func (k *PrivateSpendKey) AsPrivateKeyPair() (*PrivateKeyPair, error)
- func (k *PrivateSpendKey) Bytes() []byte
- func (k *PrivateSpendKey) Hash() [32]byte
- func (k *PrivateSpendKey) HashString() string
- func (k *PrivateSpendKey) Hex() string
- func (k *PrivateSpendKey) Public() *PublicKey
- func (k *PrivateSpendKey) Sign(msg []byte) (*Signature, error)
- func (k *PrivateSpendKey) View() (*PrivateViewKey, error)
- type PrivateViewKey
- type PublicKey
- type PublicKeyPair
- type Signature
Constants ¶
const (
// AddressLength is the length of a Monero address
AddressLength = 1 + 32 + 32 + 4
)
const BASE58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
BASE58 ...
Variables ¶
This section is empty.
Functions ¶
func DecodeMoneroBase58 ¶
DecodeMoneroBase58 decodes base-58 encoded data into a byte slice
func EncodeMoneroBase58 ¶
EncodeMoneroBase58 encodes byte data using base-58
func ValidateAddress ¶
ValidateAddress checks if the given address is valid TODO: also check chain prefix
Types ¶
type PrivateKeyInfo ¶
type PrivateKeyInfo struct { PrivateSpendKey string PrivateViewKey string Address string Environment string }
PrivateKeyInfo ...
type PrivateKeyPair ¶
type PrivateKeyPair struct {
// contains filtered or unexported fields
}
PrivateKeyPair represents a monero private spend and view key.
func GenerateKeys ¶
func GenerateKeys() (*PrivateKeyPair, error)
GenerateKeys generates a private spend key and view key
func NewPrivateKeyPair ¶
func NewPrivateKeyPair(sk *PrivateSpendKey, vk *PrivateViewKey) *PrivateKeyPair
NewPrivateKeyPair returns a new PrivateKeyPair from the given PrivateSpendKey and PrivateViewKey. It does not validate if the view key corresponds to the spend key.
func NewPrivateKeyPairFromBytes ¶
func NewPrivateKeyPairFromBytes(skBytes, vkBytes []byte) (*PrivateKeyPair, error)
NewPrivateKeyPairFromBytes returns a new PrivateKeyPair given the canonical byte representation of a private spend and view key.
func (*PrivateKeyPair) Address ¶
func (kp *PrivateKeyPair) Address(env common.Environment) Address
Address returns the base58-encoded address for a PrivateKeyPair with the given environment (ie. mainnet or stagenet)
func (*PrivateKeyPair) AddressBytes ¶
func (kp *PrivateKeyPair) AddressBytes(env common.Environment) []byte
AddressBytes returns the address as bytes for a PrivateKeyPair with the given environment (ie. mainnet or stagenet)
func (*PrivateKeyPair) Info ¶
func (kp *PrivateKeyPair) Info(env common.Environment) *PrivateKeyInfo
Info return the private key pair as PrivateKeyInfo, providing its PrivateSpendKey, PrivateViewKey, Address, and Environment. This is intended to be written to a file, which someone can use to regenerate the wallet.
func (*PrivateKeyPair) PublicKeyPair ¶
func (kp *PrivateKeyPair) PublicKeyPair() *PublicKeyPair
PublicKeyPair returns the PublicKeyPair corresponding to the PrivateKeyPair
func (*PrivateKeyPair) SpendKey ¶
func (kp *PrivateKeyPair) SpendKey() *PrivateSpendKey
SpendKey returns the keypair's spend key
func (*PrivateKeyPair) SpendKeyBytes ¶
func (kp *PrivateKeyPair) SpendKeyBytes() []byte
SpendKeyBytes returns the canoncail byte encoding of the private spend key.
func (*PrivateKeyPair) ViewKey ¶
func (kp *PrivateKeyPair) ViewKey() *PrivateViewKey
ViewKey returns the keypair's view key
type PrivateSpendKey ¶
type PrivateSpendKey struct {
// contains filtered or unexported fields
}
PrivateSpendKey represents a monero private spend key
func NewPrivateSpendKey ¶
func NewPrivateSpendKey(b []byte) (*PrivateSpendKey, error)
NewPrivateSpendKey returns a new PrivateSpendKey from the given canonically-encoded scalar.
func SumPrivateSpendKeys ¶
func SumPrivateSpendKeys(a, b *PrivateSpendKey) *PrivateSpendKey
SumPrivateSpendKeys sums two private spend keys (scalars)
func (*PrivateSpendKey) AsPrivateKeyPair ¶
func (k *PrivateSpendKey) AsPrivateKeyPair() (*PrivateKeyPair, error)
AsPrivateKeyPair returns the PrivateSpendKey as a PrivateKeyPair.
func (*PrivateSpendKey) Bytes ¶
func (k *PrivateSpendKey) Bytes() []byte
Bytes returns the PrivateSpendKey as canonical bytes
func (*PrivateSpendKey) Hash ¶
func (k *PrivateSpendKey) Hash() [32]byte
Hash returns the keccak256 of the secret key bytes
func (*PrivateSpendKey) HashString ¶
func (k *PrivateSpendKey) HashString() string
HashString returns the keccak256 of the secret key bytes as a hex encoded string
func (*PrivateSpendKey) Hex ¶
func (k *PrivateSpendKey) Hex() string
Hex returns the hex-encoded canonical byte representation of the PrivateSpendKey.
func (*PrivateSpendKey) Public ¶
func (k *PrivateSpendKey) Public() *PublicKey
Public returns the public key corresponding to the private key.
func (*PrivateSpendKey) Sign ¶
func (k *PrivateSpendKey) Sign(msg []byte) (*Signature, error)
Sign signs the given message with the private key. The private key must have been created with GenerateKeys().
func (*PrivateSpendKey) View ¶
func (k *PrivateSpendKey) View() (*PrivateViewKey, error)
View returns the private view key corresponding to the PrivateSpendKey.
type PrivateViewKey ¶
type PrivateViewKey struct {
// contains filtered or unexported fields
}
PrivateViewKey represents a monero private view key.
func NewPrivateViewKeyFromHex ¶
func NewPrivateViewKeyFromHex(vkHex string) (*PrivateViewKey, error)
NewPrivateViewKeyFromHex returns a new PrivateViewKey from the given canonically- and hex-encoded scalar.
func SumPrivateViewKeys ¶
func SumPrivateViewKeys(a, b *PrivateViewKey) *PrivateViewKey
SumPrivateViewKeys sums two private view keys (scalars)
func (*PrivateViewKey) Hex ¶
func (k *PrivateViewKey) Hex() string
Hex returns the hex-encoded canonical byte representation of the PrivateViewKey.
func (*PrivateViewKey) Public ¶
func (k *PrivateViewKey) Public() *PublicKey
Public returns the PublicKey corresponding to this PrivateViewKey.
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey represents a monero public spend or view key.
func NewPublicKeyFromHex ¶
NewPublicKeyFromHex returns a new PublicKey from the given canonically- and hex-encoded point.
func SumPublicKeys ¶
SumPublicKeys sums two public keys (points)
type PublicKeyPair ¶
type PublicKeyPair struct {
// contains filtered or unexported fields
}
PublicKeyPair contains a public SpendKey and ViewKey
func NewPublicKeyPair ¶
func NewPublicKeyPair(sk, vk *PublicKey) *PublicKeyPair
NewPublicKeyPair returns a new PublicKeyPair from the given public spend and view keys.
func NewPublicKeyPairFromHex ¶
func NewPublicKeyPairFromHex(skHex, vkHex string) (*PublicKeyPair, error)
NewPublicKeyPairFromHex returns a new PublicKeyPair from the given canonically- and hex-encoded points.
func SumSpendAndViewKeys ¶
func SumSpendAndViewKeys(a, b *PublicKeyPair) *PublicKeyPair
SumSpendAndViewKeys sums two PublicKeyPairs, returning another PublicKeyPair.
func (*PublicKeyPair) Address ¶
func (kp *PublicKeyPair) Address(env common.Environment) Address
Address returns the base58-encoded address for a PublicKeyPair with the given environment (ie. mainnet or stagenet)
func (*PublicKeyPair) AddressBytes ¶
func (kp *PublicKeyPair) AddressBytes(env common.Environment) []byte
AddressBytes returns the address as bytes for a PublicKeyPair with the given environment (ie. mainnet or stagenet)
func (*PublicKeyPair) SpendKey ¶
func (kp *PublicKeyPair) SpendKey() *PublicKey
SpendKey returns the keypair's spend key.
func (*PublicKeyPair) ViewKey ¶
func (kp *PublicKeyPair) ViewKey() *PublicKey
ViewKey returns the keypair's view key.
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
Signature represents an ed25519 signature
func NewSignatureFromHex ¶
NewSignatureFromHex returns a new Signature from the given hex-encoded string. The string must be 64 bytes.