diff --git a/src/components/AppBar/AppBar.tsx b/src/components/AppBar/AppBar.tsx index 1cb90ff..66793ca 100644 --- a/src/components/AppBar/AppBar.tsx +++ b/src/components/AppBar/AppBar.tsx @@ -114,12 +114,19 @@ export const AppBar = () => { - {username} + {username} + + + Profile - Profile { > Help @@ -137,8 +143,7 @@ export const AppBar = () => { Logout diff --git a/src/controllers/NostrController.ts b/src/controllers/NostrController.ts index 1605aea..2ddd424 100644 --- a/src/controllers/NostrController.ts +++ b/src/controllers/NostrController.ts @@ -243,10 +243,10 @@ export class NostrController { ) } - const { private: secretKey } = keys - const nsec = new TextEncoder().encode(secretKey) + const { private: nsec } = keys + const privateKey = nip19.decode(nsec).data as Uint8Array - const signedEvent = finalizeEvent(event, nsec) + const signedEvent = finalizeEvent(event, privateKey) verifySignedEvent(signedEvent) diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx index e48d264..3016dc9 100644 --- a/src/pages/login/index.tsx +++ b/src/pages/login/index.tsx @@ -16,7 +16,6 @@ import { } from '../../store/actions' import { LoginMethods } from '../../store/auth/types' import { Dispatch } from '../../store/store' -import { nsecToHex } from '../../utils' import styles from './style.module.scss' import { useNavigate } from 'react-router-dom' @@ -67,9 +66,10 @@ export const Login = () => { } const loginWithNsec = async () => { - const hexPrivateKey = nsecToHex(inputValue) + const nsec = inputValue + const privateKey = nip19.decode(nsec).data as Uint8Array - if (!hexPrivateKey) { + if (!privateKey) { toast.error( 'Snap, we failed to convert the private key you provided. Please make sure key is valid.' ) @@ -77,11 +77,11 @@ export const Login = () => { return } - const publickey = getPublicKey(new TextEncoder().encode(hexPrivateKey)) + const publickey = getPublicKey(privateKey) dispatch( updateKeyPair({ - private: hexPrivateKey, + private: nsec, public: publickey }) ) diff --git a/src/pages/profile/index.tsx b/src/pages/profile/index.tsx index ab61a3f..e452949 100644 --- a/src/pages/profile/index.tsx +++ b/src/pages/profile/index.tsx @@ -136,8 +136,10 @@ export const ProfilePage = () => { className={styles.textField} disabled type={isPassword ? 'password' : 'text'} + InputProps={{ + endAdornment: + }} /> - ) @@ -224,7 +226,9 @@ export const ProfilePage = () => { {editItem('about', 'About', true, 4)} {isUsersOwnProfile && ( <> - {keys && keys.public && copyItem(keys.public, 'Public Key')} + {keys && + keys.public && + copyItem(nip19.npubEncode(keys.public), 'Public Key')} {keys && keys.private && copyItem(