NostrSignin: remove unused setSigner state
This commit is contained in:
parent
611e0e59f2
commit
b8b22fc637
3 changed files with 7 additions and 16 deletions
|
@ -1,4 +1,3 @@
|
|||
import { NostrSigner } from '@soapbox/nspec';
|
||||
import React, { useState } from 'react';
|
||||
|
||||
import AccountStep from './steps/account-step';
|
||||
|
@ -16,8 +15,6 @@ interface INostrSigninModal {
|
|||
|
||||
const NostrSigninModal: React.FC<INostrSigninModal> = ({ onClose }) => {
|
||||
const [step, setStep] = useState<Step>(window.nostr ? 'extension' : 'identity');
|
||||
|
||||
const [, setSigner] = useState<NostrSigner | undefined>();
|
||||
const [accountId, setAccountId] = useState<string | undefined>();
|
||||
|
||||
const handleClose = () => onClose('NOSTR_SIGNIN');
|
||||
|
@ -28,11 +25,11 @@ const NostrSigninModal: React.FC<INostrSigninModal> = ({ onClose }) => {
|
|||
case 'identity':
|
||||
return <IdentityStep setAccountId={setAccountId} setStep={setStep} onClose={handleClose} />;
|
||||
case 'key':
|
||||
return <KeyStep setStep={setStep} onClose={handleClose} />;
|
||||
return <KeyStep setStep={setStep} onClose={handleClose} />;
|
||||
case 'key-add':
|
||||
return <KeyAddStep setAccountId={setAccountId} setSigner={setSigner} setStep={setStep} onClose={handleClose} />;
|
||||
return <KeyAddStep setAccountId={setAccountId} setStep={setStep} onClose={handleClose} />;
|
||||
case 'keygen':
|
||||
return <KeygenStep setAccountId={setAccountId} setSigner={setSigner} setStep={setStep} onClose={handleClose} />;
|
||||
return <KeygenStep setAccountId={setAccountId} setStep={setStep} onClose={handleClose} />;
|
||||
case 'account':
|
||||
return <AccountStep accountId={accountId!} setStep={setStep} onClose={handleClose} />;
|
||||
default:
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { NostrSigner } from '@soapbox/nspec';
|
||||
import { getPublicKey, nip19 } from 'nostr-tools';
|
||||
import React, { useState } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
@ -12,12 +11,11 @@ import { Step } from '../nostr-signin-modal';
|
|||
|
||||
interface IKeyAddStep {
|
||||
setAccountId(accountId: string): void;
|
||||
setSigner(signer: NostrSigner): void;
|
||||
setStep(step: Step): void;
|
||||
onClose(): void;
|
||||
}
|
||||
|
||||
const KeyAddStep: React.FC<IKeyAddStep> = ({ setAccountId, setSigner, setStep, onClose }) => {
|
||||
const KeyAddStep: React.FC<IKeyAddStep> = ({ setAccountId, setStep, onClose }) => {
|
||||
const [nsec, setNsec] = useState('');
|
||||
const [error, setError] = useState<string | undefined>();
|
||||
|
||||
|
@ -32,9 +30,8 @@ const KeyAddStep: React.FC<IKeyAddStep> = ({ setAccountId, setSigner, setStep, o
|
|||
if (result.type === 'nsec') {
|
||||
const seckey = result.data;
|
||||
const pubkey = getPublicKey(seckey);
|
||||
const signer = NKeys.add(seckey);
|
||||
NKeys.add(seckey);
|
||||
setAccountId(pubkey);
|
||||
setSigner(signer);
|
||||
setStep('account');
|
||||
}
|
||||
} catch (e) {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { NostrSigner } from '@soapbox/nspec';
|
||||
import { generateSecretKey, getPublicKey, nip19 } from 'nostr-tools';
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
@ -16,12 +15,11 @@ import { Step } from '../nostr-signin-modal';
|
|||
|
||||
interface IKeygenStep {
|
||||
setAccountId(accountId: string): void;
|
||||
setSigner(signer: NostrSigner): void;
|
||||
setStep(step: Step): void;
|
||||
onClose(): void;
|
||||
}
|
||||
|
||||
const KeygenStep: React.FC<IKeygenStep> = ({ setAccountId, setSigner, setStep, onClose }) => {
|
||||
const KeygenStep: React.FC<IKeygenStep> = ({ setAccountId, setStep, onClose }) => {
|
||||
const instance = useInstance();
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
|
@ -46,8 +44,7 @@ const KeygenStep: React.FC<IKeygenStep> = ({ setAccountId, setSigner, setStep, o
|
|||
const handleCopy = () => setDownloaded(true);
|
||||
|
||||
const handleNext = () => {
|
||||
const signer = NKeys.add(secretKey);
|
||||
setSigner(signer);
|
||||
NKeys.add(secretKey);
|
||||
setAccountId(pubkey); // HACK: Ditto uses pubkeys as account IDs.
|
||||
setStep('account');
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue