exportlink

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package exportlink mints one-time download links for the full raw event export (GET /export/<token>) — "give me my data" from the editor without dumping millions of rows through a conversation. Same token discipline as internal/share: 128-bit random tokens stored ONLY as sha256 hashes (a leaked sidecar file can't mint access). Stricter lifecycle than a share link, because this is the whole dataset: every link expires after an hour and burns on its first download.

Index

Constants

View Source
const TTL = time.Hour

TTL is how long an unused link stays downloadable.

Variables

This section is empty.

Functions

This section is empty.

Types

type Link struct {
	ID      string    `json:"id"`
	Format  string    `json:"format"` // csv | jsonl
	Hash    string    `json:"hash"`   // sha256(token), hex
	Created time.Time `json:"created"`
	Expires time.Time `json:"expires"`
}

Link is one pending export grant (the raw token is returned once at creation, never stored).

type Store

type Store struct {
	// contains filtered or unexported fields
}

func Open

func Open(p string) (*Store, error)

func (*Store) Create

func (s *Store) Create(format string, now time.Time) (Link, string, error)

Create mints a one-time link for a format ("" defaults to jsonl) and returns it with the RAW token — shown once, never stored.

func (*Store) Redeem

func (s *Store) Redeem(token string, now time.Time) (format string, ok bool)

Redeem burns the link for a presented token and returns its format. ok is false for unknown, expired, and already-used tokens alike — callers must not give a prober a way to tell those apart. The burn happens before the download starts, so a link is single-use even if the transfer then fails.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL