{
+ return (currentPasscode) => (currentPasscode !== passcode.value ? tPasscode('incorrectPasscode') : undefined);
+ }
+
+ return (
+
+
+
+ {t(pageInfoKey)}
+
+
+
+
+
+
+ );
+}
diff --git a/packages/browser-wallet/src/popup/popupX/shared/PasswordProtect/index.ts b/packages/browser-wallet/src/popup/popupX/shared/PasswordProtect/index.ts
new file mode 100644
index 00000000..d64c6e98
--- /dev/null
+++ b/packages/browser-wallet/src/popup/popupX/shared/PasswordProtect/index.ts
@@ -0,0 +1,2 @@
+export { default } from './PasswordProtect';
+export type { PasswordProtectConfigType } from './PasswordProtect';
diff --git a/packages/browser-wallet/src/popup/popupX/shared/i18n/en.ts b/packages/browser-wallet/src/popup/popupX/shared/i18n/en.ts
index 0978b4a3..896b3714 100644
--- a/packages/browser-wallet/src/popup/popupX/shared/i18n/en.ts
+++ b/packages/browser-wallet/src/popup/popupX/shared/i18n/en.ts
@@ -5,6 +5,9 @@ const t = {
weak: 'Weak',
medium: 'Medium',
strong: 'Strong',
+ incorrectPasscode: 'Incorrect passcode',
+ currentPasscode: 'Enter current passcode',
+ passcodeRequired: 'A passcode must be entered',
},
tokenAmount: {
token: {
diff --git a/packages/browser-wallet/src/popup/popupX/shared/utils/hoc.tsx b/packages/browser-wallet/src/popup/popupX/shared/utils/hoc.tsx
index d8c54b5d..91961cdb 100644
--- a/packages/browser-wallet/src/popup/popupX/shared/utils/hoc.tsx
+++ b/packages/browser-wallet/src/popup/popupX/shared/utils/hoc.tsx
@@ -1,6 +1,7 @@
-import React from 'react';
+import React, { useState } from 'react';
import { useSelectedCredential } from '@popup/shared/utils/account-helpers';
import Loader from '@popup/popupX/shared/Loader';
+import PasswordProtect, { PasswordProtectConfigType } from '@popup/popupX/shared/PasswordProtect';
export function withSelectedCredential(
Component: React.ComponentType
@@ -16,3 +17,16 @@ export function withSelectedCredential
(
}
return NewComponent;
}
+
+export function withPasswordProtected(Component: React.ComponentType, config: PasswordProtectConfigType) {
+ function NewComponent() {
+ const [passwordConfirmed, setPasswordConfirmed] = useState(false);
+
+ if (!passwordConfirmed) {
+ return ;
+ }
+
+ return ;
+ }
+ return NewComponent;
+}
diff --git a/packages/browser-wallet/src/popup/popupX/shared/utils/typescriptHelpers.ts b/packages/browser-wallet/src/popup/popupX/shared/utils/typescriptHelpers.ts
new file mode 100644
index 00000000..be18801b
--- /dev/null
+++ b/packages/browser-wallet/src/popup/popupX/shared/utils/typescriptHelpers.ts
@@ -0,0 +1,4 @@
+// Generic type for iterating through nested object keys
+export type ObjectPath = {
+ [K in keyof T]: `${D}${Exclude}${'' | (T[K] extends object ? ObjectPath : '')}`;
+}[keyof T];
diff --git a/packages/browser-wallet/src/popup/popupX/styles/_elements.scss b/packages/browser-wallet/src/popup/popupX/styles/_elements.scss
index ade36157..c7a48be4 100644
--- a/packages/browser-wallet/src/popup/popupX/styles/_elements.scss
+++ b/packages/browser-wallet/src/popup/popupX/styles/_elements.scss
@@ -37,6 +37,7 @@
@import '../shared/Text/Text';
@import '../shared/Loader/Loader';
@import '../shared/IdCard/IdCard';
+@import '../shared/PasswordProtect/PasswordProtect';
@import '../shared/Web3IdCard/Web3IdCard';
@import '../shared/Button/Button';
@import '../shared/ExternalLink/ExternalLink';
diff --git a/packages/browser-wallet/src/popup/shell/Root.tsx b/packages/browser-wallet/src/popup/shell/Root.tsx
index 8135cd16..788ecbb3 100644
--- a/packages/browser-wallet/src/popup/shell/Root.tsx
+++ b/packages/browser-wallet/src/popup/shell/Root.tsx
@@ -136,9 +136,7 @@ export default function Root() {
return (
-
+
diff --git a/packages/browser-wallet/src/popup/shell/i18n/i18n.ts b/packages/browser-wallet/src/popup/shell/i18n/i18n.ts
index ffeaca0e..2dfb128d 100644
--- a/packages/browser-wallet/src/popup/shell/i18n/i18n.ts
+++ b/packages/browser-wallet/src/popup/shell/i18n/i18n.ts
@@ -3,6 +3,7 @@ import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import countries from 'i18n-iso-countries';
+import { ObjectPath } from '@popup/popupX/shared/utils/typescriptHelpers';
import en from './locales/en';
import da from './locales/da';
@@ -10,6 +11,7 @@ import da from './locales/da';
countries.registerLocale(require('i18n-iso-countries/langs/en.json'));
countries.registerLocale(require('i18n-iso-countries/langs/da.json'));
+export type TranslationKeyX = ObjectPath;
export const defaultNS: keyof typeof en = 'shared';
const ns: Array = Object.keys(en) as Array;