damus.io

damus.io website
git clone git://jb55.com/damus.io
Log | Files | Refs

commit 9f51669735dbb91f5fbb0295379f1f2bf02edf59
parent 9788baa322b2c4dd7d5771c3fa17c8d3d937eaf9
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 22 Aug 2022 16:54:17 -0700

key updates

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mkey/index.html | 8+++++++-
Mkey/key.js | 12++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/key/index.html b/key/index.html @@ -36,9 +36,15 @@ <label for="bech32">hex key</label> <input type="text" class="u-full-width" placeholder="" id="hex-key"> + + <div> + <h2>Links</h2> + <a id="note-link" href="">Damus Note Link</a><br/> + <a id="profile-link" href="">Damus Profile Link</a> + </div> </div> <script src="bech32.js" ></script> - <script src="key.js" ></script> + <script src="key.js?v=3" ></script> </body> </html> diff --git 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()