feat: soft biometrics lock (#1793)

This commit is contained in:
Mo
2022-10-13 15:48:36 -05:00
committed by GitHub
parent 44a556adf6
commit 1a2dde2e0e
9 changed files with 75 additions and 15 deletions

View File

@@ -51,6 +51,7 @@ import {
SubscriptionManager,
WorkspaceClientInterface,
WorkspaceManager,
ChallengePrompt,
} from '@standardnotes/services'
import { FilesClientInterface } from '@standardnotes/files'
import { ComputePrivateUsername } from '@standardnotes/encryption'
@@ -929,6 +930,24 @@ export class SNApplication
return this.deinit(this.getDeinitMode(), DeinitSource.Lock)
}
public softLockBiometrics(): void {
const challenge = new Challenge(
[new ChallengePrompt(ChallengeValidation.Biometric)],
ChallengeReason.ApplicationUnlock,
false,
)
void this.promptForCustomChallenge(challenge)
void this.notifyEvent(ApplicationEvent.BiometricsSoftLockEngaged)
this.addChallengeObserver(challenge, {
onComplete: () => {
void this.notifyEvent(ApplicationEvent.BiometricsSoftLockDisengaged)
},
})
}
isNativeMobileWeb() {
return this.environment === Environment.NativeMobileWeb
}