aboutsummaryrefslogtreecommitdiff
path: root/extension/src/entries/store/features.ts
diff options
context:
space:
mode:
Diffstat (limited to 'extension/src/entries/store/features.ts')
-rw-r--r--extension/src/entries/store/features.ts25
1 files changed, 22 insertions, 3 deletions
diff --git a/extension/src/entries/store/features.ts b/extension/src/entries/store/features.ts
index c619b0e..9f9a4db 100644
--- a/extension/src/entries/store/features.ts
+++ b/extension/src/entries/store/features.ts
@@ -1,7 +1,22 @@
+// Copyright (C) 2023 Vaughn Nugent
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'pinia'
import { } from 'lodash'
import { PiniaPluginContext } from 'pinia'
+import type { IMfaFlowContinuiation } from '@vnuge/vnlib.browser'
import {
useAuthApi,
@@ -14,7 +29,8 @@ import {
useForegoundFeatures,
useEventTagFilterApi,
useInjectAllowList,
- onWatchableChange
+ onWatchableChange,
+ useMfaConfigApi
} from "../../features"
import { ChannelContext } from '../../messaging'
@@ -25,6 +41,7 @@ export type BgPluginState<T> = { plugins: BgPlugins } & T
declare module 'pinia' {
export interface PiniaCustomProperties {
plugins: BgPlugins
+ mfaStatus: Partial<IMfaFlowContinuiation> | null
}
}
@@ -41,7 +58,8 @@ const usePlugins = (context: ChannelContext) => {
localPki: use(useLocalPki),
pki: use(usePkiApi),
tagFilter: use(useEventTagFilterApi),
- allowedOrigins: use(useInjectAllowList)
+ allowedOrigins: use(useInjectAllowList),
+ mfaConfig: use(useMfaConfigApi)
}
}
@@ -56,9 +74,10 @@ export const useBackgroundPiniaPlugin = (context: ChannelContext) => {
//watch for status changes
onWatchableChange(user, async () => {
//Get status update and set the values
- const { loggedIn, userName } = await user.getStatus();
+ const { loggedIn, userName, mfaStatus } = await user.getStatus();
store.loggedIn = loggedIn;
store.userName = userName;
+ store.mfaStatus = mfaStatus
}, { immediate: true })