From 9f51669735dbb91f5fbb0295379f1f2bf02edf59 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Mon, 22 Aug 2022 16:54:17 -0700 Subject: [PATCH] key updates Signed-off-by: William Casarin --- key/index.html | 8 +++++++- key/key.js | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/key/index.html b/key/index.html index 1274066..5fcf681 100644 --- a/key/index.html +++ b/key/index.html @@ -36,9 +36,15 @@ + +
+

Links

+ Damus Note Link
+ Damus Profile Link +
- + diff --git a/key/key.js b/key/key.js index 3288512..9dff6c1 100644 --- a/key/key.js +++ b/key/key.js @@ -21,12 +21,24 @@ function hex_encode(buf) function go() { const el = document.querySelector("#damus-key") const hex_el = document.querySelector("#hex-key") + const note_link_el = document.querySelector("#note-link") + const profile_link_el = document.querySelector("#profile-link") el.addEventListener("input", () => { const decoded = bech32.decode(el.value) const bytes = fromWords(decoded.words) hex_el.value = hex_encode(bytes) + update_note_link(hex_el.value) }); + + hex_el.addEventListener("input", () => { + update_note_link(hex_el.value) + }) + + function update_note_link(id) { + note_link_el.href = `nostr:e:${id}` + profile_link_el.href = `nostr:p:${id}` + } } go()