Documentation ¶
Index ¶
- Variables
- func CleanFile(fileName string)
- func CleanFileWatch()
- func Decrypt(password []byte, decryptionKey string, ttl int) (string, error)
- func Encrypt(password string) ([]byte, string, error)
- func EnvInit()
- func GetBaseUrl(context echo.Context) string
- func GetFile(f *models.File) *echo.HTTPError
- func GetMaxFileSizeText() string
- func GetPassword(p *models.Password) *echo.HTTPError
- func GetTTLText(ttl int) (ttlText string)
- func GetTtlSeconds(ttl int) int
- func NewPool() *redis.Pool
- func ParseToken(token string) (string, string, error)
- func Ping(c redis.Conn) bool
- func RandomSequence(n int) string
- func RemoveFile(f *models.File) *echo.HTTPError
- func RemovePassword(p *models.Password) *echo.HTTPError
- func RetrieveFilePassword(f *models.File) *echo.HTTPError
- func RetrievePassword(p *models.Password) *echo.HTTPError
- func SetFile(password string, ttl int, views int, deletable, provided bool, ...) (string, *echo.HTTPError)
- func SetPassword(password string, ttl int, views int, deletable bool) (string, *echo.HTTPError)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( REDIS_HOST string REDIS_PASSWORD string REDIS_PORT string REDIS_DB string REDIS_PREFIX string TOKEN_SEPARATOR string NO_SSL bool = false APP_PORT string LOGO string APP_NAME string DISCLAIMER string COPYRIGHT string FILEFOLDER string MAXFILESIZE string MaxFileSize int64 DataContext pongo2.Context )
Functions ¶
func CleanFileWatch ¶
func CleanFileWatch()
*
- Subscribe to redis and check when a key expire then clean the associated file
func Decrypt ¶
*
- Decrypt a password (bytes) using the provided key (bytes) and return the plain-text password (bytes).
- @param password
- @param decryption_key
func Encrypt ¶
* Take a password string, encrypt it with Fernet symmetric encryption and return the result (bytes), with the decryption key (bytes) * @param password
func GetBaseUrl ¶
func GetBaseUrl(context echo.Context) string
*
- Return url with http or https based on NO_SSL env value
func GetMaxFileSizeText ¶
func GetMaxFileSizeText() string
func GetPassword ¶
https://gist.github.com/pohzipohzi/a202f8fb7cc30e33176dd97a9def5aac https://www.alexedwards.net/blog/working-with-redis
func RandomSequence ¶
func RemoveFile ¶
func RemovePassword ¶
*
- Remove a password from the redis store. If an error occur we return a not found
func RetrieveFilePassword ¶
func RetrievePassword ¶
func SetFile ¶
func SetFile(password string, ttl int, views int, deletable, provided bool, providedKey string) (string, *echo.HTTPError)
*
- Encrypt and store the password for the specified lifetime.
- Returns a token comprised of the key where the encrypted password is stored, and the decryption key.
- @param {string} password
- @param {number} ttl
- @param {number} views
- @param {boolean} deletable
- @return {string} token
func SetPassword ¶
*
- Encrypt and store the password for the specified lifetime.
- Returns a token comprised of the key where the encrypted password is stored, and the decryption key.
- @param {string} password
- @param {number} ttl
- @param {number} views
- @param {boolean} deletable
- @return {string, error} token, error
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.