Clear entropy on completion of onboarding
This commit is contained in:
parent
debc9566cc
commit
710a7dd2de
@ -1,19 +1,27 @@
|
||||
import { useIntl, FormattedMessage } from "react-intl";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useNavigate, Link } from "react-router-dom";
|
||||
import { RecommendedFollows } from "Const";
|
||||
import Logo from "Element/Logo";
|
||||
import FollowListBase from "Element/FollowListBase";
|
||||
import { useMemo } from "react";
|
||||
import { clearEntropy } from "State/Login";
|
||||
|
||||
import messages from "./messages";
|
||||
|
||||
export default function DiscoverFollows() {
|
||||
const { formatMessage } = useIntl();
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
const sortedReccomends = useMemo(() => {
|
||||
return RecommendedFollows.sort(() => (Math.random() >= 0.5 ? -1 : 1));
|
||||
}, []);
|
||||
|
||||
async function clearEntropyAndGo() {
|
||||
dispatch(clearEntropy());
|
||||
navigate("/");
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="main-content new-user" dir="auto">
|
||||
<Logo />
|
||||
@ -27,7 +35,7 @@ export default function DiscoverFollows() {
|
||||
<FormattedMessage {...messages.Share} values={{ link: <Link to="/">{formatMessage(messages.World)}</Link> }} />
|
||||
</p>
|
||||
<div className="next-actions continue-actions">
|
||||
<button type="button" onClick={() => navigate("/")}>
|
||||
<button type="button" onClick={() => clearEntropyAndGo()}>
|
||||
<FormattedMessage {...messages.Done} />{" "}
|
||||
</button>
|
||||
</div>
|
||||
|
@ -333,6 +333,9 @@ const LoginSlice = createSlice({
|
||||
window.localStorage.setItem(PrivateKeyItem, action.payload.key);
|
||||
state.publicKey = secp.utils.bytesToHex(secp.schnorr.getPublicKey(action.payload.key));
|
||||
},
|
||||
clearEntropy: state => {
|
||||
state.generatedEntropy = undefined;
|
||||
},
|
||||
setPublicKey: (state, action: PayloadAction<HexKey>) => {
|
||||
window.localStorage.setItem(PublicKeyItem, action.payload);
|
||||
state.loggedOut = false;
|
||||
@ -479,6 +482,7 @@ export const {
|
||||
init,
|
||||
setPrivateKey,
|
||||
setGeneratedPrivateKey,
|
||||
clearEntropy,
|
||||
setPublicKey,
|
||||
setRelays,
|
||||
removeRelay,
|
||||
|
Loading…
x
Reference in New Issue
Block a user