Oddbean new post about | logout
 Should i use #NDK or #nostr-tools for nip-07? I am working with some existing express common js code and no ES6 modules. Not sure i should use webpack or rollup with ndk. 

to be used in a <script> tag client side html, not server side. 

Any advice appreciated #asknostr 
 I used nostr tool, seemed more simple and I think there are more examples of nip07 extensions 
 yep i was looking at  this snippet

https://m.primal.net/IIWT.png 

Seemed like a much more straightfoward option than trying to force an ES6 into a bundler and then out to <script> tag but I really don't know enough about bundling js modules NDK or if its possible to use like this <script src=" https://unpkg.com/nostr-dev-kit@0.0.3/dist/cjs/index.js"></script> without the type="module" option
 
 Introducing the nostr-tools Compiler!

it will compile your JS code, fixing your bugs and outputting more JS code that then you pass to your bundler, minifier, modularizer. 
 😂  
  I see your little thingy here https://github.com/fiatjaf/window.nostr.js

I don't know why you didn't bother to mention it 
 There's another thingy at https://github.com/nostrband/nostr-login  
 I tried this and I like it. 

Is it possible to remove the read-only option? 

There are some applications I am thinking of where you need everyone to read and write, not just read.  
 Oh yeah I need to be able to select available modes myself too, will ping you when it's ready. 
 noticed some oddities, but will DM you 
 I published a new nostr-login version, there's now a data-methods option, a list of comma separated allowed auth methods, you can specify 'connect,extension' to exclude 'readOnly'. 
 Ok. Im using the <script> bundle version of it. Will let you know if any issues.  Thanks for the update. Ill share with you my app rsn 
 Awesome! 
 hmmm it appears to be 

data-methods="extension,connect" 

the order matters, as the other way around with connect first  in the string there is no extension, e.g. data-methods="connect, extension"

 https://m.primal.net/IZuQ.png  
 I didn't know that was what you were looking for, sorry. 
 But this thing, as well as https://github.com/nostrband/nostr-login, only provide the signing stuff. 
 do you think it would be a bad idea to include the nip7 type declared in nostr-tools? I mean, with no js, just the interface, so we dev could declare in the browser environment manually, like this:

https://m.primal.net/IJPZ.png 

When I need nip07 I put a nip07 interface locally in each application
https://m.primal.net/IJPX.png  
 Yes, I think it's a very good idea. 
 What about having an actual module called nip07 with actual functions in it, just calling window.nostr on the back? 
 As far as I understand the real implementation in javascript is injected by the extension, am I wrong? But they cannot provide the typescript interface 
 If it had a proper solution to races then yes please! 
 You know I'm something of a racist myself. 
 Huh.? 
 Me and @Decentralized Dad laughed. 
 I got it, you mean to create an exportable nip7 non related to window but that talks to the window.nostr, that's it?

I think the interface is enought to me.

Can I open an issue about this in nostr-tools? 
 No, you can open a PR. 
 Valeu mano, vou abrir 
 There is no other way, you must use Vite.

Actually don't even try to configure your own bundlers, you must use these bloated boilerplate things that they make for you today. Then you ask the AI to fill in the rest of the code and go home with a shiny new app that does the average of all the other apps. 
 😂  Goddamn what happend to KISS