Documentation ¶
Index ¶
- Variables
- func AddressConvert(address string) (interface{}, error)
- func DeleteOldFile(fileDirt string) error
- func FileDirectoryInit(filedirt string)
- func GetFileByKey(fileDirt, key string) (string, error)
- func GetFileInDirt(fileDirt string) (string, error)
- func GetRunningTimePath() string
- func IntValueConvert(value string) (string, error)
- func IsInRange(value string, num uint64) bool
- func IsMatch(param, paramName string) bool
- func IsRoleMatch(role string) bool
- func IsRoleMatchV2(role string) bool
- func IsUrl(url string) bool
- func IsValidRoles(roles string) bool
- func LogInit()
- func ParseFileToBytes(filePath string) ([]byte, error)
- func PromptPassphrase(confirmation bool) string
- func UintValueConvert(value string) (string, error)
- func WriteFile(fileBytes []byte, filePath string) error
- type Keyfile
Constants ¶
This section is empty.
Variables ¶
var ( ErrParamTypeFormat = "incorrect param type: %s, index: %d.\n" ErrReadFileFormat = "read %s file error: %s\n" ErrOpenFileFormat = "open %s file error: %s\n" ErrFindFileFormat = "find file error: %s\n" ErrWriteFileFormat = "write file error: %s" //---------------------------------------------------------------- ErrSendTransacionFormat = "send Transaction through http error: %s" ErrPackFunctionFormat = "packet functions err: %s\n" ErrPackDataFormat = "packet data err: %s\n" ErrParamCheckFormat = "the input <%s> cannot be empty.\n" ErrParamNumCheckFormat = "param check error, required %d inputs, recieved %d.\n" //ErrParamValidFormat = "%s param is not valid: %s\n" ErrParamInValidSyntax = "invalid %s syntax.\n" ErrParamParseFormat = "parse %s param error: %s\n" ErrParseFileFormat = "parse %s file error: %s" ErrUnmarshalBytesFormat = "unmarshal %s bytes error: %s" ErrInputNullFormat = "the %s cannot be empty.\n" ErrRlpEncodeFormat = "rlp encode error: %s" ErrRlpDecodeFormat = "%s rlp decode error: %s" ErrGetFromChainFormat = "get %s from chain error: %s" ErrHttpSendFormat = "send http post error:\n%s" ErrHttpNoResponseFormat = "no response from node: %s" ErrHttpResponseStatusFormat = "http response status: %s" ErrRpcExecuationFormat = "execute %s rpc call error: %s\n" ErrTODO = "something wrong, see more details in %s" PanicUnexpSituation = "unexpected situation in function %s\n" )
var (
ErrFileNull = errors.New("file path cannot be empty")
)
var ErrNullPassphrase = errors.New("passphrase is null")
var LogDeg *log.Logger
var LogErr *log.Logger
var Logger *log.Logger
Functions ¶
func AddressConvert ¶
AddressConvert converts hex string format address to byte format address when the input is null, the output address is [0 0 ... 0]
func DeleteOldFile ¶
func FileDirectoryInit ¶
func FileDirectoryInit(filedirt string)
FileDirectoryInit creates a new folder if the file directory is not exist
func GetFileByKey ¶
GetFileByKey search the file in the file directory by the search keywords provided if found, return the file name
func GetFileInDirt ¶
GetFileInDirt get the first file at the file directory
func GetRunningTimePath ¶
func GetRunningTimePath() string
get the path where the executable is executed
func IsRoleMatchV2 ¶
func IsValidRoles ¶
isValidRoles wraps isRoleMatch, it extracts the roles in the array and validates the roles
func ParseFileToBytes ¶
ParseFileToBytes read the file and return the file bytes
func PromptPassphrase ¶
todo: change prompt to --password flag? promptPassphrase prompt the hint in the terminal to let user to input the password
func UintValueConvert ¶
Types ¶
type Keyfile ¶
type Keyfile struct { Address string `json:"address"` Json []byte Passphrase string // contains filtered or unexported fields }
func NewKeyfile ¶
func (*Keyfile) GetPrivateKey ¶
func (k *Keyfile) GetPrivateKey() *ecdsa.PrivateKey
func (*Keyfile) ParsePrivateKey ¶
GetPrivateKey gets the private key by decrypting the keystore file