-
Notifications
You must be signed in to change notification settings - Fork 195
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
feat: move nostr key to accounts #1964
Conversation
I left the |
🚀 Thanks for the pull request! Here are the current build files for testing: Download and unzip the file for your browser. Refer to the readme for detailed install instructions. This build is brought to you by: Want to sponsor the next build? send some sats to ⚡️builds@getalby.com (don't forget to provide your name) Don't forget: keep earning sats! |
Should work now! |
@@ -13,8 +13,20 @@ const defaultProps = { | |||
}; | |||
|
|||
const mockAccounts: Accounts = { | |||
"1": { id: "1", connector: "lnd", config: "", name: "LND account" }, | |||
"2": { id: "2", connector: "galoy", config: "", name: "Galoy account" }, | |||
"1": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In another PR these could be moved to, right?:
https://github.com/getAlby/lightning-browser-extension/tree/task-nostr-account/tests/fixtures
Also these should be moved there, not sure why these neded up in src
:
https://github.com/getAlby/lightning-browser-extension/tree/task-nostr-account/src/fixtures
Maybe adding the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good progress! let's add some tests and then ship this!
src/app/screens/Account.tsx
Outdated
} | ||
|
||
function generatePublicKey(priv: string) { | ||
const nostr = new Nostr(priv); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be done via a msg.request...
instead of importing Nostr from the background script?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nostr
is just a utility class that is used to generate the public key from the private key. But you raised a good point. Maybe the Nostr
class should be moved outside of the background-script
folder. (maybe into src/common/utils
?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should, we need some good folder structure. (I dislike "utils" because those are mostly bins for everything).
const account = accounts[id]; | ||
account.nostrPrivateKey = privateKey | ||
? encryptData(privateKey, password) | ||
: null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should do a special "delete" action to remove the key and not do this by setting the private key to null. I would think that having a special key would prevent the user a bit better from accidentially deleting it.
|
Since the avatars PR #1992 is now also merged, can we replace the default avatar on the detail page as well? |
Whoops! Did you use a "nsec" string? It expects a hex string as a private key. Not really sure if we should also accept "nsec" directly. (cc @bumi) But yes, will be adding a toast to specify the requirement! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some minor comments
Describe the changes you have made in this PR
This removes the nostr key in settings (which is being used globally across all accounts) and adds functionality for accounts to have nostr keys instead
Link this PR to an issue [optional]
Fixes #1934
Type of change
(Remove other not matching type)
feat
: New feature (non-breaking change which adds functionality)Screenshots of the changes [optional]
Account Page
Settings
Accounts Page
How has this been tested?
Tested manually
Checklist