pwsafe/transport — file: plugin (reference/test)

See parent: transport

Purpose

A plugin implementing the full PWSTransport interface using plain local file operations. Activated by the file: scheme (e.g. file:///home/john/test.psafe3). No network, no external libraries.

Primary uses:

Test the plugin infrastructure — exercises the full dispatch/cache/load stack without needing a server • Reference implementation — simple enough to read in one sitting; the canonical example for writing new plugins • ABI validation — if the file: plugin loads and works, the plugin interface is correct before any network code is written

Implementation

All five interface functions are trivial:

fetch(url, local_path) — strip file://, copy file to cache path • store(local_path, url) — strip file://, copy cache file to destination • exists(url) — strip prefix, call stat()lock / unlock — no-op (or optional: create/delete a .lck sidecar for realism) • pws_plugin_init — register for scheme file

Embedded identity string: PWS_TRANSPORT_INFO:1:file:Local file transport (testing)

No external dependencies. Links only against libc. Should build and pass tests before any WebDAV work begins.

Testing Value

With the file: plugin, the full round-trip (open URL → cache → modify → save → push back) can be tested with:

pwsafe file:///tmp/test.psafe3

This tests: plugin loading, identity string parsing, scheme dispatch, cache path resolution, FOpen/FClose hooks, offline fallback path — everything except the network.

version1
created2026-02-24