No description
  • Python 82%
  • Vue 9.4%
  • JavaScript 8%
  • Makefile 0.6%
Find a file
Padreug e307829b50 feat(signer): migrate Nostr publishing off account.prvkey → resolve_for_wallet (#3)
Closes aiolabs/tasks#3. Pre-cascade prerequisite for aiolabs/lnbits#17
(signer abstraction phase 1), which lands an m002 startup job that
NULLs the legacy `accounts.prvkey` column. After this migration, the
tasks extension reads no plaintext nsec and works with any
NostrSigner backend (LocalSigner / RemoteBunkerSigner / ClientSideOnlySigner).

## What changed

### nostr_hooks.py — three publisher entry points

Was: `_account_keys(wallet_id)` helper pulled `(account.pubkey,
account.prvkey)` from the wallet's owning account, returned None when
prvkey was missing, then passed both to the publishers.

Now: each of `publish_or_delete_task_event`,
`publish_task_completion`, and `publish_completion_delete` calls
`await resolve_for_wallet(...)` (the DRY helper from
aiolabs/lnbits#23 — wallet → account → signer → can_sign-check in
one call, returns None on any soft-fail). The resolved `NostrSigner`
is passed to the publisher. Soft-skip on None (wallet missing,
account unclassified, or ClientSideOnlySigner where the server has
no signing authority).

Removed the `_account_keys` helper entirely.

### nostr_publisher.py — three publishers

Was: `publish_task_to_nostr`, `publish_completion_to_nostr`, and
`publish_completion_delete_to_nostr` each accepted
`(account_pubkey: str, account_prvkey: str)` and signed via a local
`sign_nostr_event` helper that called `coincurve.PrivateKey
.sign_schnorr` directly on the plaintext nsec.

Now: each publisher accepts `signer: NostrSigner`. Signing is
factored into a shared `_sign_and_publish` helper that builds the
unsigned event dict (`kind`/`created_at`/`tags`/`content`), hands it
to `await signer.sign_event(...)`, and writes `id`/`pubkey`/`sig`
back onto the local `NostrEvent` model before publishing. The signer
backend (LocalSigner / RemoteBunkerSigner) is transparent.

Removed the `sign_nostr_event` helper entirely — the signer
abstraction handles all signing now.

Dropped the `coincurve` import; no direct crypto in this extension.

## Acceptance

- [x] `_account_keys` helper removed (nostr_hooks no longer touches account.prvkey)
- [x] all three publishers accept NostrSigner instead of (pubkey, prvkey)
- [x] extension-local Schnorr code removed (sign_nostr_event gone)
- [x] coincurve import dropped
- [x] re-grep `tasks/`: zero `account.prvkey` references
- [x] version bumped: 0.0.1 → 0.0.2 (catalog entry deferred until cascade lands)

Manual smoke testing + tag + catalog entry follow the migration
landing; will run against the regtest stack with lnbits on
`issue-18-phase-2.3` (which validates both LocalSigner and
RemoteBunkerSigner signing paths end-to-end).

## Cross-references

- aiolabs/tasks#3 — issue this commit closes
- aiolabs/lnbits#17 — the cascading signer-abstraction PR
- aiolabs/lnbits#23 — the resolve_for_wallet helper this uses
- aiolabs/lnbits#21 — umbrella audit (5 affected extensions)
- aiolabs/events#23 — sister migration (already on signer-abstraction branch)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 22:18:04 +02:00
nostr add Nostr publishing and bidirectional sync 2026-05-13 11:38:42 +02:00
static add placeholder tasks.png tile 2026-05-17 20:08:14 +02:00
.gitignore scaffold tasks extension 2026-05-13 11:34:04 +02:00
__init__.py scaffold tasks extension 2026-05-13 11:34:04 +02:00
config.json feat(signer): migrate Nostr publishing off account.prvkey → resolve_for_wallet (#3) 2026-05-27 22:18:04 +02:00
crud.py add models, migrations, and CRUD 2026-05-13 11:36:13 +02:00
description.md scaffold tasks extension 2026-05-13 11:34:04 +02:00
LICENSE scaffold tasks extension 2026-05-13 11:34:04 +02:00
Makefile scaffold tasks extension 2026-05-13 11:34:04 +02:00
manifest.json scaffold tasks extension 2026-05-13 11:34:04 +02:00
migrations.py make tasks migration idempotent and fix sqlite index syntax 2026-05-13 13:33:35 +02:00
models.py add models, migrations, and CRUD 2026-05-13 11:36:13 +02:00
nostr_hooks.py feat(signer): migrate Nostr publishing off account.prvkey → resolve_for_wallet (#3) 2026-05-27 22:18:04 +02:00
nostr_publisher.py feat(signer): migrate Nostr publishing off account.prvkey → resolve_for_wallet (#3) 2026-05-27 22:18:04 +02:00
nostr_sync.py add Nostr publishing and bidirectional sync 2026-05-13 11:38:42 +02:00
pyproject.toml scaffold tasks extension 2026-05-13 11:34:04 +02:00
README.md scaffold tasks extension 2026-05-13 11:34:04 +02:00
toc.md scaffold tasks extension 2026-05-13 11:34:04 +02:00
views.py add API routes, admin UI, and SPA bootstrap 2026-05-13 11:43:59 +02:00
views_api.py add API routes, admin UI, and SPA bootstrap 2026-05-13 11:43:59 +02:00

Tasks — LNbits extension

LNbits-side counterpart to the webapp tasks module. Stores and syncs recurring tasks / chores as Nostr NIP-52 calendar events.

Data model

  • Kind 31922 — task (parameterized replaceable). Tagged with event-type: task so activities consumers can filter it out (see aiolabs/webapp#25 for context).
  • Kind 31925 — task completion / RSVP-ish status update. Carries task-status (claimed, in-progress, completed, blocked, cancelled), an optional occurrence date for recurring tasks, and completed_at when finalized.
  • Kind 5 — NIP-09 deletions for the above.

Recurrence is encoded as task-only tags: recurrence (daily | weekly), recurrence-day (weekday name for weekly), recurrence-end (YYYY-MM-DD).

What this extension does

  • Caches tasks and completions in a local sqlite/postgres schema.
  • Publishes mutations to Nostr via the nostrclient extension's internal WebSocket bridge.
  • Subscribes to inbound 31922/31925 events filtered to event-type=task so the local DB stays in sync with the relay set.

Status

Early scaffold. Mirrors events' extension layout. See ~/dev/webapp/src/modules/tasks/ for the canonical client-side model.