update
This commit is contained in:
@@ -35,7 +35,7 @@ export function FollowList() {
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="rounded-xl bg-neutral-100 p-3 text-neutral-800 dark:bg-neutral-900 dark:text-neutral-200">
|
||||
<div className="relative rounded-xl bg-neutral-100 p-3 text-neutral-800 dark:bg-neutral-900 dark:text-neutral-200">
|
||||
<h5 className="font-semibold">Your follows</h5>
|
||||
<div className="mt-2 flex w-full items-center justify-center">
|
||||
{status === 'loading' ? (
|
||||
|
||||
@@ -47,6 +47,8 @@ export function ImportAccountScreen() {
|
||||
await db.secureSave(pubkey + '-bunker', localSigner.privateKey);
|
||||
|
||||
const remoteSigner = new NDKNip46Signer(ndk, npub, localSigner);
|
||||
await remoteSigner.blockUntilReady();
|
||||
|
||||
ndk.signer = remoteSigner;
|
||||
|
||||
setPubkey(pubkey);
|
||||
|
||||
@@ -11,17 +11,17 @@ import { SuggestFollow } from '@app/auth/components/features/suggestFollow';
|
||||
import { LoaderIcon } from '@shared/icons';
|
||||
|
||||
export function OnboardingListScreen() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { state } = useLocation();
|
||||
const { newuser }: { newuser: boolean } = state;
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const completed = () => {
|
||||
setLoading(true);
|
||||
|
||||
const timeout = setTimeout(() => setLoading(false), 1200);
|
||||
const timeout = setTimeout(() => setLoading(false), 200);
|
||||
clearTimeout(timeout);
|
||||
|
||||
navigate('/');
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
import { NDKEvent } from '@nostr-dev-kit/ndk';
|
||||
import { nip04 } from 'nostr-tools';
|
||||
import { NDKEvent, NDKUser } from '@nostr-dev-kit/ndk';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import { useNDK } from '@libs/ndk/provider';
|
||||
import { useStorage } from '@libs/storage/provider';
|
||||
|
||||
export function useDecryptMessage(message: NDKEvent) {
|
||||
const { db } = useStorage();
|
||||
const { ndk } = useNDK();
|
||||
|
||||
const [content, setContent] = useState(message.content);
|
||||
|
||||
useEffect(() => {
|
||||
async function decryptContent() {
|
||||
try {
|
||||
const privkey = await db.secureLoad(db.account.pubkey);
|
||||
const sender =
|
||||
db.account.pubkey === message.pubkey
|
||||
? message.tags.find((el) => el[0] === 'p')[1]
|
||||
: message.pubkey;
|
||||
const result = await nip04.decrypt(privkey, sender, message.content);
|
||||
const sender = new NDKUser({
|
||||
hexpubkey:
|
||||
db.account.pubkey === message.pubkey
|
||||
? message.tags.find((el) => el[0] === 'p')[1]
|
||||
: message.pubkey,
|
||||
});
|
||||
const result = await ndk.signer.decrypt(sender, message.content);
|
||||
setContent(result);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
|
||||
Reference in New Issue
Block a user