fix: production build
This commit is contained in:
@@ -7,21 +7,22 @@ import * as Tabs from '@radix-ui/react-tabs'
|
||||
import { LogoIcon } from './icons'
|
||||
import { removePermissions } from './common'
|
||||
import * as Checkbox from '@radix-ui/react-checkbox'
|
||||
import { hexToBytes, bytesToHex } from 'nostr-tools/utils'
|
||||
|
||||
function Options() {
|
||||
const [privKey, setPrivKey] = useState('')
|
||||
const [relays, setRelays] = useState([])
|
||||
const [newRelayURL, setNewRelayURL] = useState('')
|
||||
const [policies, setPermissions] = useState([])
|
||||
const [protocolHandler, setProtocolHandler] = useState(
|
||||
'https://njump.me/{raw}'
|
||||
)
|
||||
const [hidingPrivateKey, hidePrivateKey] = useState(true)
|
||||
const [showNotifications, setNotifications] = useState(false)
|
||||
const [messages, setMessages] = useState([])
|
||||
const [handleNostrLinks, setHandleNostrLinks] = useState(false)
|
||||
const [showProtocolHandlerHelp, setShowProtocolHandlerHelp] = useState(false)
|
||||
const [unsavedChanges, setUnsavedChanges] = useState([])
|
||||
const [protocolHandler, setProtocolHandler] = useState(
|
||||
'https://njump.me/{raw}'
|
||||
)
|
||||
|
||||
const showMessage = useCallback((msg) => {
|
||||
messages.push(msg)
|
||||
@@ -528,22 +529,17 @@ examples:
|
||||
showMessage('PRIVATE KEY IS INVALID! did not save private key.')
|
||||
return
|
||||
}
|
||||
|
||||
let hexOrEmptyKey = privKey
|
||||
|
||||
try {
|
||||
const { type, data } = nip19.decode(privKey)
|
||||
if (type === 'nsec') hexOrEmptyKey = data
|
||||
if (type === 'nsec') hexOrEmptyKey = bytesToHex(data)
|
||||
} catch (_) {}
|
||||
|
||||
await browser.storage.local.set({
|
||||
private_key: hexOrEmptyKey
|
||||
})
|
||||
|
||||
if (hexOrEmptyKey !== '') {
|
||||
setPrivKey(nip19.nsecEncode(hexOrEmptyKey))
|
||||
setPrivKey(nip19.nsecEncode(hexToBytes(hexOrEmptyKey)))
|
||||
}
|
||||
|
||||
showMessage('saved private key!')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user