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

chore: change u2f from feature trunk to role based permission restricted #2250

Merged
merged 1 commit into from Mar 8, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,3 +1,5 @@
import { FeatureIdentifier, FeatureStatus } from '@standardnotes/snjs'

import { WebApplication } from '@/Application/Application'
import { ViewControllerManager } from '@/Controllers/ViewControllerManager'
import { FunctionComponent } from 'react'
Expand All @@ -12,7 +14,6 @@ import PreferencesPane from '@/Components/Preferences/PreferencesComponents/Pref
import BiometricsLock from '@/Components/Preferences/Panes/Security/BiometricsLock'
import MultitaskingPrivacy from '@/Components/Preferences/Panes/Security/MultitaskingPrivacy'
import U2FWrapper from './U2F/U2FWrapper'
import { featureTrunkEnabled, FeatureTrunkName } from '@/FeatureTrunk'

interface SecurityProps extends MfaProps {
viewControllerManager: ViewControllerManager
Expand All @@ -22,6 +23,9 @@ interface SecurityProps extends MfaProps {
const Security: FunctionComponent<SecurityProps> = (props) => {
const isNativeMobileWeb = props.application.isNativeMobileWeb()

const isU2FFeatureAvailable =
props.application.features.getFeatureStatus(FeatureIdentifier.UniversalSecondFactor) === FeatureStatus.Entitled

return (
<PreferencesPane>
<Encryption viewControllerManager={props.viewControllerManager} />
Expand All @@ -34,9 +38,7 @@ const Security: FunctionComponent<SecurityProps> = (props) => {
userProvider={props.userProvider}
application={props.application}
/>
{featureTrunkEnabled(FeatureTrunkName.U2F) && (
<U2FWrapper userProvider={props.userProvider} application={props.application} />
)}
{isU2FFeatureAvailable && <U2FWrapper userProvider={props.userProvider} application={props.application} />}
{isNativeMobileWeb && <MultitaskingPrivacy application={props.application} />}
<PasscodeLock viewControllerManager={props.viewControllerManager} application={props.application} />
{isNativeMobileWeb && <BiometricsLock application={props.application} />}
Expand Down
2 changes: 0 additions & 2 deletions packages/web/src/javascripts/FeatureTrunk.ts
Expand Up @@ -3,13 +3,11 @@ import { isDev } from '@/Utils'
export enum FeatureTrunkName {
Super,
ImportTools,
U2F,
}

const FeatureTrunkStatus: Record<FeatureTrunkName, boolean> = {
[FeatureTrunkName.Super]: isDev && true,
[FeatureTrunkName.ImportTools]: isDev && true,
[FeatureTrunkName.U2F]: isDev && true,
}

export function featureTrunkEnabled(trunk: FeatureTrunkName): boolean {
Expand Down