nostr implementation and signer improvement #103
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
signer abstraction
Signer are abstracted to a common interface ( NostrSigner ) so that they can be initialized once (on login/registration) and then passed around the app without worrying about their nature.
It removed the need to branch and duplicate the code for every signer type ie.
signer challenges
At any time signers can trigger a challenge that will automatically open a modal with the instructions to complete it, following the reactive flow model.
This is used to implement nip46 auth challenge and also to request nsec passphrases.
All the input fields requesting the passphrase for signMethod=="nsec" have been removed, since the signer can request it on its own via the challenge, making the code slimmer.
option to remember the nsec passphrase
small quality of life improvement
improved nostr managment
A new NostrManager and nostr context are used to manage connections lifecycle and a fetch() method that autocloses the subscriptions on eose has been added.
Every event is now verified by NostrManager, so there is no need to call verifyEvent every time anymore.