session

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package session handles short-lived caching of the master password so that repeated psst commands within a session window skip the password prompt.

The password is written to ~/.persist/.session (chmod 600) as a JSON file containing a base64-encoded password field and an expiry timestamp. The file is deleted automatically when the session expires.

Security note: the password is briefly held in memory as a []byte during read/write. All []byte values are zeroed after use. Go strings created internally by encoding/json are immutable and cannot be zeroed — this is a known Go limitation; the window is minimised by keeping strings short-lived.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileClear

func FileClear() error

FileClear removes the session file.

func FileGet

func FileGet() ([]byte, error)

FileGet returns the cached password from the session file, or nil if none exists or the session has expired (expired file is removed automatically).

func FileSet

func FileSet(password []byte, ttl time.Duration) error

FileSet atomically writes the password to the session file with the given TTL.

Types

This section is empty.

Jump to

Keyboard shortcuts

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