From df02a7bd0b12ef53e3472e6e0213e9c930bf0bc1 Mon Sep 17 00:00:00 2001 From: Berend Sliedrecht Date: Wed, 20 Nov 2024 15:25:44 +0100 Subject: [PATCH] feat: allow toggle to use fallback always Signed-off-by: Berend Sliedrecht --- src/SecureEnvironment.ts | 4 ++++ src/index.ts | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/SecureEnvironment.ts b/src/SecureEnvironment.ts index b0a63be..105b6c9 100644 --- a/src/SecureEnvironment.ts +++ b/src/SecureEnvironment.ts @@ -41,5 +41,9 @@ export const getSecureEnvironment = () => { return fallbackSecureEnvironment } +export const shouldUseFallbackSecureEnvironment = (useFallback: boolean) => { + isExpoSecureEnvironmentSupported = !useFallback +} + export const isLocalSecureEnvironmentSupported = () => Platform.OS === 'ios' ? true : expoSecureEnvironment.supportsSecureEnvironment() diff --git a/src/index.ts b/src/index.ts index 71b0aed..668ca57 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,7 +4,12 @@ import { SubjectPublicKeyInfo } from '@peculiar/asn1-x509' import { Platform } from 'expo-modules-core' import { getSecureEnvironment } from './SecureEnvironment' -export { SecureEnvironment, setFallbackSecureEnvironment, isLocalSecureEnvironmentSupported } from './SecureEnvironment' +export { + SecureEnvironment, + setFallbackSecureEnvironment, + isLocalSecureEnvironmentSupported, + shouldUseFallbackSecureEnvironment, +} from './SecureEnvironment' export async function generateKeypair(id: string, biometricsBacked = true): Promise { await getSecureEnvironment().generateKeypair(id, biometricsBacked)