generate keypair and display nsec.

This commit is contained in:
fiatjaf 2023-03-25 09:49:33 -03:00
parent 7633eb3615
commit c2a826e854
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1
2 changed files with 10 additions and 0 deletions

View File

@ -80,6 +80,7 @@ object Components {
div(
cls := "text-md",
sk.map { k => entry("private key (hex)", k.value.toHex) },
sk.map { k => entry("nsec", NIP19.encode(k)) },
entry("public key (hex)", pp.pubkey.value.toHex),
if pp.relays.size > 0 then
Some(entry("relay hints", pp.relays.reduce((a, b) => s"$a, $b")))

View File

@ -63,6 +63,15 @@ object Main extends IOWebApp {
.printWith(jsonPrinter)
)
))
),
button(
Styles.button,
"generate keypair",
onClick --> (_.foreach(_ =>
store.input.set(
NIP19.encode(PrivateKey(randomBytes32()))
)
))
)
)