key updates

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin 2022-08-22 16:54:17 -07:00
parent 9788baa322
commit 9f51669735
2 changed files with 19 additions and 1 deletions

View file

@ -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()