That’s pretty good, i was just doing something very similar on nostr-editor by exposing a sign function to do exact that
What’s nostr-editor?
A wysiwyg editor to create notes in a nice way, also a content parser for existing notes, but still in the works as I finish media uploads https://github.com/cesardeazevedo/nostr-editor