Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronous backups #166

Merged
merged 25 commits into from
Oct 4, 2023
Merged

Synchronous backups #166

merged 25 commits into from
Oct 4, 2023

Conversation

Jasonvdb
Copy link
Collaborator

@Jasonvdb Jasonvdb commented Sep 1, 2023

Enables apps using react-native-ldk to securely persist node state remotely and restore it using a seed. Backups now happen synchronously in the native code instead of unreliable async RN events to trigger backups.

Clients in Swift, Kotlin, and NodeJS (for testing).

See server readme for details on setting up and how it works.

Testing:

Once server is setup update constants.ts in the example app with the server details.

Server test: npm run test

App test: Try restore from server button in example app.

@Jasonvdb Jasonvdb marked this pull request as draft September 1, 2023 12:24
fix: returning bearer in magic link

code fix
@Jasonvdb Jasonvdb marked this pull request as ready for review October 2, 2023 10:27
@Jasonvdb Jasonvdb requested a review from coreyphillips October 2, 2023 10:28
chore: removed default backup server details

fix: removed slashauth

fix: remove test code
@coreyphillips
Copy link
Collaborator

After performing the following steps in the example app.

  1. Tap "Create New Account"
  2. Tap "Backup self check"

The following error is received:

LOG  react-native-ldk: Error: Failed to decrypt backup payload. The operation couldn’t be completed. (CryptoKit.CryptoKitError error 3.).
Message: 'Failed to decrypt backup payload. The operation couldn’t be completed. (CryptoKit.CryptoKitError error 3.)'
ERROR  Backup check failed [Error: Failed to decrypt backup payload. The operation couldn’t be completed. (CryptoKit.CryptoKitError error 3.)]

@Jasonvdb
Copy link
Collaborator Author

Jasonvdb commented Oct 4, 2023

Nice find thanks @coreyphillips. It was the cached bearer token from the previous wallet that just needed to be cleared here.

When creating the new wallet the backup client still had the bearer token from the previous wallet and if that didn't expire it tried to use that token to restore the wrong file but couldn't decrypt it because wallet's seed changed.

coreyphillips
coreyphillips previously approved these changes Oct 4, 2023
@Jasonvdb Jasonvdb merged commit e2b159f into master Oct 4, 2023
2 of 6 checks passed
@Jasonvdb Jasonvdb deleted the sync-backup branch October 4, 2023 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants