Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ jobs:
python_versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
install_extras: ''
test_path: 'tests'
pr_comment: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
1 change: 1 addition & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ jobs:
test_path: 'tests/'
install_extras: ''
min_coverage: 0
pr_comment: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
2 changes: 2 additions & 0 deletions .github/workflows/license_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ jobs:
license_check:
uses: OpenVoiceOS/gh-automations/.github/workflows/license-check.yml@dev
secrets: inherit
with:
pr_comment: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ jobs:
with:
ruff: true
pre_commit: false # set true if .pre-commit-config.yaml exists
pr_comment: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
2 changes: 2 additions & 0 deletions .github/workflows/pip_audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ jobs:
pip_audit:
uses: OpenVoiceOS/gh-automations/.github/workflows/pip-audit.yml@dev
secrets: inherit
with:
pr_comment: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
1 change: 1 addition & 0 deletions .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

jobs:
release_preview:
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
uses: OpenVoiceOS/gh-automations/.github/workflows/release-preview.yml@dev
secrets: inherit
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/repo-health.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

jobs:
repo_health:
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
uses: OpenVoiceOS/gh-automations/.github/workflows/repo-health.yml@dev
secrets: inherit
with:
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Tests

on:
push:
branches: ["**"]
pull_request:
branches: ["**"]

jobs:
test-plain:
name: "SQLite (no encryption)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: pip install -e ".[dev]" || pip install -e .
- run: pip install pytest
- run: pytest tests/test_sqlitedb.py -q -p no:ovoscope

test-cipher:
name: "SQLite + SQLCipher"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install sqlcipher system library
run: |
sudo apt-get update
sudo apt-get install -y libsqlcipher-dev
- run: pip install -e ".[cipher]"
- run: pip install pytest
- run: pytest tests/test_sqlitedb.py -q -p no:ovoscope
49 changes: 8 additions & 41 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,24 @@
# Changelog

## [0.2.1a4](https://github.com/JarbasHiveMind/hivemind-sqlite-database/tree/0.2.1a4) (2026-04-15)
## [0.3.0a2](https://github.com/JarbasHiveMind/hivemind-sqlite-database/tree/0.3.0a2) (2026-05-18)

[Full Changelog](https://github.com/JarbasHiveMind/hivemind-sqlite-database/compare/0.2.1a3...0.2.1a4)
[Full Changelog](https://github.com/JarbasHiveMind/hivemind-sqlite-database/compare/0.3.0a1...0.3.0a2)

**Merged pull requests:**

- ci: sync publish workflows from shared templates [\#22](https://github.com/JarbasHiveMind/hivemind-sqlite-database/pull/22) ([JarbasAl](https://github.com/JarbasAl))

## [0.2.1a3](https://github.com/JarbasHiveMind/hivemind-sqlite-database/tree/0.2.1a3) (2026-04-15)

[Full Changelog](https://github.com/JarbasHiveMind/hivemind-sqlite-database/compare/0.2.1a2...0.2.1a3)

## [0.2.1a2](https://github.com/JarbasHiveMind/hivemind-sqlite-database/tree/0.2.1a2) (2026-04-15)

[Full Changelog](https://github.com/JarbasHiveMind/hivemind-sqlite-database/compare/0.2.1a1...0.2.1a2)

**Merged pull requests:**

- Update actions/setup-python action to v6 [\#15](https://github.com/JarbasHiveMind/hivemind-sqlite-database/pull/15) ([renovate[bot]](https://github.com/apps/renovate))
- Update actions/checkout action to v6 [\#9](https://github.com/JarbasHiveMind/hivemind-sqlite-database/pull/9) ([renovate[bot]](https://github.com/apps/renovate))

## [0.2.1a1](https://github.com/JarbasHiveMind/hivemind-sqlite-database/tree/0.2.1a1) (2026-04-15)

[Full Changelog](https://github.com/JarbasHiveMind/hivemind-sqlite-database/compare/0.2.0a1...0.2.1a1)

**Merged pull requests:**

- fix: move pytest\_plugins to top-level conftest for pytest 9 compatibility [\#18](https://github.com/JarbasHiveMind/hivemind-sqlite-database/pull/18) ([JarbasAl](https://github.com/JarbasAl))

## [0.2.0a1](https://github.com/JarbasHiveMind/hivemind-sqlite-database/tree/0.2.0a1) (2026-04-15)

[Full Changelog](https://github.com/JarbasHiveMind/hivemind-sqlite-database/compare/0.0.4a2...0.2.0a1)

**Merged pull requests:**

- feat: release 0.1.0 — tests, thread-safety, SQL injection fix [\#14](https://github.com/JarbasHiveMind/hivemind-sqlite-database/pull/14) ([JarbasAl](https://github.com/JarbasAl))

## [0.0.4a2](https://github.com/JarbasHiveMind/hivemind-sqlite-database/tree/0.0.4a2) (2025-12-19)
**Closed issues:**

[Full Changelog](https://github.com/JarbasHiveMind/hivemind-sqlite-database/compare/0.0.4a1...0.0.4a2)
- security: encrypted db [\#2](https://github.com/JarbasHiveMind/hivemind-sqlite-database/issues/2)

**Merged pull requests:**

- chore\(deps\): update actions/setup-python action to v6 [\#12](https://github.com/JarbasHiveMind/hivemind-sqlite-database/pull/12) ([renovate[bot]](https://github.com/apps/renovate))
- Preserve client metadata \(supersedes \#29\) [\#30](https://github.com/JarbasHiveMind/hivemind-sqlite-database/pull/30) ([JarbasAl](https://github.com/JarbasAl))

## [0.0.4a1](https://github.com/JarbasHiveMind/hivemind-sqlite-database/tree/0.0.4a1) (2025-12-18)
## [0.3.0a1](https://github.com/JarbasHiveMind/hivemind-sqlite-database/tree/0.3.0a1) (2026-04-15)

[Full Changelog](https://github.com/JarbasHiveMind/hivemind-sqlite-database/compare/0.0.3...0.0.4a1)
[Full Changelog](https://github.com/JarbasHiveMind/hivemind-sqlite-database/compare/0.2.1...0.3.0a1)

**Merged pull requests:**

- chore: Configure Renovate [\#7](https://github.com/JarbasHiveMind/hivemind-sqlite-database/pull/7) ([renovate[bot]](https://github.com/apps/renovate))
- feat: add SQLCipher encryption support \(password kwarg\) [\#24](https://github.com/JarbasHiveMind/hivemind-sqlite-database/pull/24) ([JarbasAl](https://github.com/JarbasAl))



Expand Down
77 changes: 76 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,76 @@
# HiveMind SQLite Database
# HiveMind SQLite Database

SQLite database plugin for [hivemind-core](https://github.com/JarbasHiveMind/HiveMind-core).

Implements the `AbstractDB` interface via `hivemind-plugin-manager` and stores HiveMind
client records (API keys, crypto keys, access-control lists) in a local SQLite file.

## Installation

```bash
pip install hivemind-sqlite-database
```

### With encryption support (SQLCipher)

```bash
# 1. Install the SQLCipher system library
# Debian/Ubuntu:
sudo apt install libsqlcipher0

# 2. Install the Python binding via the optional extra
pip install "hivemind-sqlite-database[cipher]"
```

> The `sqlcipher3` wheel on PyPI ships its own libsqlcipher for x86_64 Linux, so the
> `apt` step may be optional on that platform. On ARM or Alpine you must build from
> source and will need the system library.

## Usage

### Plain (unencrypted) database — default

```python
from hivemind_sqlite_database import SQLiteDB

db = SQLiteDB() # stores data in XDG_DATA_HOME/hivemind-core/clients.db
```

### Encrypted database (SQLCipher / AES-256)

```python
from hivemind_sqlite_database import SQLiteDB

db = SQLiteDB(password="your-strong-passphrase")
```

Pass the same `password` every time you open the database. The encryption is
transparent — all existing methods (`add_item`, `search_by_value`, etc.) work
identically.

> **Data-loss warning**: There is no password recovery. If you lose the passphrase
> the database is permanently unrecoverable. Back up your passphrase securely.

### hivemind-core configuration

```json
{
"database": {
"module": "hivemind-sqlite-db-plugin",
"hivemind-sqlite-db-plugin": {
"name": "clients",
"subfolder": "hivemind-core",
"password": "your-strong-passphrase"
}
}
}
```

Leave `"password"` out (or set it to `null`) to use an unencrypted database.

## Notes

- An encrypted database cannot be opened by the plain `sqlite3` CLI or stdlib module.
- A plaintext database cannot be opened as encrypted. There is no automatic migration.
- The `password` field maps directly to SQLCipher's `PRAGMA key`.
- WAL journal mode is enabled for both encrypted and unencrypted databases.
Loading