util

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnterPassphrase added in v0.5.0

func EnterPassphrase() (string, error)

func ErrEqualCode added in v0.4.0

func ErrEqualCode(err error, code codes.Code) bool

ErrEqualCode returns true if the given error has the specified code (gRPC status code).

func FindAndParseConfigFile

func FindAndParseConfigFile(configFile string, out interface{}) error

FindAndParseConfigFile locates the config file and parses it, storing the result in out.

func GetConfigFileLocation

func GetConfigFileLocation(location string) (string, error)

func GetConfigFromArgs added in v0.5.0

func GetConfigFromArgs(args []string) string

GetConfigFromArgs returns the value of --config flag from the arguments.

func GetDefaultKeyLocation

func GetDefaultKeyLocation() (string, error)

func Hash160

func Hash160(buf []byte) []byte

Hash160 calculates the hash ripemd160(sha256(b)).

func Hash256

func Hash256(data []byte) []byte

Hash256 does two rounds of SHA256 hashing.

func IsKeyEncrypted added in v0.5.0

func IsKeyEncrypted(filePath string) (bool, error)

func NowMs

func NowMs() int64

NowMs returns current time as milliseconds from epoch.

func ReadPassphase added in v0.5.0

func ReadPassphase() (string, error)

func SerializedCompressedToAddress added in v0.4.0

func SerializedCompressedToAddress(key []byte) string

SerializedCompressedToAddress is a convenience function which converts serialized compressed representation of the private key to its address (which is shorter). If the key is invalid, the return string will contain an error message.

func StatusCodeFromError added in v0.4.0

func StatusCodeFromError(err error) codes.Code

func TimeFromMs

func TimeFromMs(ts int64) time.Time

func ValidateName

func ValidateName(name string) bool

ValidateName returns true if the name is valid.

Types

This section is empty.

Jump to

Keyboard shortcuts

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