371 Commits

Author SHA1 Message Date
Riccardo Balbo
9c55f1ebe2
Implement deposit as receive paidAction (#1570)
* lnurlp paid action

* lnurlp has 10% sybil fee

* fix merge issue

* Update pages/settings/index.js

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>

* fix notifications

* fix destructure

* pass lud18Data to lnurlp action

* minor cleanup

* truncate invoice description to permitted length

* remove redundant targetUserId

* lnurlp paidAction -> receive paidAction

* remove redundant user query

* improve determining if peer is invoiceable

* fix inconsistent relative imports

* prevent paying self-proxied invoices and better held invoice cancellation

* make gun/horse streak zap specific

* unique withdrawal hash should apply to confirmed payments too

* prevent receive from exceeding wallet limits

* notifications

* fix notifications & enhance invoice/withdrawl page

* notification indicator, proxy receive based on threshold, refinements

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2024-11-15 18:38:14 -06:00
Keyan
a44d0daf09
paid action payment methods as an array (#1584)
* introduce fee credits & allow paid actions to specify payment method priority

* fix merge issue

* express supported paid action payment methods as an array

* log force payment method skipping methods

* fix stuff

* immutable context

* immutable paidAction context and other fixes

---------

Co-authored-by: Riccardo Balbo <riccardo0blb@gmail.com>
2024-11-12 19:00:51 -06:00
Riccardo Balbo
18700b4201
configurable sybil fee (#1577)
* configurable sybil fee

* document getSybilFeePercent

* fixes

* remove null check

* refine at the margins

---------

Co-authored-by: k00b <k00b@stacker.news>
2024-11-11 16:59:52 -06:00
ekzyis
72e2d19433
supercharged wallet logs (#1516)
* Inject wallet logger interface

* Include method in NWC logs

* Fix wrong page total

* Poll for new logs every second

* Fix overlapping pagination

* Remove unused total

* Better logs for incoming payments

* Use _setLogs instead of wrapper

* Remove inconsistent receive log

* Remove console.log from wallet logger on server

* Fix missing 'wallet detached' log

* Fix confirm_withdrawl code

* Remove duplicate autowithdrawal log

* Add context to log

* Add more context

* Better table styling

* Move CSS for wallet logs into one file

* remove unused logNav class
* rename classes

* Align key with second column

* Fix TypeError if context empty

* Check content-type header before calling res.json()

* Fix duplicate 'failed to create invoice'

* Parse details from LND error

* Fix invalid DOM property 'colspan'

* P2P zap logs with context

* Remove unnecessary withdrawal error log

* the code assignment was broken anyway
* we already log withdrawal errors using .catch on payViaPaymentRequest

* Don't show outgoing fee to receiver to avoid confusion

* Fix typo in comment

* Log if invoice was canceled by payer

* Automatically populate context from bolt11

* Fix missing context

* Fix wrap errors not logged

* Only log cancel if client canceled

* Remove unused imports

* Log withdrawal/forward success/error in payment flow

* Fix boss not passed to checkInvoice

* Fix TypeError

* Fix database timeouts caused by logger

The logger shares the same connection pool with any currently running transaction.

This means that we enter a classic deadlock when we await logger calls: the logger call is waiting for a connection but the currently running transaction is waiting for the logger call to finish before it can release a connection.

* Fix cache returning undefined

* Fix typo in comment

* Add padding-right to key in log context

* Always use 'incoming payment failed:'

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-11-08 13:26:40 -06:00
Keyan
0891e51c9e
fix passphrase scanning (#1553) 2024-11-07 16:24:41 -06:00
Keyan
d117549348
fix lightning module resolution (#1551)
* fix tsx usage

* Revert "Revert "Merge pull request #1521 from riccardobl/tordev""

This reverts commit 4cc3780eca1f1390bdd331f0e418b9a7efd4347e.

* lightning module resolution

* fix our one test
2024-11-07 09:03:54 -06:00
k00b
4cc3780eca Revert "Merge pull request #1521 from riccardobl/tordev"
This reverts commit 3112fc30d8b476c3682d6dc717bf0c83b50286a6, reversing
changes made to 803daed2dfe7171d317e9bf4bf02ed6a0962822c.
2024-11-05 20:08:33 -06:00
Riccardo Balbo
571a230b3c fix require is not defined in ES module scope 2024-11-04 20:09:34 +01:00
Riccardo Balbo
048c27fa7e
Merge branch 'master' into tordev 2024-11-04 10:38:00 +01:00
Keyan
d9e9a6722a
Merge pull request #1528 from riccardobl/trace
decode minified stacktrace
2024-11-03 17:28:25 -06:00
Keyan
08b160d663
Merge branch 'master' into tordev 2024-11-03 14:52:21 -06:00
Riccardo Balbo
9e39e0bd01
Merge branch 'master' into tordev 2024-11-03 00:36:42 +01:00
Riccardo Balbo
1d6f1a962b
Merge branch 'master' into trace 2024-11-03 00:36:30 +01:00
Riccardo Balbo
6cb4870595
Merge branch 'master' into blinkreceiver 2024-11-02 11:44:54 +01:00
Riccardo Balbo
c3c3fe1ccb Always return original stack trace 2024-10-31 15:54:54 +01:00
Riccardo Balbo
be9b919b60 decode minified stacktrace 2024-10-31 15:43:20 +01:00
k00b
b1fc341017 sync/desync from localstorage on vault connect/disconnect 2024-10-30 18:37:45 -05:00
k00b
0c8180d89c fix active vault check and optional vaultEntries 2024-10-30 13:49:57 -05:00
k00b
dce5762f63 get vault working 2024-10-30 13:49:57 -05:00
k00b
aa04adacea remove unused phoenix schema 2024-10-30 13:49:57 -05:00
k00b
e96982c353 refactor wallet validation 2024-10-30 13:49:57 -05:00
k00b
ccdf346954 server side config saves 2024-10-30 13:49:47 -05:00
k00b
4826ae5a7b wip upsertWallet 2024-10-30 13:45:09 -05:00
k00b
2bdbb433df webln saves at least *double kazoo* 2024-10-30 13:45:09 -05:00
k00b
da020cf899 complete fantasy scaffolding 2024-10-30 13:44:18 -05:00
Riccardo Balbo
b70dbeb6d6 user vault and server side client wallets 2024-10-30 13:41:09 -05:00
Riccardo Balbo
d9a51f9c1c
Merge branch 'master' into tordev 2024-10-29 11:21:25 +01:00
ekzyis
b50bb2fcc1 Replace unicode currency symbols in inline math 2024-10-28 20:00:00 +01:00
Riccardo Balbo
96e1f86bca use patched authenticatedLndGrpc instead of privoxy to handle non onion grpc traffic 2024-10-26 20:06:22 +02:00
ekzyis
455f6ab665 Merge branch 'master' into blinkreceiver 2024-10-22 21:21:56 +02:00
ekzyis
c97ce2627b Rename to autoWithdrawMaxFeeTotal 2024-10-20 15:14:31 +02:00
ekzyis
596d67fc68 Add max base fee setting 2024-10-20 15:14:31 +02:00
Riccardo Balbo
d45cf99dd4 Add autowithdrawSchemaMembers 2024-10-18 19:17:22 +02:00
ekzyis
6cc49e937b Fix missing autowithdraw settings validation 2024-10-18 18:58:59 +02:00
k00b
1d3ab23ec4 cached fetcher delete key 2024-10-16 14:43:11 -05:00
Riccardo Balbo
ce3ee703df improve validation errors 2024-10-16 19:56:27 +02:00
Riccardo Balbo
14b6d7f818 blink receive 2024-10-16 19:46:33 +02:00
Keyan
245419185f
wallet streaks (#1468)
* wallet streaks backend

* notifications and badges

* reuseable streak fragment

* squash migrations

* push notifications

* update cowboy notification setting label text
2024-10-11 19:14:18 -05:00
k00b
c634c61dd2 cached fetcher debug env var 2024-10-10 09:35:39 -05:00
k00b
adcb80782b caching is hard 2024-10-08 19:26:29 -05:00
k00b
449568e3a2 don't let pending cache to build up 2024-10-08 17:58:15 -05:00
k00b
651053fd71 remove deprecated canonizeResults 2024-10-08 14:25:23 -05:00
k00b
154c0e0a4a fix cache key bloat 2024-10-06 18:56:48 -05:00
k00b
153455983e Revert "Encrypted device sync (#1373)"
This reverts commit a9a566a79f1ce59255f85127a58642beb6b70241.
2024-10-04 15:00:13 -05:00
k00b
65a7ef10d0 make bio work as paid action 2024-10-02 18:39:56 -05:00
Keyan
4ce395889d
Be kind to lnd (#1448)
* cache or remove unecessary calls to lnd

* avoid redundant grpc calls in state machine

* store preimage whenever available

* enhancements post self-code review

* small refinements

* fixes

* fix lnurl-verify

* prevent wallet logger throwing on idb close

* fix promise in race while waiting for payment
2024-10-02 15:03:30 -05:00
Riccardo Balbo
a9a566a79f
Encrypted device sync (#1373)
* user vault

* code cleanup and fixes

* improve ui

* prevent name collisions between users on the same device

* some improvements

* implement storage migration

* comments and cleanup

* make connect button primary instead of warning

* move show passphrase in new line (improvement for small screen devices)

* make show passphrase field readOnly

* fixes

* fix vault key unsync

* implicit migration

* move device sync under  general tab

* fix locally disabled wallets and default wallet selection

* improve text

* remove useless SSR check

* add auth checks

* Rename variables

* Fix missing await

* Refactor local<>vault storage interface

I've changed quite some things here. Attempt of a summary:

* storageKey is now only controlled by useVaultStorageState

I've noticed that dealing with how storage keys are generated (to apply user scope) was handled in two places: the existing wallet code and in the new vault code.

This was confusing and error-prone. I've fixed that by completely relying on the new vault code to generate correct storage keys.

* refactored migration

Migration now simply encrypts any existing local wallets and sends them to the server. On success, the local unencrypted version is deleted.

The previous code seemed to unnecessarily generate new local entries prefixed by 'vault:'.

However, since we either use unencrypted local state OR use the encrypted vault on the server for the data, I didn't see any need for these.

Migration seems to work just as well as before.

* removed unnecessary state

In the <DeviceSync> component, enabled & connected were using a unnecessary combo of useState+useEffect.

They were only using variables that are always available during render so simple assignments were enough.

* other minor changes include:

  * early returns
  * remove unnecessary SSR checks in useEffect or useCallback
  * formatting, comments
  * remove unnecessary me? to expose possible bugs

* Fix missing dependency for useZap

This didn't cause any bugs because useWallet returns everything we need on first render.

This caused a bug with E2EE device sync branch though since there the wallet is loaded async.

This meant that during payment, the wallet config was undefined.

* Assume JSON during encryption and decryption

* Fix stale value from cache served on next fetches

* Add wallet.perDevice field

This adds 'perDevice' as a new wallet field to force local storage. For example, WebLN should not be synced across devices.

* Remove debug buttons

* Rename userVault -> vault

* Update console.log's

* revert some of the migration and key handling changes. restore debug buttons for testing

* Fix existing wallets not loaded

* Pass in localOnly and generate localStorageKey once

* Small refactor of migration

* Fix wallet drag and drop

* Add passphrase copy button

* Fix priorityOnly -> skipTests

* Disable autocompletion for reset confirmation prompt

* Show wrong passphrase as input error

* Move code into components/device-sync.js

* Import/export passphrase via QR code

* Fix modal back button invisible in light mode

* Fix modal closed even on connect error

* Use me-2 for cancel/close button

* Some rephrasing

* Fix wallet detach

* Remove debug buttons

* Fix QR code scan in dark mode

* Don't allow custom passphrases

* More rephrasing

* Only use schema if not enabled

* Fix typo in comment

* Replace 'generate passphrase' button with reload icon

* Add comment about IV reuse in GCM

* Use 600k iterations as recommended by OWASP

* Set extractable to false where not needed

* use-vault fallbacks to local storage only for anonymous users

* fix localStorage reset on logout

* add copy button

* move reset out of modals

* hide server side errors

* hardened passphrase storage

* do not show passphrase even if hardened storage is disabled (ie. indexeddb not supported)

* show qr code button on passphrase creation

* use toast for serverside error

* Move key (de)serialization burden to get/setLocalKey functions

* password textarea and remove qr

* don't print plaintext vault values into console

---------

Co-authored-by: ekzyis <ek@stacker.news>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: k00b <k00b@stacker.news>
2024-10-01 14:55:01 -05:00
k00b
2e1a7c1035 don't allow other markup in headings 2024-09-29 11:25:01 -05:00
k00b
80a7c24e54 recognize nostr entities 2024-09-28 18:56:37 -05:00
k00b
f7010ee3f7 fix #663 2024-09-28 18:20:33 -05:00