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

feat: use nip44 and versioning #834

Merged
merged 20 commits into from
Jan 9, 2025
Merged

feat: use nip44 and versioning #834

merged 20 commits into from
Jan 9, 2025

Conversation

im-adithya
Copy link
Member

@im-adithya im-adithya commented Nov 29, 2024

Fixes #737

Ready for review (use getAlby/js-sdk#273)

  • Notifications are published twice (with nip-04 and nip-44)(so nip-44 doesn't work currently as the relays block 23917 kind) (Fixed by Fernando)
  • Tests are to be added/modified (Done)

@im-adithya im-adithya requested review from rolznz and bumi and removed request for rolznz November 29, 2024 14:59
@frnandu
Copy link
Contributor

frnandu commented Nov 29, 2024

spec PR needs to adapt to the notifications (legacy and new) nostr-protocol/nips#1531

nip47/event_handler.go Outdated Show resolved Hide resolved
nip47/event_handler.go Outdated Show resolved Hide resolved
nip47/event_handler.go Outdated Show resolved Hide resolved
nip47/event_handler.go Outdated Show resolved Hide resolved
@rolznz
Copy link
Contributor

rolznz commented Dec 17, 2024

@im-adithya it would be good to add some tests, especially for any changes in the event_handler. It's critical that this is working and no vulnerabilities are added.

@im-adithya
Copy link
Member Author

Feedback is addressed, only have to agree on the isVersionSupported function in cipher (currently it is a bit too complicated but is future-proof)

Also have to add tests.

@rolznz
Copy link
Contributor

rolznz commented Jan 2, 2025

@im-adithya if you also add some tests for isVersionSupported to ensure it passes the versions we support maybe it is ok for now and we don't need to simplify it (since you already wrote it)

@rolznz
Copy link
Contributor

rolznz commented Jan 3, 2025

I wonder if it's good to add the NIP-47 version to the app table, and default to 0.0 for existing entries. We do not republish info events for apps on startup. Later we might want to show which connections EDIT: did not signal they support NIP-44 so that the user can remove them and re-add them? CC @reneaaron @frnandu @bumi

tests/create_app.go Outdated Show resolved Hide resolved
nip47/event_handler_test.go Outdated Show resolved Hide resolved
db/models.go Outdated Show resolved Hide resolved
nip47/cipher/cipher.go Outdated Show resolved Hide resolved
nip47/event_handler_test.go Outdated Show resolved Hide resolved

relay.PublishedEvent = nil
relay.PublishedEvents = nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be an empty array?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is of type []*nostr.Event

nip47/event_handler_test.go Outdated Show resolved Hide resolved
nip47/event_handler_test.go Outdated Show resolved Hide resolved
walletPrivKey, err := svc.keys.GetAppWalletKey(app.ID)
_, err = svc.GetNip47Service().PublishNip47Info(ctx, relay, *app.WalletPubkey, walletPrivKey, svc.lnClient)
if err != nil {
logger.Logger.WithError(err).WithFields(logrus.Fields{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frnandu it's ok if we just log an error and proceed here, right?

Copy link
Contributor

@rolznz rolznz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK

@rolznz rolznz merged commit 94c209a into master Jan 9, 2025
9 checks passed
@rolznz rolznz deleted the task-nip44 branch January 9, 2025 11: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.

Implement versioning and NIP-44 support
3 participants