Documentation ¶
Index ¶
- Constants
- Variables
- func FormatTime(t time.Time) string
- func GetCurrentTime() string
- func GetCurrentTimestamp() int64
- func GetMapValOrNil(m map[string]interface{}, key string) interface{}
- func GetUserHomeDir() string
- func IsSupportedEncryptionAlgorithm(algorithm string) bool
- func MarshalJSON(v interface{}) ([]byte, error)
- func StringToBool(s string) bool
- func StringToInt(s string) int
- func StringToInt64(s string) int64
- func StringToTime(s string) time.Time
- func TimestampToTime(timestamp int64) time.Time
- func UnmarshalJSON(data []byte, v interface{}) error
- type EncryptionKeyAction
- type WindowAction
- type WindowAspect
- type WindowMode
Constants ¶
const ( // WIDGET_NOTES_REFRESH_INTERVAL_MILLIS is the default refresh interval for the notes widget WIDGET_NOTES_REFRESH_INTERVAL_MILLIS = 2000 * time.Microsecond // Length of the encryption key generated by the application at first run ENCRYPTION_KEY_LENGTH = 256 // STEF delete this // DEFAULT_ENCRYPTION_ALGORITHM = "aes-256-cbc" // CONFIG_ENCRYPTION_KEY = "encryption_key" // CONFIG_ENCRYPTION_ALGORITHM = "encryption_algorithm" CONFIG_CUR_ENCRYPTION_KEY_NAME = "cur_encryption_key_name" CONFIG_ENCRYPTION_KEYS_PWD = "encryption_keys_pwd" CONFIG_KVDB_PATH = "kvdb_path" CONFIG_GOOGLE_PROVIDER_PATH = "google_provider_path" CONFIG_GOOGLE_CREDENTIALS_FILE_PATH = "google_credentials_file" CONFIG_GOOGLE_SHEET_ID = "google_sheet_id" CONFIG_LOG_LEVEL = "log_level" CONFIG_LOG_FILE_PATH = "log_file_path" CONFIG_KEY_FILE_PATH = "key_file_path" EncryptionKeyAction_Generate EncryptionKeyAction = iota EncryptionKeyAction_Decrypt EncryptionKeyAction_Encrypt EncryptionKeyAction_Verify WindowAspect_Normal WindowAspect = iota WindowAspect_FullScreen WindowMode_Edit WindowMode = iota // edit/update mode WindowMode_View // read only WindowAction_New WindowAction = iota // window with new data (create mode) WindowAction_Update // update data in window (update mode) WindowAction_Delete // prepare to delete data (delete mode) OPT_WINDOW_ASPECT = "window_aspect" OPT_WINDOW_MODE = "window_mode" OPT_WINDOW_ACTION = "window_action" WIN_MAIN = "main" WIN_NOTE_DETAILS = "note_details" BTN_CANCEL = "btn_cancel" BTN_SAVE_NEW = "btn_save_new" BTN_SAVE_UPDATED = "btn_save_updated" BTN_DELETE = "btn_delete" BTN_OK = "btn_ok" BTN_TOGGLE_CONTENT = "btn_toggle_content" BTN_COPY_ENCRYPTED = "btn_copy_encrypted" BTN_PASTE_ENCRYPTED = "btn_paste_encrypted" BTN_PASSWORD_MODAL = "btn_password_modal" WDG_NOTE_DETAILS_TITLE = "note_details_title" WDG_NOTE_DETAILS_CONTENT = "note_details_content" WDG_NOTE_DETAILS_CONTENT_RICH_TEXT = "note_details_content_rich_text" WDG_NOTE_DETAILS_HIDDEN = "note_details_hidden" WDG_NOTE_DETAILS_ENCRYPTED = "note_details_encrypted" WDG_NOTE_DETAILS_CREATED_AT = "note_details_created_at" WDG_NOTE_DETAILS_UPDATED_AT = "note_details_updated_at" WDG_NOTE_LIST = "note_list" WDG_PASSWORD_MODAL = "password_modal" WDG_SEARCH_BOX = "search_box" // log levels LOG_LEVEL_TRACE = "trace" LOG_LEVEL_DEBUG = "debug" LOG_LEVEL_INFO = "info" LOG_LEVEL_WARN = "warn" LOG_LEVEL_ERROR = "error" LOG_LEVEL_FATAL = "fatal" LOG_LEVEL_PANIC = "panic" ENCRYPTION_ALGORITHM_AES_256_CBC = "aes-256-cbc" ENCRYPTION_ALGORITHM_RSA_OAEP = "rsa-oaep" )
const ( ERR_NOTE_NOT_FOUND = "note not found" ERR_NOTE_ALREADY_EXISTS = "note already exists" ERR_NOTE_EMPTY = "note is empty" ERR_NOTE_TITLE_SAME = "note title is same" ERR_NOTE_TITLE_EMPTY = "note title is empty" ERR_NOTE_TITLE_OLD_EMPTY = "note previous title is empty" ERR_ENCRYPTION_KEY_NOT_SET = "encryption key not set" ERR_NOTE_ID_NOT_UNIQUE = "note ID is not unique" ERR_BUCKET_EMPTY = "bucket is empty" ERR_INVALID_GOOGLE_PROVIDER_CONFIG = "invalid Google provider configuration" ERR_NO_KEY = "no key" ERR_KEY_NOT_FOUND = "key not found" ERR_EMPTY_KEY_BLOCK = "empty key block" ERR_INVALID_KEY_TYPE = "invalid key type" ERR_INVALID_KEY_LENGTH = "invalid key length" ERR_SYMMETRIC_KEY_SIGNING_NOT_IMPLEMENTED = "symmetric key signing not implemented" ERR_INVALID_HEX_STRING = "invalid hex string" ERR_CERT_NOT_FOUND = "certificate not found" ERR_CANNOT_DECRYPT_MISSING_KEY = "message cannot be decrypted. Missing key?" ERR_UNKNOWN_KEY_ACTION = "unknown key action" )
Variables ¶
var ( DEFAULT_RESOURCE_PATH = "resources" DEFAULT_DB_PATH = "db/kv_store" DEFAULT_LOG_LEVEL = LOG_LEVEL_ERROR DEFAULT_LOG_FILE_PATH = filepath.Join("logs", "ecnotes.log") DEFAULT_KEY_FILE_PATH = "key_store.json" SUPPORTED_ENCRYPTION_ALGORITHMS = []string{ ENCRYPTION_ALGORITHM_AES_256_CBC, ENCRYPTION_ALGORITHM_RSA_OAEP, } )
var DefaultTimeFormat = time.RFC3339Nano
DefaultTimeFormat is the time format to use for formatting and parsing time values.
Functions ¶
func GetCurrentTime ¶
func GetCurrentTime() string
GetCurrentTime get time as string formatted RFC3339
func GetCurrentTimestamp ¶
func GetCurrentTimestamp() int64
GetCurrentTimestamp get unix timestamp in milliseconds
func GetMapValOrNil ¶
GetMapValOrNil gets the value from the map and returns nil if the key is not found
func GetUserHomeDir ¶
func GetUserHomeDir() string
GetUserHomeDir returns the user's home directory.
func IsSupportedEncryptionAlgorithm ¶
IsSupportedEncryptionAlgorithm returns true if the specified encryption algorithm is supported by the application. The supported algorithms are defined as constants
func MarshalJSON ¶
MarshalJSON marshals a struct into JSON
func TimestampToTime ¶
TimestampToTime convert unix timestamp to time
func UnmarshalJSON ¶
UnmarshalJSON unmarshals a JSON string into a struct
Types ¶
type EncryptionKeyAction ¶
type EncryptionKeyAction int64
EncryptionKeyAction enum to describe the encryption key action
type WindowAction ¶
type WindowAction int64
EncryptionKeyAction enum to describe the encryption key action
type WindowAspect ¶
type WindowAspect int64
EncryptionKeyAction enum to describe the encryption key action
type WindowMode ¶
type WindowMode int64
EncryptionKeyAction enum to describe the encryption key action