Let users add a verified nostr pubkey to their account #101

Merged
raucao merged 14 commits from feature/98-nostr_nip05 into master 2023-06-16 13:04:24 +00:00
Owner

Add a settings page (for experimental settings) that can verify and save nostr pubkeys for user accounts. It currently only allows adding keys from a browser extension, but not from manual signing outside of the browser.

This can then be used for:

  • #98NIP-05 user addresses (i.e. make your pubkey discoverable via your username@kosmos.org address)
  • #99 — Two-factor authentication
  • Notifications of all kinds (via encrypted DM)
  • Auth for publishing events to a potential Kosmos relay

Note: tagged WIP, because without any of the above-mentioned features, this is currently not useful to anyone. Adding the NIP-05 endpoint is the first and easiest feature to base on top of this now.

Update: NIP-05 support has been added in the meantime, see comments and commits.

closes #98

Add a settings page (for experimental settings) that can verify and save nostr pubkeys for user accounts. It currently only allows adding keys from a browser extension, but not from manual signing outside of the browser. This can then be used for: * #98 — [NIP-05](https://github.com/nostr-protocol/nips/blob/master/05.md) user addresses (i.e. make your pubkey discoverable via your username@kosmos.org address) * #99 — Two-factor authentication * Notifications of all kinds (via encrypted DM) * Auth for publishing events to a potential Kosmos relay Note: tagged WIP, because without any of the above-mentioned features, this is currently not useful to anyone. Adding the NIP-05 endpoint is the first and easiest feature to base on top of this now. Update: NIP-05 support has been added in the meantime, see comments and commits. closes #98
raucao added the
feature
label 2023-03-09 03:52:04 +00:00
raucao requested review from bumi 2023-03-09 06:32:30 +00:00
bumi reviewed 2023-03-10 21:00:27 +00:00
Gemfile Outdated
@ -49,2 +49,4 @@
gem 'sidekiq-scheduler'
# Services
gem 'nostr', git: 'https://gitea.kosmos.org/kosmos/nostr-gem.git', branch: 'feature/ruby_2.7_compat'
Owner

adds quite some dependencies (like the websocket stuff) but I guess it's fine here as it is not conflicting with any dependencies that we already have.

adds quite some dependencies (like the websocket stuff) but I guess it's fine here as it is not conflicting with any dependencies that we already have.
Author
Owner

Yeah, the idea is that we can very easily add more nostr features using the same library.

Yeah, the idea is that we can very easily add more nostr features using the same library.
raucao marked this conversation as resolved
@ -30,3 +30,2 @@
scope :confirmed, -> { where.not(confirmed_at: nil) }
scope :pending, -> { where(confirmed_at: nil) }
validates_uniqueness_of :nostr_pubkey, scope: :ou, allow_blank: true
Owner

why the scope :ou?

why the `scope :ou`?
Author
Owner

It was supposed to be so that you can add the same key for accounts with different domains, but actually now that you mention it, I think it should always be unique, since you can only point back to one of them anyway.

It was supposed to be so that you can add the same key for accounts with different domains, but actually now that you mention it, I think it should always be unique, since you can only point back to one of them anyway.
raucao marked this conversation as resolved
@ -33,0 +32,4 @@
scope :confirmed, -> { where.not(confirmed_at: nil) }
scope :pending, -> { where(confirmed_at: nil) }
scope :all_except, -> (user) { where.not(id: user) }
Owner

does this need where.not(id: user.id) ?

does this need `where.not(id: user.id)` ?
Author
Owner

It's magic. ;)

It's magic. ;)
raucao marked this conversation as resolved
Owner

wondering if any other nip05 provider implements this that well currently

wondering if any other nip05 provider implements this that well currently
Author
Owner

wondering if any other nip05 provider implements this that well currently

Thanks. I was wondering the same. :)

I addressed your comments and resolved the one about the uniqueness validation.

> wondering if any other nip05 provider implements this that well currently Thanks. I was wondering the same. :) I addressed your comments and resolved the one about the uniqueness validation.
raucao added the
kredits-2
label 2023-04-13 10:52:59 +00:00
raucao changed title from WIP: Let users add a verified nostr pubkey to their account to Let users add a verified nostr pubkey to their account 2023-04-13 12:45:08 +00:00
Author
Owner

This is now ready to merge. I have adjusted all the code to the refactored user settings routes and controller, as well as resolved the other merge conflicts.

Also, NIP-05 support was added a few weeks ago, so it's actually useful now. And I also just added a hint for users to update their public profile with the address, which is visible when a pubkey has been added.

This is now ready to merge. I have adjusted all the code to the refactored user settings routes and controller, as well as resolved the other merge conflicts. Also, NIP-05 support was added a few weeks ago, so it's actually useful now. And I also just added a hint for users to update their public profile with the address, which is visible when a pubkey has been added.
raucao force-pushed feature/98-nostr_nip05 from caeb13974c to bfc0969829 2023-06-16 12:40:44 +00:00 Compare
raucao added 1 commit 2023-06-16 12:55:21 +00:00
Fix path
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Release Drafter / Update release notes draft (pull_request) Successful in 4s
4551a14362
raucao removed review request for bumi 2023-06-16 13:04:14 +00:00
raucao merged commit 1b959b5643 into master 2023-06-16 13:04:24 +00:00
raucao deleted branch feature/98-nostr_nip05 2023-06-16 13:04:25 +00:00
Sign in to join this conversation.
No description provided.