Documentation
¶
Overview ¶
internal/share/anon.go
Index ¶
- func AnonDisplayName(srcPath string) string
- func ContentDispositionHeader(name string, mode DispositionMode) (string, error)
- func Digest(tok string) [32]byte
- func EqualDigest(a, b [32]byte) bool
- func NewID() string
- func NewToken() string
- func SanitizeDisplayName(name string) (string, error)
- type DispositionMode
- type Share
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnonDisplayName ¶ added in v0.2.0
AnonDisplayName returns a 6-char lowercase-base32 slug, followed by the lowercased extension of srcPath (if any). Example: "secret.PDF" -> "k9vm3q.pdf". The source file's original name and path are never included.
func ContentDispositionHeader ¶
func ContentDispositionHeader(name string, mode DispositionMode) (string, error)
ContentDispositionHeader builds an RFC 6266 Content-Disposition value. Uses the ext-value (filename*) form for non-ASCII characters. Expects name to have already passed SanitizeDisplayName.
func Digest ¶
Digest returns the SHA-256 of a token. Only digests hit disk; raw tokens stay in memory.
func EqualDigest ¶
EqualDigest compares two digests in constant time.
func NewToken ¶
func NewToken() string
NewToken returns a 128-bit token encoded as 26 lowercase base32 chars.
func SanitizeDisplayName ¶
SanitizeDisplayName validates a user-supplied display name for use in URL path and Content-Disposition. Rejects anything that could enable path traversal, header injection, or Windows-reserved devices.