]> begriffs open source - libpw/summary
 
descriptionSecure password storage with sqlite backend
last changeMon, 24 Mar 2025 05:00:00 +0000 (00:00 -0500)
readme

secure password storage library

This library securely stores and validates passwords in a sqlite database. It can also create and redeem password reset tokens. Its runtime dependencies are present in the OpenBSD base system. Its build dependencies (meson) are easy to install.

building

# install the build system
pkg_add meson ninja

git clone https://dev.begriffs.com/git/libpw
cd libpw

# obtain my meson-wrap project used by the test suite
git submodule update --init

# initialize out-of-source build directory
meson setup build

# build the shared library and tests
meson compile -C build

# run the test suite
meson test -C build

usage

TODO: add more details.

# create a db with the right schema
sqlite3 passwords.sqlite3 < share/libpw-schema.sql

In C, open the database, and create a libpw password context.

#include <sqlite3.h>
#include <pw.h>

int main(int argc, char **argv)
{
    sqlite3 *db;
    pw_context *ctx;

    sqlite3_open("passwords.sqlite3", &db);
    pw_init_context(db, &ctx);

    pw_set(ctx, "root@example.com", "supersecurepass");
    // etc
}

For brevity, this snippet has no error checking. See test/test.c for more.

shortlog
2025-03-24 Joe NelsonInitial readme main
2025-03-07 Joe NelsonUpdate subprojects
2024-12-01 Joe NelsonSwitch to Meson build system
2025-01-05 Joe NelsonWIP: pw reset token generation
2025-01-01 Joe NelsonMore information about dummy hash choice vs NULL
2025-01-01 Joe NelsonInformative status codes for all funcs
2024-12-29 Joe NelsonIgnore more artifacts
2024-12-29 Joe NelsonTests
2024-12-29 Joe NelsonConnection "context" struct
2024-12-15 Joe NelsonPrevent a clue that user is missing
2024-12-15 Joe NelsonWIP: initial work
heads
9 months ago main