mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-18 19:23:40 +00:00
Fix decoding keys
This commit is contained in:
parent
927d04b74e
commit
7caae932ac
@ -189,7 +189,7 @@ const relays = new Table('relays', 'url')
|
||||
|
||||
const routes = new Table('routes', 'id', {
|
||||
initialize: async table => {
|
||||
const isValid = r => r.last_seen > now() - timedelta(7, 'days')
|
||||
const isValid = r => r.last_seen > now() - timedelta(1, 'days')
|
||||
const [valid, invalid] = partition(isValid, Object.values(await table.dump() || {}))
|
||||
|
||||
// Delete stale routes asynchronously
|
||||
|
@ -11,7 +11,12 @@
|
||||
const nip07 = "https://github.com/nostr-protocol/nips/blob/master/07.md"
|
||||
|
||||
const logIn = () => {
|
||||
const privkey = (nsec.startsWith('nsec') ? nip19.decode(nsec).data : nsec) as string
|
||||
let privkey = ''
|
||||
try {
|
||||
privkey = (nsec.startsWith('nsec') ? nip19.decode(nsec).data : nsec) as string
|
||||
} catch (e) {
|
||||
// pass
|
||||
}
|
||||
|
||||
if (!privkey.match(/[a-z0-9]{64}/)) {
|
||||
toast.show("error", "Sorry, but that's an invalid private key.")
|
||||
|
@ -10,7 +10,12 @@
|
||||
let npub = ''
|
||||
|
||||
const logIn = () => {
|
||||
const pubkey = (npub.startsWith('npub') ? nip19.decode(npub).data : npub) as string
|
||||
let pubkey = ''
|
||||
try {
|
||||
pubkey = (npub.startsWith('npub') ? nip19.decode(npub).data : npub) as string
|
||||
} catch (e) {
|
||||
// pass
|
||||
}
|
||||
|
||||
if (!pubkey.match(/[a-z0-9]{64}/)) {
|
||||
toast.show("error", "Sorry, but that's an invalid public key.")
|
||||
|
Loading…
Reference in New Issue
Block a user