diff --git a/ts/components/registration/components/BackButton.tsx b/ts/components/registration/components/BackButton.tsx
index d983a8ee2..6f7f0388d 100644
--- a/ts/components/registration/components/BackButton.tsx
+++ b/ts/components/registration/components/BackButton.tsx
@@ -28,13 +28,13 @@ export const BackButtonWithinContainer = ({
children,
margin,
callback,
- shouldQuit,
+ shouldQuitOnClick,
quitMessage,
}: {
children: ReactNode;
margin?: string;
callback?: () => void;
- shouldQuit?: boolean;
+ shouldQuitOnClick?: boolean;
quitMessage?: string;
}) => {
return (
@@ -46,7 +46,11 @@ export const BackButtonWithinContainer = ({
alignItems="flex-start"
>
-
+
{children}
@@ -55,11 +59,11 @@ export const BackButtonWithinContainer = ({
export const BackButton = ({
callback,
- shouldQuit,
+ shouldQuitOnClick,
quitMessage,
}: {
callback?: () => void;
- shouldQuit?: boolean;
+ shouldQuitOnClick?: boolean;
quitMessage?: string;
}) => {
const step = useOnboardStep();
@@ -76,7 +80,7 @@ export const BackButton = ({
iconRotation={90}
padding={'0'}
onClick={() => {
- if (shouldQuit && quitMessage) {
+ if (shouldQuitOnClick && quitMessage) {
dispatch(
updateQuitModal({
title: window.i18n('warning'),
diff --git a/ts/components/registration/stages/CreateAccount.tsx b/ts/components/registration/stages/CreateAccount.tsx
index 595122f42..d677dadfe 100644
--- a/ts/components/registration/stages/CreateAccount.tsx
+++ b/ts/components/registration/stages/CreateAccount.tsx
@@ -3,8 +3,9 @@ import { useDispatch } from 'react-redux';
import useMount from 'react-use/lib/useMount';
import { SettingsKey } from '../../../data/settings-key';
import { mnDecode } from '../../../session/crypto/mnemonic';
+import { ProfileManager } from '../../../session/profile_manager/ProfileManager';
import { StringUtils } from '../../../session/utils';
-import { fromHex } from '../../../session/utils/String';
+import { fromHex, toHex } from '../../../session/utils/String';
import LIBSESSION_CONSTANTS from '../../../session/utils/libsession/libsession_constants';
import { trigger } from '../../../shims/events';
import {
@@ -13,13 +14,13 @@ import {
setDisplayName,
setDisplayNameError,
setHexGeneratedPubKey,
- setPrivateKeyBytes,
+ setPrivateKeyBytesHex,
setRecoveryPassword,
} from '../../../state/onboarding/ducks/registration';
import {
useDisplayName,
useDisplayNameError,
- useOnboardPrivateKeyBytes,
+ useOnboardPrivateKeyBytesHex,
useRecoveryPassword,
} from '../../../state/onboarding/selectors/registration';
import {
@@ -35,7 +36,6 @@ import { resetRegistration } from '../RegistrationStages';
import { ContinueButton, OnboardDescription, OnboardHeading } from '../components';
import { BackButtonWithinContainer } from '../components/BackButton';
import { displayNameIsValid, sanitizeDisplayNameOrToast } from '../utils';
-import { ProfileManager } from '../../../session/profile_manager/ProfileManager';
export type AccountDetails = {
recoveryPassword: string;
@@ -59,7 +59,7 @@ async function signUp(signUpDetails: AccountDetails) {
}
export const CreateAccount = () => {
- const privateKeyBytes = useOnboardPrivateKeyBytes();
+ const privateKeyBytesHex = useOnboardPrivateKeyBytesHex();
const recoveryPassword = useRecoveryPassword();
const displayName = useDisplayName();
const displayNameError = useDisplayNameError();
@@ -82,7 +82,7 @@ export const CreateAccount = () => {
const newHexPubKey = StringUtils.decode(keyPair.pubKey, 'hex');
dispatch(setRecoveryPassword(mnemonic));
- dispatch(setPrivateKeyBytes(keyPair.ed25519KeyPair.privateKey));
+ dispatch(setPrivateKeyBytesHex(toHex(keyPair.ed25519KeyPair.privateKey)));
dispatch(setHexGeneratedPubKey(newHexPubKey)); // our 'frontend' account ID
}
};
@@ -97,7 +97,7 @@ export const CreateAccount = () => {
}
try {
- if (!privateKeyBytes) {
+ if (!privateKeyBytesHex) {
throw new Error('Private key not found');
}
@@ -122,7 +122,7 @@ export const CreateAccount = () => {
return (
{
dispatch(setDisplayName(''));
diff --git a/ts/components/registration/stages/RestoreAccount.tsx b/ts/components/registration/stages/RestoreAccount.tsx
index ba4bb3285..af3e7850b 100644
--- a/ts/components/registration/stages/RestoreAccount.tsx
+++ b/ts/components/registration/stages/RestoreAccount.tsx
@@ -197,7 +197,7 @@ export const RestoreAccount = () => {
return (
{
dispatch(setRecoveryPassword(''));
diff --git a/ts/state/onboarding/ducks/registration.ts b/ts/state/onboarding/ducks/registration.ts
index 91f7e3cbe..d6858d1a4 100644
--- a/ts/state/onboarding/ducks/registration.ts
+++ b/ts/state/onboarding/ducks/registration.ts
@@ -41,7 +41,7 @@ export type OnboardingState = {
progress: number;
recoveryPassword: string;
recoveryPasswordError: string | undefined;
- privateKeyBytes: Uint8Array | undefined;
+ privateKeyBytesHex: string | undefined;
hexGeneratedPubKey: string;
displayName: string;
displayNameError: string | undefined;
@@ -55,7 +55,7 @@ const initialState: OnboardingState = {
progress: 0,
recoveryPassword: '',
recoveryPasswordError: undefined,
- privateKeyBytes: undefined,
+ privateKeyBytesHex: undefined,
hexGeneratedPubKey: '',
displayName: '',
displayNameError: undefined,
@@ -92,8 +92,8 @@ export const registrationSlice = createSlice({
setHexGeneratedPubKey(state, action: PayloadAction) {
return { ...state, hexGeneratedPubKey: action.payload };
},
- setPrivateKeyBytes(state, action: PayloadAction) {
- return { ...state, privateKeyBytes: action.payload };
+ setPrivateKeyBytesHex(state, action: PayloadAction) {
+ return { ...state, privateKeyBytesHex: action.payload };
},
setDisplayName(state, action: PayloadAction) {
return { ...state, displayName: action.payload };
@@ -114,7 +114,7 @@ export const {
setRecoveryPassword,
setRecoveryPasswordError,
setHexGeneratedPubKey,
- setPrivateKeyBytes,
+ setPrivateKeyBytesHex,
setDisplayName,
setDisplayNameError,
} = registrationSlice.actions;
diff --git a/ts/state/onboarding/selectors/registration.ts b/ts/state/onboarding/selectors/registration.ts
index 0c67cc41a..0f65c19ac 100644
--- a/ts/state/onboarding/selectors/registration.ts
+++ b/ts/state/onboarding/selectors/registration.ts
@@ -54,9 +54,9 @@ const getHexGeneratedPubKey = createSelector(
(state: OnboardingState): string => state.hexGeneratedPubKey
);
-const getPrivateKeyBytes = createSelector(
+const getPrivateKeyBytesHex = createSelector(
getRegistration,
- (state: OnboardingState): Uint8Array | undefined => state.privateKeyBytes
+ (state: OnboardingState): string | undefined => state.privateKeyBytesHex
);
const getDisplayName = createSelector(
@@ -103,8 +103,8 @@ export const useOnboardHexGeneratedPubKey = () => {
return useSelector(getHexGeneratedPubKey);
};
-export const useOnboardPrivateKeyBytes = () => {
- return useSelector(getPrivateKeyBytes);
+export const useOnboardPrivateKeyBytesHex = () => {
+ return useSelector(getPrivateKeyBytesHex);
};
export const useDisplayName = () => {