diff --git a/src/main/scala/Components.scala b/src/main/scala/Components.scala index 19903a7..a7290bc 100644 --- a/src/main/scala/Components.scala +++ b/src/main/scala/Components.scala @@ -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"))) diff --git a/src/main/scala/Main.scala b/src/main/scala/Main.scala index fe17d60..3a6007b 100644 --- a/src/main/scala/Main.scala +++ b/src/main/scala/Main.scala @@ -63,6 +63,15 @@ object Main extends IOWebApp { .printWith(jsonPrinter) ) )) + ), + button( + Styles.button, + "generate keypair", + onClick --> (_.foreach(_ => + store.input.set( + NIP19.encode(PrivateKey(randomBytes32())) + ) + )) ) )