From add30b5399ecea20db82b1dbfcab039f11ce0dfe Mon Sep 17 00:00:00 2001 From: Subhankar Maiti Date: Tue, 11 Mar 2025 20:17:47 +0530 Subject: [PATCH 1/2] Added deviceCredentialFallback default value --- README.md | 20 ++++++++++---------- src/utils/addDefaultLocalAuthOptions.ts | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 31f72091..7e5eee48 100644 --- a/README.md +++ b/README.md @@ -468,16 +468,16 @@ The options for configuring the display of local authentication prompt, authenti **Properties:** -| Property | Type | Description | Applicable Platforms | -| -------------------------- | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | -------------------- | -| `title` | `String` | The title of the authentication prompt. | Android, iOS | -| `subtitle` | `String` (optional) | The subtitle of the authentication prompt. | Android | -| `description` | `String` (optional) | The description of the authentication prompt. | Android | -| `cancelTitle` | `String` (optional) | The cancel button title of the authentication prompt. | Android, iOS | -| `evaluationPolicy` | `LocalAuthenticationStrategy` (optional) | The evaluation policy to use when prompting the user for authentication. Defaults to `deviceOwnerWithBiometrics`. | iOS | -| `fallbackTitle` | `String` (optional) | The fallback button title of the authentication prompt. | iOS | -| `authenticationLevel` | `LocalAuthenticationLevel` (optional) | The authentication level to use when prompting the user for authentication. Defaults to `strong`. | Android | -| `deviceCredentialFallback` | `Boolean` (optional) | Should the user be given the option to authenticate with their device PIN, pattern, or password instead of a biometric. | Android | +| Property | Type | Description | Applicable Platforms | +| -------------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | +| `title` | `String` | The title of the authentication prompt. | Android, iOS | +| `subtitle` | `String` (optional) | The subtitle of the authentication prompt. | Android | +| `description` | `String` (optional) | The description of the authentication prompt. | Android | +| `cancelTitle` | `String` (optional) | The cancel button title of the authentication prompt. | Android, iOS | +| `evaluationPolicy` | `LocalAuthenticationStrategy` (optional) | The evaluation policy to use when prompting the user for authentication. Defaults to `deviceOwnerWithBiometrics`. | iOS | +| `fallbackTitle` | `String` (optional) | The fallback button title of the authentication prompt. | iOS | +| `authenticationLevel` | `LocalAuthenticationLevel` (optional) | The authentication level to use when prompting the user for authentication. Defaults to `strong`. | Android | +| `deviceCredentialFallback` | `Boolean` (optional) | Should the user be given the option to authenticate with their device PIN, pattern, or password instead of a biometric. Defaults to `false` | Android | > :warning: You need a real device to test Local Authentication for iOS. Local Authentication is not available in simulators. diff --git a/src/utils/addDefaultLocalAuthOptions.ts b/src/utils/addDefaultLocalAuthOptions.ts index 7c80fef5..d8d3d771 100644 --- a/src/utils/addDefaultLocalAuthOptions.ts +++ b/src/utils/addDefaultLocalAuthOptions.ts @@ -5,6 +5,7 @@ import LocalAuthenticationLevel from '../credentials-manager/localAuthentication const defaultLocalAuthOptions = { evaluationPolicy: LocalAuthenticationStrategy.deviceOwnerWithBiometrics, authenticationLevel: LocalAuthenticationLevel.strong, + deviceCredentialFallback: false, }; function addDefaultLocalAuthOptions( From e934c0c746a91ca10e222b06a3de80318b73faad Mon Sep 17 00:00:00 2001 From: Subhankar Maiti Date: Tue, 11 Mar 2025 20:39:18 +0530 Subject: [PATCH 2/2] fix: unit test cases --- src/utils/__tests__/addDefaultLocalAuthOptions.spec.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utils/__tests__/addDefaultLocalAuthOptions.spec.js b/src/utils/__tests__/addDefaultLocalAuthOptions.spec.js index b4dbcf32..4a1e942d 100644 --- a/src/utils/__tests__/addDefaultLocalAuthOptions.spec.js +++ b/src/utils/__tests__/addDefaultLocalAuthOptions.spec.js @@ -10,6 +10,7 @@ describe('addDefaultLocalAuthenticationOptions', () => { title: 'Please authenticate', authenticationLevel: LocalAuthenticationLevel.strong, evaluationPolicy: LocalAuthenticationStrategy.deviceOwnerWithBiometrics, + deviceCredentialFallback: false, }); }); @@ -18,6 +19,7 @@ describe('addDefaultLocalAuthenticationOptions', () => { title: 'Please authenticate', authenticationLevel: LocalAuthenticationLevel.deviceCredential, evaluationPolicy: LocalAuthenticationStrategy.deviceOwner, + deviceCredentialFallback: false, }; const result = addDefaultLocalAuthOptions(localAuthOptions); expect(result).toEqual(localAuthOptions); @@ -33,6 +35,7 @@ describe('addDefaultLocalAuthenticationOptions', () => { title: 'Please authenticate', authenticationLevel: LocalAuthenticationLevel.deviceCredential, evaluationPolicy: LocalAuthenticationStrategy.deviceOwnerWithBiometrics, + deviceCredentialFallback: false, }); }); });