UnENVerse 0.42.6
Local-first desktop secrets manager — TypeScript frontend
Loading...
Searching...
No Matches
utils.ts File Reference
import invokeTauri;

Functions

function export onClipboardWrite (fn:((text:string)=> void)|null)
 Pure utilities — no state, no DOM side effects on module load.
 
error if (typeof path !=='string') return
 Parses an expression.
 
 catch (e)
 

Variables

error __pad0__ { ok: false
 
 return { ok: true, path }
 
 try
 
const url = URL.createObjectURL(blob)
 
const a = Object.assign(document.createElement('a'), { href: url, download: suggestedName })
 
function export execCopy(text:string) export const copySVG
 
export const editSVG
 
export const delSVG
 
export const dupSVG
 

Function Documentation

◆ onClipboardWrite()

function export onClipboardWrite ( fn:((text:string)=> void)|  null)

Pure utilities — no state, no DOM side effects on module load.

Prompt for a secret. Same modal as showPrompt but the input is masked and the value is not trimmed (passwords may legitimately contain edge spaces).

Replaces the native window.prompt(), which WebKitGTK renders as an unstyled system dialog and can suppress entirely. Called with every string the app puts on the clipboard (the materialisation log). Writes content to disk as suggestedName and reports where it landed.

A3 (2026-09-14). Every export in the app used to build a Blob, click a <a download> anchor and toast "Exported ✓" unconditionally (downloadText, formerly in import-export.ts). Tauri's WebKitGTK webview has no download handler and no dialog/fs plugin, so the click went nowhere — the toast was true only in a plain browser dev server (npm run dev). This is the one place that decides, so a toast can finally say what happened instead of what was hoped.

In Tauri: writes through write_export_file (a real file, on disk, 0600 on Unix) and resolves with the absolute path. In a browser: falls back to the blob-and-anchor dance, which a real download manager does handle there.

Never throws — the caller decides how to tell the user, and a rejected promise from a copy/export button is a console nobody reads.

◆ if()

error if ( pos !  pos ! = =toks.length)
new

Parses an expression.

Throws with a readable message on malformed input.

◆ catch()

catch (   e)

Variable Documentation

◆ __pad0__

error __pad0__ { ok: false

◆ return

return { ok: true, path }

◆ try

try
Initial value:
{
const blob = new Blob([content], { type: mime })
export const type
Definition permex.ts:34

◆ url

const url = URL.createObjectURL(blob)

◆ a

const a = Object.assign(document.createElement('a'), { href: url, download: suggestedName })

◆ copySVG

function export execCopy (text: string) export const copySVG
Initial value:
= raw(
`<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>`,
)
function export raw(markup:string)
Vouch for a string as markup.
Definition html.ts:30

◆ editSVG

export const editSVG
Initial value:
= raw(
`<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>`,
)

◆ delSVG

export const delSVG
Initial value:
= raw(
`<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6M14 11v6M9 6V4h6v2"/></svg>`,
)

◆ dupSVG

export const dupSVG
Initial value:
= raw(
`<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="1" y="1" width="13" height="13" rx="2"/><path d="M8 8h13v13H8z"/></svg>`,
)