Documentation ¶
Index ¶
- Constants
- func ArgonCheckPassword(pw string, hash string) bool
- func ArgonHashPassword(pw string) (string, error)
- func BytesToHex(data []byte) string
- func DeleteFile(file string) error
- func EdSign(data []byte, privateKey []byte, publicKey []byte) ([]byte, error)
- func EdVerify(data []byte, signature []byte, publicKey []byte) error
- func Get(url string) ([]byte, error)
- func Hash(data []byte) []byte
- func HashMatch(data []byte, hash []byte) bool
- func HexToBytes(data string) ([]byte, error)
- func MarshalNeat(payload interface{}) ([]byte, error)
- func MarshalNeatMatch(data []byte, prototype interface{}) error
- func MkDir(dir string) error
- func NewEdKeyPair(seed []byte) ([]byte, []byte, error)
- func Now() uint64
- func Out(a ...interface{})
- func Post(url string, requestBody []byte) ([]byte, error)
- func Prompt(prompt string) string
- func RandomBytes(len int) ([]byte, error)
- func ReadFile(file string) ([]byte, error)
- func Serve(addr string, getter func([]string) (int, []byte), ...) (string, error)
- func SilentPrompt(prompt string) string
- func Sleep(n int)
- func SplitURL(url string) []string
- func StringMarshalNeat(payload interface{}) (string, error)
- func StructGet(url string, responsePayload interface{}) error
- func StructPost(url string, requestPayload interface{}, responsePayload interface{}) error
- func Success(bold string, a ...interface{})
- func Warning(bold string, a ...interface{})
- func WriteFile(file string, data []byte) error
- type Database
- func (db *Database) AddItemAt(tableName string, primaryKey uint64, data string) error
- func (db *Database) CheckOrder(tableName string) (uint64, error)
- func (db *Database) ClearTable(tableName string) error
- func (db *Database) Close()
- func (db *Database) DeleteItemAt(tableName string, primaryKey uint64) error
- func (db *Database) GetItemAt(tableName string, primaryKey uint64) (string, error)
- func (db *Database) GetKeys(tableName string) ([]uint64, error)
- func (db *Database) MakeTable(tableName string) error
Constants ¶
const ( PublicKeySize = 32 PrivateKeySize = 64 SeedSize = 32 )
Variables ¶
This section is empty.
Functions ¶
func ArgonCheckPassword ¶
func ArgonHashPassword ¶
func BytesToHex ¶
BytesToHex Converts byte slice to string representation (hexadecimal).
func DeleteFile ¶
DeleteFile deletes a file (or empty directory) at a location
func HashMatch ¶
HashMatch checks if the SHA3-512 of a given byte slice matches a given 64 byte array
func HexToBytes ¶
HexToBytes Converts string to byte slice if it is valid hexadecimal. Slice length is zero on fail.
func MarshalNeat ¶
func MarshalNeatMatch ¶
func Out ¶
func Out(a ...interface{})
Prints grey / "Faint white". Spaces, not newlines, between items passed.
func RandomBytes ¶
RandomBytes returns byte slice of length n filled with random data
func SilentPrompt ¶
Displays a prompt to the interface and returns what the user enters. Hides user input from the console. Use for password entry for example.
func StringMarshalNeat ¶
func StructPost ¶
func Success ¶
func Success(bold string, a ...interface{})
Prints green. The first item passed is bolded. Each item gets a new line.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func SQLiteOpen ¶
func (*Database) CheckOrder ¶
If your database is expected to have items at primary keys [1,2,3,4...] then this function will return the next open key following that order. Error is nil only if all (non-zero, non-negative) keys were in order with no gaps between them. IGNORES NEGATIVE AND ZERO KEYS.