Login with NSEC and HEX private key formats. Proper errors. #66
@ -107,7 +107,7 @@ export const Login = () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
privateKey = nip19.decode(nsec).data as Uint8Array
|
privateKey = nip19.decode(nsec).data as Uint8Array
|
||||||
} catch(err) {
|
} catch (err) {
|
||||||
toast.error(`Error decoding the nsec. ${err}`)
|
toast.error(`Error decoding the nsec. ${err}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -330,12 +330,13 @@ export const Login = () => {
|
|||||||
const publickey = getPublicKey(privateKey)
|
const publickey = getPublicKey(privateKey)
|
||||||
|
|
||||||
if (publickey) return loginWithNsec(privateKey)
|
if (publickey) return loginWithNsec(privateKey)
|
||||||
|
} catch (err) {
|
||||||
} catch(err) {
|
|
||||||
console.warn('err', err)
|
console.warn('err', err)
|
||||||
}
|
}
|
||||||
|
|
||||||
toast.error('Invalid format, please use: private key (hex), nsec..., bunker:// or nip05 format.')
|
toast.error(
|
||||||
|
'Invalid format, please use: private key (hex), nsec..., bunker:// or nip05 format.'
|
||||||
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ export const ProfilePage = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
<Box className={styles.head}>
|
<Box className={styles.head}>
|
||||||
<Box sx={{lineHeight: 1}} className={styles.npubNip}>
|
<Box sx={{ lineHeight: 1 }} className={styles.npubNip}>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex'
|
display: 'flex'
|
||||||
@ -216,7 +216,7 @@ export const ProfilePage = () => {
|
|||||||
>
|
>
|
||||||
{profileMetadata && (
|
{profileMetadata && (
|
||||||
<Typography
|
<Typography
|
||||||
sx={{ margin: '5px 0 5px 0'}}
|
sx={{ margin: '5px 0 5px 0' }}
|
||||||
variant="h6"
|
variant="h6"
|
||||||
className={styles.bold}
|
className={styles.bold}
|
||||||
>
|
>
|
||||||
@ -240,11 +240,19 @@ export const ProfilePage = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
{profileMetadata?.nip05 &&
|
{profileMetadata?.nip05 &&
|
||||||
textElementWithCopyIcon(profileMetadata.nip05, undefined, 15)}
|
textElementWithCopyIcon(
|
||||||
|
profileMetadata.nip05,
|
||||||
|
undefined,
|
||||||
|
15
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
{profileMetadata?.lud16 &&
|
{profileMetadata?.lud16 &&
|
||||||
textElementWithCopyIcon(profileMetadata.lud16, undefined, 15)}
|
textElementWithCopyIcon(
|
||||||
|
profileMetadata.lud16,
|
||||||
|
undefined,
|
||||||
|
15
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user