Commit Graph

85 Commits

Author SHA1 Message Date
k00b dccfd21be4 make sure autowithdraw members are numbers 2024-10-31 18:25:15 -05:00
k00b 14ab51a730 fixes related to p2p zaps 2024-10-31 18:12:55 -05:00
k00b 7b4a33b354 fix wallet creation without vaultEntries 2024-10-31 17:54:47 -05:00
k00b b8216740d4 final touches 2024-10-31 14:06:58 -05:00
k00b 3cfbaf4638 validate generated fields 2024-10-30 22:26:45 -05: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 84f5db4488 update wallet readme 2024-10-30 13:49:57 -05:00
k00b e96982c353 refactor wallet validation 2024-10-30 13:49:57 -05:00
k00b 57603a936f reorder priority 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 48640cbed6 pages load *kazoo* 2024-10-30 13:45:05 -05:00
k00b da020cf899 complete fantasy scaffolding 2024-10-30 13:44:18 -05:00
k00b b61c957cc7 fix missing field from merge conflict resolution 2024-10-30 13:42:55 -05:00
Riccardo Balbo 1e68182cda sender wallets: only test if enabled 2024-10-30 13:42:55 -05:00
Riccardo Balbo 00c047f09b do not drop config on error (might be caused by temporary connection issues) 2024-10-30 13:42:55 -05:00
Riccardo Balbo 623b69df3a skip wallet fetch for anon users 2024-10-30 13:42:55 -05:00
Riccardo Balbo de0eb8a52c ensure that wallets are configured to send and/or receive 2024-10-30 13:42:55 -05:00
Riccardo Balbo 240040f2a3 ensure wallets are kept in-sync between clients 2024-10-30 13:41:41 -05:00
Riccardo Balbo 1beac3a405 ensure wallet id is in sync before saving the config 2024-10-30 13:41:41 -05:00
Riccardo Balbo a6665bca6a fix priority sorting for send wallets,caching and sorting 2024-10-30 13:41:41 -05:00
Riccardo Balbo 40f24236fd show enabled only if configured to receive or send (handle client settings wipe) 2024-10-30 13:41:41 -05:00
Riccardo Balbo 2ef7651421 optimize api calls, remove useless effects 2024-10-30 13:41:41 -05:00
Riccardo Balbo aded5ac422 fixes 2024-10-30 13:41:41 -05:00
Riccardo Balbo 87c5634b55 add debug log 2024-10-30 13:41:41 -05:00
Riccardo Balbo d30502a011 fix wallet filtering 2024-10-30 13:41:41 -05:00
Riccardo Balbo 4fce6fa234 Fix for enabled but not available wallets 2024-10-30 13:41:41 -05:00
Riccardo Balbo 6bd07284a5 optimize api calls 2024-10-30 13:41:41 -05:00
Riccardo Balbo 4aa9608212 fixed and add wallet migration 2024-10-30 13:41:41 -05:00
Riccardo Balbo a95e4cd6e9 collect meta from server config 2024-10-30 13:41:41 -05:00
Riccardo Balbo 4604a7bac9 use SSR constant 2024-10-30 13:41:41 -05:00
Riccardo Balbo b70dbeb6d6 user vault and server side client wallets 2024-10-30 13:41:09 -05:00
Keyan d146e50660
Merge branch 'master' into max-base-fee 2024-10-20 18:25:16 -05:00
Keyan 6049baf742
Merge branch 'master' into local-dev-lnbits-recv 2024-10-20 17:38:57 -05:00
ekzyis 88fa3bdca6 Fix autoWithdrawThreshold saved in send config 2024-10-20 15:19:53 +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
ekzyis 1f9ab08228 Add comments 2024-10-19 22:36:26 +02:00
ekzyis 69c80e3d5c Fix wallet client validation 2024-10-19 22:33:37 +02:00
k00b aba212f6ec don't abort on blinded path feature bits 2024-10-17 14:23:03 -05:00
ekzyis 75051f1c56 LNbits updates for local dev
* persistent lnbits db with lnbits superuser
* map localhost:5001 -> lnbits:5000 in local dev for LNbits receives
* updated ATTACH.md
2024-10-17 20:54:07 +02:00
k00b 6aac9eeed4 update breaking change in estimateRouteFee 2024-10-17 13:25:49 -05:00
k00b 154c0e0a4a fix cache key bloat 2024-10-06 18:56:48 -05:00
k00b 177e0f6bb0 fix #1453 2024-10-05 13:57:55 -05:00
k00b 153455983e Revert "Encrypted device sync (#1373)"
This reverts commit a9a566a79f.
2024-10-04 15:00:13 -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