nostr-protocol / nips

Nostr Implementation Possibilities
2.39k stars 578 forks source link

Best way to propose adding `window.nostr.signSchnorr()` #292

Open dannydeezy opened 1 year ago

dannydeezy commented 1 year ago

Recently Alby added the function window.nostr.signSchnorr to their nostr key manager to enable us to turn a nostr key into a bitcoin wallet with nosft.

I'd like to formally propose window.nostr.signSchnorr() for other key managers - what's the best way to do this? Another NIP? an extension on an existing NIP?

chendatony31 commented 1 year ago

Same, adding window.nostr.signEth may turn it into an ethereum wallet. lol

dannydeezy commented 1 year ago

Same, adding window.nostr.signEth may turn it into an ethereum wallet. lol

hey now nobody is suggesting that :)

bloXmove commented 1 year ago

Why not, actually? signEth() would be awesome. Is anybody (willing to) work on that?

fiatjaf commented 1 year ago

After thinking too much about this my conclusion is that it is an inversion of concerns (or whatever is the correct expression). This is a Bitcoin wallet functionality, not a Nostr functionality. Therefore it makes more sense for a Bitcoin wallet to implement importing a Nostr key and using it as a Bitcoin key than the opposite.

Alby is a Bitcoin wallet, so it may make sense there -- although I think it shouldn't live in the nostr namespace.

chendatony31 commented 1 year ago

After thinking too much about this my conclusion is that it is an inversion of concerns (or whatever is the correct expression). This is a Bitcoin wallet functionality, not a Nostr functionality. Therefore it makes more sense for a Bitcoin wallet to implement importing a Nostr key and using it as a Bitcoin key than the opposite.

Alby is a Bitcoin wallet, so it may make sense there -- although I think it shouldn't live in the nostr namespace.

Agreed, should inject and use multi namespaces if support different protocols, such as window.nostr, window.bitcoin, window.ethereum, and so on. And that is what our wallet (TokenPocket) going to do.

bloXmove commented 1 year ago

I agree that the container here is the wallet not nostr. Can you point me to the git of TokenPocket then? Note: if one is to enter the Ethereum wallet space web3 and preferably WalletConnect connectivity is a must. As is the ability to hold at least ERC20 - preferably also ERC721. Otherwise there will be zero take up

chendatony31 commented 1 year ago

I agree that the container here is the wallet not nostr. Can you point me to the git of TokenPocket then? Note: if one is to enter the Ethereum wallet space web3 and preferably WalletConnect connectivity is a must. As is the ability to hold at least ERC20 - preferably also ERC721. Otherwise there will be zero take up

https://github.com/tp-lab, But the namespace I said above is still under development. I think we will be ready when March end, which will support using eth wallet to sign both ETH transactions and nostr messages.

bloXmove commented 1 year ago

May I ask which of the 118 repos? 😀

tegila commented 1 year ago

We still need some new kind specification where we can broadcast blockchain transactions over nostr relays, filtering by #e: Pubkey we can easily lightweight the use of blockchain on mobile phone and even bypass lightning as a HTLC relay broadcaster

ananth99 commented 1 year ago

Looking to use my eth wallet to sign nostr messages. Are there any NIPs for it atm?

fiatjaf commented 1 year ago

@ananth99 https://gist.github.com/fiatjaf/7caab6c354b74a97160b3bb666d2e19e

alexgleason commented 9 months ago

What we really need is Brave Browser to implement a signSchnorr (or better yet, window.nostr) in their wallet extension. Then all users of Brave will have an in-browser onboarding mechanism for Nostr, including secure storage of private keys. Including on mobile devices.

Brave Wallet is an extensively modified fork of Metamask from before they changed the license. I've been thinking about some clever way we could possibly utilize the Metamask API (window.ethereum) to sign Nostr events, but it doesn't seem possible. We could implement getPublicKey(), but not signEvent()

EDIT: Metamask's personal_sign lets you sign an arbitrary string, but they prefix the string with 0x first so you can't actually do anything useful with it except confirm that the user has signed the string.

alexgleason commented 9 months ago

Btw, Trezor Wallet is against adding a generic signSchnorr method for security reasons. I didn't really get it, but I was surprised Alby did allow it after reading this from the Trezor devs:

It's not possible to sign an arbitrary message with any sort of signature scheme by Trezor.

It would be really stupid to allow this: if the message is arbitrary, you can stuff in, say, a valid Bitcoin transaction. Then it's a matter of crafting a clever malware, telling the user: "Security check: please confirm the following characters on your Trezor screen to validate your wallet", and stealing their money.

Check: https://www.reddit.com/r/TREZOR/comments/vrftwn/schnorr_signature_api/

Egge21M commented 9 months ago

Btw, Trezor Wallet is against adding a generic signSchnorr method for security reasons. I didn't really get it, but I was surprised Alby did

I guess this is only a concern if keys managed by the provider also "own" on-chain bitcoin. And aren't providers secured against this anyways because they promote the user to confirm the signature?

bumi commented 9 months ago

re trezor: I guess it's a question of what you try to achieve and what's the attack vector. I don't really think one should set a hardware bitcoin wallet equal to nostr. You'll always have a bit of the conflict between usability and making features possible vs. security.

trezor's case is a different one than what we mostly do with a nostr key.