serve

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(store *Store, password string) bool

CheckPassword verifies the given password against the stored admin password.

func IsSetup

func IsSetup(store *Store) bool

IsSetup returns true if an admin password has been configured.

func SetPassword

func SetPassword(store *Store, password string) error

SetPassword encrypts a known plaintext with the given password and saves it. Returns an error if a password is already set.

Types

type BundleMeta

type BundleMeta struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Created      string `json:"created"` // RFC 3339
	Threshold    int    `json:"threshold"`
	Total        int    `json:"total"`
	ManifestSize int    `json:"manifestSize"`
}

BundleMeta holds non-secret metadata about a stored manifest.

type Config

type Config struct {
	Host            string
	Port            string
	DataDir         string
	MaxManifestSize int // Maximum MANIFEST.age size in bytes
	Version         string
	BuildDate       string
}

Config holds the configuration for the server.

type Server

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

Server implements http.Handler for the self-hosted ReMemory web app.

func New

func New(cfg Config) (*Server, error)

New creates a new Server from the given config.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(addr string) error

ListenAndServe starts the HTTP server.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler.

func (*Server) Store

func (s *Server) Store() *Store

Store returns the server's store (for testing).

type Store

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

Store manages bundle storage on the filesystem. Data directory layout:

<data-dir>/
  admin.age              # age-encrypted known plaintext (admin password verification)
  bundles/
    <uuid>/
      meta.json          # BundleMeta
      MANIFEST.age       # The encrypted archive

func NewStore

func NewStore(dir string) (*Store, error)

NewStore creates a Store backed by the given directory. The directory is created if it doesn't exist.

func (*Store) AdminFilePath

func (s *Store) AdminFilePath() string

AdminFilePath returns the path to the admin.age password file.

func (*Store) Delete

func (s *Store) Delete(id string) error

Delete removes a bundle by ID.

func (*Store) HasManifest

func (s *Store) HasManifest() bool

HasManifest returns true if at least one bundle exists.

func (*Store) Latest

func (s *Store) Latest() (*BundleMeta, error)

Latest returns the metadata for the most recently created bundle, or nil if none exist.

func (*Store) List

func (s *Store) List() ([]BundleMeta, error)

List returns metadata for all bundles, sorted by creation time (newest first).

func (*Store) ManifestPath

func (s *Store) ManifestPath(id string) string

ManifestPath returns the filesystem path to a bundle's MANIFEST.age.

func (*Store) Save

func (s *Store) Save(manifest []byte, meta BundleMeta) (string, error)

Save stores a manifest and its metadata, returning the generated UUID.

Jump to

Keyboard shortcuts

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