Documentation
¶
Overview ¶
Package links serves report pages and sensitive-data forms over the bot's own HTTP listener (stage 24), so answers arrive as links, not walls of text. Security by design: every link is HMAC-signed, binds the sender it was minted for, and expires; a per-chat PIN (sent alongside the link) is the second factor - another sender opening the link does not have it; submitted form values land in the vault and never touch a log line; the server binds wherever the channel adapter already listens (localhost by default).
Index ¶
- type Record
- type Service
- func (s *Service) Handler() http.Handler
- func (s *Service) MintForm(sender, title, vaultKey string) (link, pin string, err error)
- func (s *Service) MintReport(sender, title, content string) (link, pin string, err error)
- func (s *Service) MintReportHTML(sender, title, page string) (link, pin string, err error)
- func (s *Service) SetNow(f func() time.Time)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Record ¶
type Record struct {
ID string `json:"id"`
Kind string `json:"kind"` // report | form
Sender string `json:"sender"`
PINHash string `json:"pin_hash"`
Expires time.Time `json:"expires"`
Title string `json:"title"`
VaultKey string `json:"vault_key,omitempty"`
}
Record is one minted link. Reports carry a content file; forms carry a vault key and a label.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service mints and serves links.
func Open ¶
func Open(secretPath, baseURL, storeDir, vaultDir string, logf func(string, ...any)) (*Service, error)
Open loads (or creates) the signing secret and the store. baseURL is the public base the bot's links are reached on.
func (*Service) MintForm ¶
MintForm creates a sensitive-data form landing in vaultKey and returns the link and its PIN for sender.
func (*Service) MintReport ¶
MintReport stores title/content as an HTML page and returns the link and its PIN for sender.
func (*Service) MintReportHTML ¶
MintReportHTML is MintReport for runner-generated reports: the page is trusted HTML built by the bot itself (tables, embedded charts), never model- or user-supplied markup. Same signing, PIN and expiry machinery; the model-facing make_report_link tool keeps the escaped plain-text path.