Skip to content

Commit

Permalink
fix: dont auth automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
verbiricha committed Dec 31, 2023
1 parent 2dc84a6 commit 96404b4
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions packages/core/src/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import NDK, {
NDKEvent,
NDKSigner,
NDKSubscriptionCacheUsage,
NDKRelayAuthPolicies,
} from "@nostr-dev-kit/ndk";
import { generatePrivateKey, getPublicKey } from "nostr-tools";

Expand Down Expand Up @@ -158,11 +157,9 @@ export const NgineProvider = ({
if (session?.method === "nip07") {
const signer = new NDKNip07Signer();
ndk.signer = signer;
ndk.relayAuthDefaultPolicy = NDKRelayAuthPolicies.signIn({ ndk, signer });
} else if (session?.method === "nsec") {
const signer = new NDKPrivateKeySigner(session.privkey);
ndk.signer = signer;
ndk.relayAuthDefaultPolicy = NDKRelayAuthPolicies.signIn({ ndk, signer });
}
}, [session]);

Expand All @@ -171,7 +168,6 @@ export const NgineProvider = ({
const user = await signer.blockUntilReady();
if (user) {
ndk.signer = signer;
ndk.relayAuthDefaultPolicy = NDKRelayAuthPolicies.signIn({ ndk, signer });
setSession({
method: "nip07",
pubkey: user.pubkey,
Expand All @@ -197,7 +193,6 @@ export const NgineProvider = ({
const user = await signer.blockUntilReady();
if (user) {
ndk.signer = signer;
ndk.relayAuthDefaultPolicy = NDKRelayAuthPolicies.signIn({ ndk, signer });
setSession({
method: "nsec",
pubkey: user.pubkey,
Expand All @@ -224,7 +219,6 @@ export const NgineProvider = ({

function logOut() {
ndk.signer = undefined;
ndk.relayAuthDefaultPolicy = undefined;
setSession(null);
setFollows(null);
setRelays(null);
Expand Down

2 comments on commit 96404b4

@vercel
Copy link

@vercel vercel bot commented on 96404b4 Dec 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 96404b4 Dec 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.