NKeys -> keyring
This commit is contained in:
parent
ce5a4b9a03
commit
36427f52d7
|
@ -1,6 +1,6 @@
|
|||
import { NKeyring } from './NKeyring';
|
||||
|
||||
export const NKeys = new NKeyring(
|
||||
export const keyring = new NKeyring(
|
||||
localStorage,
|
||||
'soapbox:nostr:keys',
|
||||
);
|
|
@ -6,7 +6,7 @@ import { logInNostr } from 'soapbox/actions/nostr';
|
|||
import EmojiGraphic from 'soapbox/components/emoji-graphic';
|
||||
import { Button, Stack, Modal, Input, FormGroup, Form, Divider } from 'soapbox/components/ui';
|
||||
import { useNostr } from 'soapbox/contexts/nostr-context';
|
||||
import { NKeys } from 'soapbox/features/nostr/keys';
|
||||
import { keyring } from 'soapbox/features/nostr/keyring';
|
||||
import { useAppDispatch } from 'soapbox/hooks';
|
||||
|
||||
import NostrExtensionIndicator from '../components/nostr-extension-indicator';
|
||||
|
@ -33,7 +33,7 @@ const KeyAddStep: React.FC<IKeyAddStep> = ({ onClose }) => {
|
|||
const result = nip19.decode(nsec);
|
||||
if (result.type === 'nsec') {
|
||||
const seckey = result.data;
|
||||
const signer = NKeys.add(seckey);
|
||||
const signer = keyring.add(seckey);
|
||||
dispatch(logInNostr(signer, relay));
|
||||
onClose();
|
||||
return;
|
||||
|
|
|
@ -8,7 +8,7 @@ import { closeSidebar } from 'soapbox/actions/sidebar';
|
|||
import EmojiGraphic from 'soapbox/components/emoji-graphic';
|
||||
import { Button, Stack, Modal, FormGroup, Text, Tooltip, HStack, Input } from 'soapbox/components/ui';
|
||||
import { useNostr } from 'soapbox/contexts/nostr-context';
|
||||
import { NKeys } from 'soapbox/features/nostr/keys';
|
||||
import { keyring } from 'soapbox/features/nostr/keyring';
|
||||
import { useAppDispatch, useInstance } from 'soapbox/hooks';
|
||||
import { useIsMobile } from 'soapbox/hooks/useIsMobile';
|
||||
import { download } from 'soapbox/utils/download';
|
||||
|
@ -45,7 +45,7 @@ const KeygenStep: React.FC<IKeygenStep> = ({ onClose }) => {
|
|||
const handleNext = async () => {
|
||||
if (!relay) return;
|
||||
|
||||
const signer = NKeys.add(secretKey);
|
||||
const signer = keyring.add(secretKey);
|
||||
const now = Math.floor(Date.now() / 1000);
|
||||
|
||||
const [kind0, ...events] = await Promise.all([
|
||||
|
|
|
@ -2,7 +2,7 @@ import { NSecSigner } from '@nostrify/nostrify';
|
|||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
import { NKeys } from 'soapbox/features/nostr/keys';
|
||||
import { keyring } from 'soapbox/features/nostr/keyring';
|
||||
import { useAppSelector } from 'soapbox/hooks';
|
||||
import { useBunkerStore } from 'soapbox/hooks/nostr/useBunkerStore';
|
||||
|
||||
|
@ -23,7 +23,7 @@ export function useSigner() {
|
|||
queryFn: async () => {
|
||||
if (!pubkey) return null;
|
||||
|
||||
const signer = NKeys.get(pubkey);
|
||||
const signer = keyring.get(pubkey);
|
||||
if (signer) return signer;
|
||||
|
||||
if (window.nostr && await window.nostr.getPublicKey() === pubkey) {
|
||||
|
|
|
@ -2,7 +2,7 @@ import { AxiosError } from 'axios';
|
|||
import { produce } from 'immer';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { NKeys } from 'soapbox/features/nostr/keys';
|
||||
import { keyring } from 'soapbox/features/nostr/keyring';
|
||||
import { useBunkerStore } from 'soapbox/hooks/nostr/useBunkerStore';
|
||||
import { Account, accountSchema } from 'soapbox/schemas';
|
||||
import { Application, applicationSchema } from 'soapbox/schemas/application';
|
||||
|
@ -131,7 +131,7 @@ function revokeNostr(accessToken: string): void {
|
|||
|
||||
// Revoke the private key, if it exists.
|
||||
if (pubkey) {
|
||||
NKeys.delete(pubkey);
|
||||
keyring.delete(pubkey);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue