Documentation
¶
Index ¶
- Constants
- func DocsLanguages() []string
- func DocsLanguagesJS() string
- func ExtractManifestFromHTML(htmlContent []byte) ([]byte, error)
- func ExtractShareFromHTML(htmlContent []byte) (*core.Share, error)
- func GenerateDocsHTML(lang string, selfhosted bool) string
- func GenerateHomeHTML(bundlesJSON string) string
- func GenerateIndexHTML(selfhosted bool) string
- func GenerateMakerHTML(createWASMBytes []byte, opts MakerHTMLOptions) string
- func GenerateRecoverHTML(personalization *PersonalizationData, opts ...RecoverHTMLOptions) string
- func GenerateSetupHTML() string
- func GetCreateWASMBytes() []byte
- func HomeBundlesJSON(bundles any) string
- func SetBuildDate(d string)
- func SetCreateWASMBytes(data []byte)
- func SetVersion(v string)
- type DocsFrontmatter
- type FriendInfo
- type I18nScriptOptions
- type LayoutOptions
- type MakerHTMLOptions
- type PersonalizationData
- type RecoverHTMLOptions
- type SelfhostedConfig
- type TOCEntry
Constants ¶
const MaxEmbeddedManifestSize = 10 << 20 // 10 MiB
MaxEmbeddedManifestSize is the maximum size of MANIFEST.age that will be embedded (base64-encoded) in recover.html. Manifests at or below this size are included so recovery can work without the separate MANIFEST.age file.
Variables ¶
This section is empty.
Functions ¶
func DocsLanguages ¶ added in v0.0.16
func DocsLanguages() []string
DocsLanguages returns the language codes that have a translated docs guide (e.g. ["es"]). English is excluded since it's the default.
func DocsLanguagesJS ¶ added in v0.0.16
func DocsLanguagesJS() string
DocsLanguagesJS returns a JS array literal of language codes that have a translated docs guide (e.g. ['es']). English is excluded since it's the default and uses docs.html without a language suffix.
func ExtractManifestFromHTML ¶ added in v0.0.10
ExtractManifestFromHTML extracts the MANIFEST.age bytes from a personalized recover.html file. It finds the embedded PERSONALIZATION JSON, parses the manifestB64 field, and base64-decodes it.
Returns an error if the HTML doesn't contain personalization data, or if the personalization doesn't include an embedded manifest (e.g., when --no-embed-manifest was used or the manifest was too large).
func ExtractShareFromHTML ¶ added in v0.0.15
ExtractShareFromHTML extracts the share from a personalized recover.html file. It finds the embedded PERSONALIZATION JSON and parses the holderShare field.
func GenerateDocsHTML ¶
GenerateDocsHTML creates the documentation page HTML from Markdown content. lang is the language code (e.g. "en", "es"). Falls back to "en" if not found.
func GenerateHomeHTML ¶ added in v0.0.16
GenerateHomeHTML creates the selfhosted home page with bundle data.
func GenerateIndexHTML ¶
GenerateIndexHTML creates the landing page HTML with embedded CSS.
func GenerateMakerHTML ¶
func GenerateMakerHTML(createWASMBytes []byte, opts MakerHTMLOptions) string
GenerateMakerHTML creates the complete maker.html with all assets embedded. createWASMBytes is the create.wasm binary (runs in browser for bundle creation). Note: recover.html uses native JavaScript crypto, not WASM.
func GenerateRecoverHTML ¶
func GenerateRecoverHTML(personalization *PersonalizationData, opts ...RecoverHTMLOptions) string
GenerateRecoverHTML creates the complete recover.html with all assets embedded. Uses native JavaScript crypto (no WASM required). personalization can be nil for a generic recover.html, or provided to personalize for a specific friend.
func GenerateSetupHTML ¶ added in v0.0.16
func GenerateSetupHTML() string
GenerateSetupHTML creates the admin password setup page.
func GetCreateWASMBytes ¶
func GetCreateWASMBytes() []byte
GetCreateWASMBytes returns the full WASM binary with bundle creation. This larger WASM is used in maker.html for the creation tool. Note: Must be set via SetCreateWASMBytes before use (done in CLI init).
func HomeBundlesJSON ¶ added in v0.0.16
HomeBundlesJSON serializes bundle metadata to JSON for the home page.
func SetBuildDate ¶ added in v0.0.17
func SetBuildDate(d string)
SetBuildDate sets the package-level build date used by HTML generation. Call this once at startup before generating any HTML.
func SetCreateWASMBytes ¶
func SetCreateWASMBytes(data []byte)
SetCreateWASMBytes sets the create.wasm bytes. Called by CLI initialization to avoid circular embedding.
func SetVersion ¶ added in v0.0.16
func SetVersion(v string)
SetVersion sets the package-level version used by all Generate functions. Call this once at startup before generating any HTML.
Types ¶
type DocsFrontmatter ¶ added in v0.0.16
type DocsFrontmatter struct {
Title string `yaml:"title"`
Subtitle string `yaml:"subtitle"`
CLIGuideNote string `yaml:"cli_guide_note"`
TOCTitle string `yaml:"toc_title"`
}
DocsFrontmatter holds the chrome/UI strings from the YAML frontmatter at the top of each Markdown docs content file.
type FriendInfo ¶
FriendInfo holds friend contact information for the UI.
type I18nScriptOptions ¶ added in v0.0.16
type I18nScriptOptions struct {
Component string // translation component name: "maker", "recover", "index"
UseNonce bool // whether to add nonce="{{CSP_NONCE}}" to the script tag
ExtraDeclarations string // JS inserted after translations (e.g. docsLangs)
SetLanguageExtra string // JS appended inside setLanguage() after core DOM updates
DOMContentLoadedPre string // JS at start of DOMContentLoaded handler, before setLanguage()
}
I18nScriptOptions controls the page-specific parts of the shared i18n script block.
type LayoutOptions ¶ added in v0.0.16
type LayoutOptions struct {
Title string // Page <title>
BodyClass string // Optional body class (e.g. "setup" to hide nav)
HeadMeta string // Extra <head> content (CSP, OG tags, etc.)
PageStyles string // Page-specific CSS (injected after shared styles)
BeforeContainer string // Content before the .container div (e.g. toast container, modals)
Content string // Page-specific HTML inside .container
Scripts string // Page-specific <script> tags
Selfhosted bool // Selfhosted mode: logo links to "/" instead of "about.html"
}
LayoutOptions holds the parameters for assembling a page from the shared layout.
type MakerHTMLOptions ¶ added in v0.0.16
type MakerHTMLOptions struct {
Selfhosted bool // Use selfhosted JS variant with server integration
SelfhostedConfig *SelfhostedConfig // Config injected into the HTML for selfhosted mode
}
MakerHTMLOptions holds optional parameters for GenerateMakerHTML.
type PersonalizationData ¶
type PersonalizationData struct {
Holder string `json:"holder"` // This friend's name
OtherFriends []FriendInfo `json:"otherFriends"` // List of other friends
Threshold int `json:"threshold"` // Required shares (K)
Total int `json:"total"` // Total shares (N)
Language string `json:"language,omitempty"` // Default UI language for this friend
ManifestB64 string `json:"manifestB64,omitempty"` // Base64-encoded MANIFEST.age (when <= MaxEmbeddedManifestSize)
TlockEnabled bool `json:"tlockEnabled,omitempty"` // Signals tlock-js should be included
}
PersonalizationData holds the data to personalize recover.html for a specific friend.
type RecoverHTMLOptions ¶ added in v0.0.16
type RecoverHTMLOptions struct {
NoTlock bool // Omit tlock-js even from generic recover.html
Selfhosted bool // Full selfhosted server mode (nav rewrites + config)
SelfhostedConfig *SelfhostedConfig // Config injected into the HTML for selfhosted mode
StaticHosted bool // Static hosting mode (manifest fetch, no nav rewrites)
}
RecoverHTMLOptions holds optional parameters for GenerateRecoverHTML.
type SelfhostedConfig ¶ added in v0.0.16
type SelfhostedConfig struct {
MaxManifestSize int `json:"maxManifestSize"` // Maximum MANIFEST.age size the server accepts
HasManifest bool `json:"hasManifest"` // Whether a manifest currently exists on the server
ManifestURL string `json:"manifestURL,omitempty"` // URL to fetch manifest from (set by server or static pages)
}
SelfhostedConfig holds configuration passed to the selfhosted frontend.