Documentation ¶
Overview ¶
Package safe provides types and methods for safe stored data.
Index ¶
Constants ¶
const MaxStringLength = 8192
Variables ¶
var ErrCharsDetected = errors.New("string is unsafe due to prohibited chars")
ErrCharsDetected means disallowed chars were found.
var ErrHTMLDetected = errors.New("string is unsafe due to detected html")
ErrHTMLDetected means html was found.
var ErrSQLDetected = errors.New("string is unsafe due to detected sql")
ErrSQLDetected means sql was found.
var ErrStringLength = errors.New("string is either zero-len or exceeds limit")
ErrStringLength means the string is zero-len or exceeds limit.
var ErrWSDetected = errors.New("string is unsafe due to detected whitespace")
ErrWSDetected means disallowed whitespace was found.
Functions ¶
Types ¶
type Password ¶
type Password struct {
// contains filtered or unexported fields
}
Password is a stringy type intended for sanity storage.
func NewPassword ¶
NewPassword makes sure a string is suitable as a password. Since validation is delegated to a kdf verification function, this is just a length check.
func TrustedPassword ¶
TrustedPassword assumes you have already validated the input string.
func (Password) MarshalJSON ¶
func (*Password) UnmarshalJSON ¶
type VarChar ¶
type VarChar struct {
// contains filtered or unexported fields
}
VarChar is a stringy type intended for sanity storage.
func NewVarChar ¶
NewVarChar makes sure a string is safe for db storage.
func TrustedVarChar ¶
TrustedVarChar assumes you have already validated the input string.