breez / breez-sdk-greenlight

MIT License
243 stars 43 forks source link

SDK throws an error on seed mismatch to stored credentials #374

Open dangeross opened 1 year ago

dangeross commented 1 year ago

When trying to connect the SDK with a seed different to the encrypted credential, SDK throws an error:

Failed to decrypt credentials, seed doesn't match existing node

This can be handled by creating a different working directory for the SDK to use with the different seed, but that is not immediately obvious to a developer.

ok300 commented 1 year ago

How about, if that happens, we delete the local sql files and re-populate them based on the new seed?

I find myself doing this a lot during tests, when switching between wallets.

It can be made configurable, or with a new flag added to connect.

ok300 commented 1 year ago

Alternatively, we could store the DB files in a per-wallet subfolder, whose name is derived from the seed (HD wallet fingerprint).

Each new restore would then access the files from the matching DB, or create a new subfolder.

dangeross commented 1 year ago

Alternatively, we could store the DB files in a per-wallet subfolder, whose name is derived from the seed (HD wallet fingerprint).

Each new restore would then access the files from the matching DB, or create a new subfolder.

This would better suit the multi-instance scenario, where different HWW determine the seed. I think Roy mentioned also having a method to clear the state cache for a particular seed (or with an optional flag when calling disconnect)

roeierez commented 1 year ago

This would better suit the multi-instance scenario, where different HWW determine the seed. I think Roy mentioned also having a method to clear the state cache for a particular seed (or with an optional flag when calling disconnect)

I like this approach.