Documentation ¶
Index ¶
- Variables
- func ByteArrayToHexString(byteArray []byte) string
- func ByteArrayToUUIDString(byteArray []byte) (UUIDString string, err error)
- func CheckExists(path string) (doesExist bool)
- func ConvertYYYYMMDDtoUnix(input string) int64
- func DBTimeNow() int64
- func ExpandSha256HexstringToPath(fileName string) string
- func GetDateMatchOperator(jsonOperator string) string
- func GetIntMatchOperator(jsonOperator string) string
- func GetNullString(str sql.NullString, defaultStr string) string
- func GetStringMatchOperator(jsonOperator string) string
- func GetStringSubstrMatchOperator(jsonOperator string) string
- func GetSystemIDFromUUID(db *gorp.DbMap, SystemUUIDString string, CustomerUUIDString string) (int64, error)
- func Int64ToUnixTimeString(secondsFromEpoch int64, dateOnly bool) string
- func RecordFileSeenOnSystem(db *gorp.DbMap, fileID int64, systemID int64, timeOfEvent int64, ...) (err error)
- func SendPasswordResetEmail(db *gorp.DbMap, awsSes AwsSes, emailAddress string, baseURL string) (err error)
- func Sha256File(f *os.File) (hash []byte, err error)
- func SymmetricDecrypt(key []byte, input []byte) ([]byte, error)
- func SymmetricEncrypt(key []byte, plaintext []byte) ([]byte, error)
- func UUIDStringToBytes(UUIDString string) ([]byte, error)
- func UploadToS3(awsS3 AwsS3, filepath, filename string, f *os.File) (err error)
- func UploadToS3HashPath(awsS3 AwsS3, filename string, f *os.File) (err error)
- type AwsS3
- type AwsSes
- type PasswordResetEmailData
Constants ¶
This section is empty.
Variables ¶
var KeyForObfuscation = []byte("1sf2324knkfnsfff")
KeyForObfuscation is a crypto key that should only be used for obfuscating data
Functions ¶
func ByteArrayToHexString ¶
ByteArrayToHexString converter
func ByteArrayToUUIDString ¶
ByteArrayToUUIDString Given a byte array converts it to a UUID string
func CheckExists ¶
CheckExists returns true if the file exists, else false
func ConvertYYYYMMDDtoUnix ¶
ConvertYYYYMMDDtoUnix takes a date in the form 2013-01-20 and converts it to unix time for the database
func DBTimeNow ¶
func DBTimeNow() int64
DBTimeNow returns the current unix time as suitable for the database
func ExpandSha256HexstringToPath ¶
ExpandSha256HexstringToPath converts a sha hash like "0a8ce026714e03e72c619307bd598add5f9b639cfd91437cb8d9c847bf9f6894" to "0a/8c/0a8ce026714e03e72c619307bd598add5f9b639cfd91437cb8d9c847bf9f6894" Assumes the string has already been sanity checked to ensure it's a lowercase sha256
func GetDateMatchOperator ¶
GetDateMatchOperator translates an operator from JSON into SQL
func GetIntMatchOperator ¶
GetIntMatchOperator translates an operator from JSON into SQL
func GetNullString ¶
func GetNullString(str sql.NullString, defaultStr string) string
GetNullString returns the string value if valid, else the default value
func GetStringMatchOperator ¶
GetStringMatchOperator translates an operator from JSON into SQL
func GetStringSubstrMatchOperator ¶
GetStringSubstrMatchOperator translates an operator from JSON into SQL
func GetSystemIDFromUUID ¶
func GetSystemIDFromUUID(db *gorp.DbMap, SystemUUIDString string, CustomerUUIDString string) (int64, error)
GetSystemIDFromUUID Returns the System ID given the System UUID and CustomerUUID
func Int64ToUnixTimeString ¶
Int64ToUnixTimeString returns a human readable time and date string
func RecordFileSeenOnSystem ¶
func RecordFileSeenOnSystem(db *gorp.DbMap, fileID int64, systemID int64, timeOfEvent int64, filePath string) (err error)
RecordFileSeenOnSystem helper function to update the FileToSystemMap table
Inserts or updates the table to show this file has been seen on this system and provide some meta data
func SendPasswordResetEmail ¶
func SendPasswordResetEmail(db *gorp.DbMap, awsSes AwsSes, emailAddress string, baseURL string) (err error)
SendPasswordResetEmail checks the email is a known user, and if so, send an email to them to allow them to change their password and be logged in
func Sha256File ¶
Sha256File returns the sha256 hash of a file
func SymmetricDecrypt ¶
SymmetricDecrypt to be used for small symmetric crypto operations
func SymmetricEncrypt ¶
SymmetricEncrypt to be used for small symmetric crypto operations Taken from: http://stackoverflow.com/questions/18817336/golang-encrypting-a-string-with-aes-and-base64
func UUIDStringToBytes ¶
UUIDStringToBytes Given a UUID string, converts it to a byte slice for use with the DB
func UploadToS3 ¶
UploadToS3 uploads the file to the AwsS3 bucket AwsS3 is the credentials filepath is the path inside the S3 bucket to upload to filename is name of the file f is the file handle for the file to upload
Types ¶
type AwsS3 ¶
type AwsS3 struct { BucketName string `json:"bucket_name"` AccessKey string `json:"access_key"` SecretKey string `json:"secret_key"` Region string `json:"region"` }
AwsS3 is used in config.json files
type AwsSes ¶
type AwsSes struct { AccessKey string `json:"access_key"` SecretKey string `json:"secret_key"` RegionURL string `json:"region_url"` }
AwsSes is used in config.json files
type PasswordResetEmailData ¶
PasswordResetEmailData is sent in password reset emails