TagID Extension - LNbits extension
Forked from lnbits/boltcards
Extended with PIN limit protection and failed-payment daily-limit fix.
Self custody NFC Bolt Cards with one-time LNURLw links — now with optional PIN verification and accurate daily spend tracking.
Check out lnbits.com & join the Telegram support group Makerbits
Original authors: dni, prusnak, talvasconcelos, arbadacarbaYK, gorrdy, arcbtc / TagID extension: AxelHamburch
Extension manifest source for LNbits: https://raw.githubusercontent.com/AxelHamburch/tagid_extension/main/extensions.json
LNbits 1.7.x: use
extensions.jsonas manifest URL. The oldermanifest.json(GitHub-repo format) does not list any extension in LNbits 1.7.0/1.7.1, because core fails to parse the GitHub API answer (stargazers_countis declared asstr, GitHub returns a number).
- Fixed a misleading message. When the wallet behind a card could not pay (for example an empty funding wallet), the payer saw "Payment failed or is still pending." even though the payment had been rejected, and the real reason was not written anywhere.
- The reason now goes to the server log, for example
TagID payment not completed: card=… hit=… status=failed: Insufficient balance. - The payer sees LNbits' own short message, for example
Payment failed: Insufficient balance.If LNbits gives no final status, the message is shown as it is (for exampleExtension 'tagid' not enabled.). Unexpected errors still show only a generic text; their details stay in the log.
- Fixed a data-loss trap. In v2.2.0, Prepare wipe data in the card dialog already performed the wipe: the card was disabled and its keys were removed from the server. Opening the dialog again and copying the wipe data then put empty keys into the clipboard, so keys that were never saved elsewhere were gone.
- The wipe now only disables the card. Keys and PIN stay stored until you delete the card. An accidental wipe is undone by enabling the card again.
- New Copy keys (backup) button: copies the keys without changing anything. Wipe card now (was: "Prepare wipe data") is red and asks for confirmation. The copy buttons refuse to copy when no keys are stored, so a good backup in the clipboard is never overwritten.
- The wipe dialog explains the order (backup, wipe, delete). A card without stored keys (for example wiped with v2.2.0) can be deleted directly; the useless buttons are hidden and the dialog says why.
- After updating or reinstalling the extension, restart the LNbits server and hard-reload the page (
Ctrl+Shift+R). LNbits adds the server start time to the file URLs, so without a restart the browser can keep using the old JavaScript with the new template (frozen page,… is not a functionin the console). - Cards wiped with v2.2.0 have no keys on the server any more. If you still have the saved wipe data, edit the card, enter K0, K1 and K2 from it and enable the card. The chip itself was not changed by the wipe.
Requires LNbits 1.7.0 or newer. Based on the security hardening of upstream boltcards v1.2.1, plus TagID-specific fixes.
Security fixes
- Card keys (K0–K2) are only handed out against a valid one-time programming link (OTP) and matching UID. Before, the UID alone was enough.
- Withdrawals are atomic: a tap and a claim can only be used once, also under parallel requests. Daily limit and transaction limit are checked in the database before paying (UTC day).
- PIN checks happen in the same database transaction as the payment, so parallel requests cannot get more than 3 PIN guesses. A wrong PIN does not consume the tap.
- The PIN failure counter is only reset by a correct PIN or by re-enabling the card. Small payments below the PIN limit no longer reset it.
- The PIN hash is no longer part of any API response (
has_pin: true/falseinstead). - Refunds are only accepted for payments into the card's own wallet.
- Rate limits on the programming endpoint (10/min per IP) and on the verify endpoint (10/min per card).
- Verify-only taps (ZapBox Ring-Login) can never be paid out.
Breaking changes
GET /tagid/api/v1/cards,/hitsand/refundsrequire the wallet admin key (was: invoice key).- API responses no longer contain
pin; usehas_pin. - Programming via
POST /tagid/api/v1/authneeds the OTP from the QR code, the UID alone is rejected. The Bolt Card Programmer app does this automatically. - In v2.2.0 the wipe in the card dialog also removed the card keys from the server. This was changed in v2.2.1, see above.
GET /tagid/api/v1/scan/verify/{external_id}returns an additional fieldpin_verified. A PIN sent for a card without PIN is ignored (no failed attempt).- Open withdraw requests from before the update are closed during migration. Simply tap the card again.
- Set a PIN threshold (sat): any withdrawal at or above this amount requires the card holder to enter a 4-digit PIN.
- The PIN is stored as a salted PBKDF2-SHA256 hash — never in plaintext.
- After 3 wrong PIN attempts across taps the card is automatically disabled and must be re-enabled by the wallet owner.
- Attempt counter resets when the card is re-enabled or when a correct PIN is entered.
- Limit checks (tx limit & daily limit) now happen before the hit is marked as spent, so a rejected payment does not consume the daily budget.
- When a payment fails after the invoice was accepted, the hit amount is zeroed so it does not count towards the daily limit.