Update nostr gem, switch to Ruby for bech32 encoding
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
import { bech32 } from "bech32"
|
||||
|
||||
function hexToBytes (hex) {
|
||||
let bytes = []
|
||||
@@ -15,10 +14,6 @@ export default class extends Controller {
|
||||
static values = { userAddress: String, pubkeyHex: String, sharedSecret: String }
|
||||
|
||||
connect () {
|
||||
if (this.hasPubkeyHexValue && this.pubkeyHexValue.length > 0) {
|
||||
this.pubkeyBech32InputTarget.value = this.pubkeyBech32
|
||||
}
|
||||
|
||||
if (window.nostr) {
|
||||
if (this.hasSetPubkeyTarget) {
|
||||
this.setPubkeyTarget.disabled = false
|
||||
@@ -53,11 +48,6 @@ export default class extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
get pubkeyBech32 () {
|
||||
const words = bech32.toWords(hexToBytes(this.pubkeyHexValue))
|
||||
return bech32.encode('npub', words)
|
||||
}
|
||||
|
||||
get csrfToken () {
|
||||
const element = document.head.querySelector('meta[name="csrf-token"]')
|
||||
return element.getAttribute("content")
|
||||
|
||||
Reference in New Issue
Block a user