Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(node-app): Create warning screen for encrypted wallets #260

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion main/api/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { userSettingsStore } from "../stores/userSettingsStore";
export type InitialState =
| "onboarding"
| "snapshot-download-prompt"
| "start-node";
| "start-node"
| "encryption-not-supported";

export class Manager {
private _ironfish: Ironfish | null = null;
Expand Down Expand Up @@ -45,6 +46,11 @@ export class Manager {

const rpcClient = await ironfish.rpcClient();

const walletStatus = await rpcClient.wallet.getAccountsStatus();
if (walletStatus.content.encrypted) {
return "encryption-not-supported";
}

const accountsResponse = await rpcClient.wallet.getAccounts();

if (accountsResponse.content.accounts.length === 0) {
Expand Down
72 changes: 36 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"license": "MPL-2.0",
"dependencies": {
"@ironfish/sdk": "2.5.0",
"@ironfish/sdk": "^2.7.0",
"@ledgerhq/hw-transport-node-hid": "^6.29.1",
"electron-serve": "^1.1.0",
"keccak": "^3.0.4"
Expand Down
6 changes: 6 additions & 0 deletions renderer/intl/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,12 @@
"s3kz6s": {
"message": "A network error occured, please try again"
},
"sXlL42": {
"message": "Encrypted Wallets Unsupported"
},
"tBX0Dj": {
"message": "Your Iron Fish wallet is encrypted. Encrypted wallets are not yet supported in the node app. Please decrypt your wallet using the CLI to use the node app."
},
"tOdNiY": {
"message": "Dark"
},
Expand Down
40 changes: 40 additions & 0 deletions renderer/pages/encryption-not-supported/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { Box, Heading, LightMode, Text, VStack } from "@chakra-ui/react";
import { defineMessages, useIntl } from "react-intl";

import { COLORS } from "@/ui/colors";

const messages = defineMessages({
encryptionNotSupported: {
defaultMessage: "Encrypted Wallets Unsupported",
},
decryptWalletToUse: {
defaultMessage:
"Your Iron Fish wallet is encrypted. Encrypted wallets are not yet supported in the node app. Please decrypt your wallet using the CLI to use the node app.",
},
});

export default function EncryptionNotSupportedPage() {
const { formatMessage } = useIntl();

return (
<LightMode>
<VStack m={12}>
<Heading fontSize={28} lineHeight="160%" flexGrow={1}>
{formatMessage(messages.encryptionNotSupported)}
</Heading>
<Box width={640} m={8}>
<Text
fontSize="larger"
lineHeight="160%"
color={COLORS.WHITE}
_dark={{
color: COLORS.WHITE,
}}
>
{formatMessage(messages.decryptWalletToUse)}
</Text>
</Box>
</VStack>
</LightMode>
);
}
7 changes: 7 additions & 0 deletions renderer/pages/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ export default function Home() {
}
}, [initialStateData, router]);

// Encryption is not supported in the node app yet
useEffect(() => {
if (initialStateData === "encryption-not-supported") {
router.replace("/encryption-not-supported");
}
}, [initialStateData, router]);

// If user is behind on syncing, go to snapshot download
useEffect(() => {
if (initialStateData === "snapshot-download-prompt") {
Expand Down