auto-compute pubkey from when set manually #14

Closed
opened 2 years ago by x1ddos · 8 comments
x1ddos commented 2 years ago
Owner

i already had a private key from elsewhere, so went to "profile" and copy&pasted it, erasing the pubkey:

image

but the app says "public-key corresponds to private-key". i would've expected it to auto-compute the pubkey from my manual private input using getPublicKey.

@offbyn wdyt?

i already had a private key from elsewhere, so went to "profile" and copy&pasted it, erasing the pubkey: ![image](/attachments/26ee6d55-895c-4a7a-adb9-8e83dfc99b5e) but the app says "public-key corresponds to private-key". i would've expected it to auto-compute the pubkey from my manual private input using [getPublicKey](https://github.com/jb55/nostr-js#getpublickeyprivkey). @offbyn wdyt?
x1ddos commented 2 years ago
Poster
Owner

oh, shouldn't this text:

public-key corresponds to private-key

actually say something like "pubkey does NOT correspond to private key"?

oh, shouldn't this text: > public-key corresponds to private-key actually say something like "pubkey does NOT correspond to private key"?
offbyn commented 2 years ago
Owner

good catch, it should definetly not show "public-key corresponds to private-key" lol.

opened a pr to fix the validation part.

good catch, it should definetly not show "public-key corresponds to private-key" lol. opened a pr to fix the validation part.
offbyn commented 2 years ago
Owner

the pubkey input field is currently only set:

  • when user generates a new key
  • onload taken from localstorage

it could also generate and update the pubkey input when user changes private key input field.

on the other hand: if a user copies a pubkey and then the private key and they for some reason don't correspond, I would expect an error and no automatic generation.

the pubkey input field is currently only set: - when user generates a new key - onload taken from localstorage it could also generate and update the pubkey input when user changes private key input field. on the other hand: if a user copies a pubkey and then the private key and they for some reason don't correspond, I would expect an error and no automatic generation.
x1ddos commented 2 years ago
Poster
Owner

it could also generate and update the pubkey input when user changes private key input field.

exactly!

on the other hand: if a user copies a pubkey and then the private key and they for some reason don't correspond, I would expect an error and no automatic generation.

how about generating and setting the pubkey the moment "save" button is clicked, only if the private key input is set and pubkey is empty?

but the save button is disabled if the keys don't match 🤔

or how about it turning pubkey input into a div or span, i.e. no user input? then you'd always have to input or generate the private key.

> it could also generate and update the pubkey input when user changes private key input field. exactly! > on the other hand: if a user copies a pubkey and then the private key and they for some reason don't correspond, I would expect an error and no automatic generation. how about generating and setting the pubkey the moment "save" button is clicked, only if the private key input is set and pubkey is empty? but the save button is disabled if the keys don't match 🤔 or how about it turning pubkey input into a div or span, i.e. no user input? then you'd always have to input or generate the private key.
offbyn self-assigned this 2 years ago
offbyn commented 2 years ago
Owner

or how about it turning pubkey input into a div or span, i.e. no user input? then you'd always have to input or generate the private key.

I thought by using pubkey only one could use nostrweb as watch-only client. I'll need to play around a bit more.

> or how about it turning pubkey input into a div or span, i.e. no user input? then you'd always have to input or generate the private key. I thought by using pubkey only one could use nostrweb as watch-only client. I'll need to play around a bit more.
x1ddos commented 2 years ago
Poster
Owner

right. here's another idea: have 2 modes. watch-only or normal, something where a user can flip a switch.

in watch-only, the private key input disappears completely. in normal mode, pubkey is a div/span, not an input.

right. here's another idea: have 2 modes. watch-only or normal, something where a user can flip a switch. in watch-only, the private key input disappears completely. in normal mode, pubkey is a div/span, not an input.
offbyn commented 2 years ago
Owner

yep a setting for watch only makse sense..

here is a more conservative approach to "generate and update the pubkey input when user changes private key input field." in #24 it only updates the pubkey field if it was empty and currently only on paste event.

I think on paste might be enough.

another alternative is to have a small button similar to "show private key" to activelly calculate the pubkey at any time.

yep a setting for watch only makse sense.. here is a more conservative approach to "generate and update the pubkey input when user changes private key input field." in https://git.qcode.ch/nostr/nostrweb/pulls/24 it only updates the pubkey field if it was empty and currently only on paste event. I think on paste might be enough. another alternative is to have a small button similar to "show private key" to activelly calculate the pubkey at any time.
x1ddos added this to the mvp project 2 years ago
x1ddos added the
feature
label 2 years ago
x1ddos commented 2 years ago
Poster
Owner

i think it's done for now. let's iterate and improve later.

i think it's done for now. let's iterate and improve later.
x1ddos closed this issue 2 years ago
x1ddos added this to the mvp milestone 2 years ago
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: nostr/nostrweb#14
Loading…
There is no content yet.