Documentation ¶
Overview ¶
Package account - types and functions for converting Bitmark accounts (the public key) and their signatures
Index ¶
- Constants
- func Base58EncodedSeedToPhrase(encodedSeed string) ([]string, error)
- func NewBase58EncodedSeedV1(testnet bool) (string, error)
- func NewBase58EncodedSeedV2(testnet bool) (string, error)
- type Account
- type AccountInterface
- type ED25519Account
- func (account *ED25519Account) Bytes() []byte
- func (account *ED25519Account) CheckSignature(message []byte, signature Signature) error
- func (account ED25519Account) IsTesting() bool
- func (account ED25519Account) IsZero() bool
- func (account *ED25519Account) KeyType() int
- func (account ED25519Account) MarshalText() ([]byte, error)
- func (account *ED25519Account) PublicKeyBytes() []byte
- func (account *ED25519Account) String() string
- type ED25519PrivateKey
- func (privateKey *ED25519PrivateKey) Account() *Account
- func (privateKey *ED25519PrivateKey) Bytes() []byte
- func (privateKey *ED25519PrivateKey) IsTesting() bool
- func (privateKey *ED25519PrivateKey) KeyType() int
- func (privateKey ED25519PrivateKey) MarshalText() ([]byte, error)
- func (privateKey *ED25519PrivateKey) PrivateKeyBytes() []byte
- func (privateKey *ED25519PrivateKey) String() string
- type NothingAccount
- func (account *NothingAccount) Bytes() []byte
- func (account *NothingAccount) CheckSignature(message []byte, signature Signature) error
- func (account NothingAccount) IsTesting() bool
- func (account NothingAccount) IsZero() bool
- func (account *NothingAccount) KeyType() int
- func (account NothingAccount) MarshalText() ([]byte, error)
- func (account *NothingAccount) PublicKeyBytes() []byte
- func (account *NothingAccount) String() string
- type NothingPrivateKey
- func (privateKey *NothingPrivateKey) Account() *Account
- func (privateKey *NothingPrivateKey) Bytes() []byte
- func (privateKey *NothingPrivateKey) IsTesting() bool
- func (privateKey *NothingPrivateKey) KeyType() int
- func (privateKey NothingPrivateKey) MarshalText() ([]byte, error)
- func (privateKey *NothingPrivateKey) PrivateKeyBytes() []byte
- func (privateKey *NothingPrivateKey) String() string
- type PrivateKey
- type PrivateKeyInterface
- type Signature
Constants ¶
const ( // list of valid algorithms Nothing = iota // zero keytype **Just for Testing** ED25519 = iota )
enumeration of supported key algorithms
Variables ¶
This section is empty.
Functions ¶
func Base58EncodedSeedToPhrase ¶ added in v0.11.0
Base58EncodedSeedToPhrase - convert base58 seed to recovery phrase
func NewBase58EncodedSeedV1 ¶ added in v0.11.0
NewBase58EncodedSeedV1 - generate base58 seed v1
func NewBase58EncodedSeedV2 ¶ added in v0.11.0
NewBase58EncodedSeedV2 - generate base58 seed v2
Types ¶
type Account ¶
type Account struct {
AccountInterface
}
Account - base type for accounts
func AccountFromBase58 ¶
AccountFromBase58 - this converts a Base58 encoded string and returns an account
one of the specific account types are returned using the base "AccountInterface" interface type to allow individual methods to be called.
func AccountFromBytes ¶
AccountFromBytes - this converts a byte encoded buffer and returns an account
one of the specific account types are returned using the base "AccountInterface" interface type to allow individual methods to be called.
func (*Account) UnmarshalText ¶
UnmarshalText - create account from text string
type AccountInterface ¶
type AccountInterface interface { KeyType() int PublicKeyBytes() []byte CheckSignature(message []byte, signature Signature) error Bytes() []byte String() string MarshalText() ([]byte, error) IsTesting() bool IsZero() bool }
AccountInterface - interface type for account methods
type ED25519Account ¶
ED25519Account - for ed25519 signatures
func (*ED25519Account) Bytes ¶
func (account *ED25519Account) Bytes() []byte
Bytes - byte slice for encoded key
func (*ED25519Account) CheckSignature ¶
func (account *ED25519Account) CheckSignature(message []byte, signature Signature) error
CheckSignature - check the signature of a message
func (ED25519Account) IsTesting ¶ added in v0.4.9
func (account ED25519Account) IsTesting() bool
IsTesting - return whether the public key is in test mode or not
func (ED25519Account) IsZero ¶ added in v0.8.1
func (account ED25519Account) IsZero() bool
IsZero - return whether the public key is all zero or not
func (*ED25519Account) KeyType ¶
func (account *ED25519Account) KeyType() int
KeyType - key type code (see enumeration above)
func (ED25519Account) MarshalText ¶
func (account ED25519Account) MarshalText() ([]byte, error)
MarshalText - convert an account to its Base58 JSON form
func (*ED25519Account) PublicKeyBytes ¶
func (account *ED25519Account) PublicKeyBytes() []byte
PublicKeyBytes - fetch the public key as byte slice
func (*ED25519Account) String ¶
func (account *ED25519Account) String() string
String - base58 encoding of encoded key
type ED25519PrivateKey ¶ added in v0.3.22
ED25519PrivateKey - structure for ed25519 keys
func (*ED25519PrivateKey) Account ¶ added in v0.3.22
func (privateKey *ED25519PrivateKey) Account() *Account
Account - return the corresponding account
func (*ED25519PrivateKey) Bytes ¶ added in v0.3.22
func (privateKey *ED25519PrivateKey) Bytes() []byte
Bytes - byte slice for encoded key
func (*ED25519PrivateKey) IsTesting ¶ added in v0.4.9
func (privateKey *ED25519PrivateKey) IsTesting() bool
IsTesting - return whether the private key is in test mode or not
func (*ED25519PrivateKey) KeyType ¶ added in v0.3.22
func (privateKey *ED25519PrivateKey) KeyType() int
KeyType - key type code (see enumeration in account.go)
func (ED25519PrivateKey) MarshalText ¶ added in v0.3.22
func (privateKey ED25519PrivateKey) MarshalText() ([]byte, error)
MarshalText - convert an privateKey to its Base58 JSON form
func (*ED25519PrivateKey) PrivateKeyBytes ¶ added in v0.3.22
func (privateKey *ED25519PrivateKey) PrivateKeyBytes() []byte
PrivateKeyBytes - fetch the private key as byte slice
func (*ED25519PrivateKey) String ¶ added in v0.3.22
func (privateKey *ED25519PrivateKey) String() string
String - base58 encoding of encoded key
type NothingAccount ¶
NothingAccount - just for debugging
func (*NothingAccount) Bytes ¶
func (account *NothingAccount) Bytes() []byte
Bytes - byte slice for encoded key
func (*NothingAccount) CheckSignature ¶
func (account *NothingAccount) CheckSignature(message []byte, signature Signature) error
CheckSignature - check the signature of a message
func (NothingAccount) IsTesting ¶ added in v0.4.9
func (account NothingAccount) IsTesting() bool
IsTesting - return whether the public key is in test mode or not
func (NothingAccount) IsZero ¶ added in v0.8.1
func (account NothingAccount) IsZero() bool
IsZero - return whether the public key is all zero or not
func (*NothingAccount) KeyType ¶
func (account *NothingAccount) KeyType() int
KeyType - key type code (see enumeration above)
func (NothingAccount) MarshalText ¶
func (account NothingAccount) MarshalText() ([]byte, error)
MarshalText - convert an account to its Base58 JSON form
func (*NothingAccount) PublicKeyBytes ¶
func (account *NothingAccount) PublicKeyBytes() []byte
PublicKeyBytes - fetch the public key as byte slice
func (*NothingAccount) String ¶
func (account *NothingAccount) String() string
String - base58 encoding of encoded key
type NothingPrivateKey ¶ added in v0.3.22
NothingPrivateKey - just for debugging
func (*NothingPrivateKey) Account ¶ added in v0.3.22
func (privateKey *NothingPrivateKey) Account() *Account
Account - return the corresponding account
func (*NothingPrivateKey) Bytes ¶ added in v0.3.22
func (privateKey *NothingPrivateKey) Bytes() []byte
Bytes - byte slice for encoded key
func (*NothingPrivateKey) IsTesting ¶ added in v0.4.9
func (privateKey *NothingPrivateKey) IsTesting() bool
IsTesting - return whether the private key is in test mode or not
func (*NothingPrivateKey) KeyType ¶ added in v0.3.22
func (privateKey *NothingPrivateKey) KeyType() int
KeyType - key type code (see enumeration in account.go)
func (NothingPrivateKey) MarshalText ¶ added in v0.3.22
func (privateKey NothingPrivateKey) MarshalText() ([]byte, error)
MarshalText - convert an privateKey to its Base58 JSON form
func (*NothingPrivateKey) PrivateKeyBytes ¶ added in v0.3.22
func (privateKey *NothingPrivateKey) PrivateKeyBytes() []byte
PrivateKeyBytes - fetch the private key as byte slice
func (*NothingPrivateKey) String ¶ added in v0.3.22
func (privateKey *NothingPrivateKey) String() string
String - base58 encoding of encoded key
type PrivateKey ¶ added in v0.3.22
type PrivateKey struct {
PrivateKeyInterface
}
PrivateKey - base type for PrivateKey
func PrivateKeyFromBase58 ¶ added in v0.3.22
func PrivateKeyFromBase58(privateKeyBase58Encoded string) (*PrivateKey, error)
PrivateKeyFromBase58 - this converts a Base58 encoded string and returns an private key
one of the specific private key types are returned using the base "PrivateKeyInterface" interface type to allow individual methods to be called.
func PrivateKeyFromBase58Seed ¶ added in v0.3.22
func PrivateKeyFromBase58Seed(seedBase58Encoded string) (*PrivateKey, error)
PrivateKeyFromBase58Seed - this converts a Base58 encoded seed string and returns a private key
one of the specific private key types are returned using the base "PrivateKeyInterface" interface type to allow individual methods to be called.
func PrivateKeyFromBytes ¶ added in v0.3.22
func PrivateKeyFromBytes(privateKeyBytes []byte) (*PrivateKey, error)
PrivateKeyFromBytes - this converts a byte encoded buffer and returns an private key
one of the specific private key types are returned using the base "PrivateKeyInterface" interface type to allow individual methods to be called.
func (*PrivateKey) UnmarshalText ¶ added in v0.3.22
func (privateKey *PrivateKey) UnmarshalText(s []byte) error
UnmarshalText - convert string to private key structure
type PrivateKeyInterface ¶ added in v0.3.22
type PrivateKeyInterface interface { Account() *Account KeyType() int PrivateKeyBytes() []byte Bytes() []byte String() string IsTesting() bool MarshalText() ([]byte, error) }
PrivateKeyInterface - interface type for private key methods
type Signature ¶
type Signature []byte
Signature - the type for a signature
func (Signature) GoString ¶
GoString - convert a binary signature to hex string for use by the fmt package (for %#v)
func (Signature) MarshalText ¶
MarshalText - convert signature to text
func (*Signature) Scan ¶
Scan - convert a text representation to a signature for use by the format package scan routines
func (Signature) String ¶
String - convert a binary signature to hex string for use by the fmt package (for %s)
func (*Signature) UnmarshalText ¶
UnmarshalText - convert text into a signature