Rename customPrompt to authenticationPrompt

This commit is contained in:
Joel Arvidsson 2018-02-25 23:42:15 +01:00
parent 7efae775e1
commit 9c734ac9f9
3 changed files with 8 additions and 8 deletions

View File

@ -111,7 +111,7 @@ NSString *serviceValue(NSDictionary *options)
#pragma mark - Proposed functionality - Helpers #pragma mark - Proposed functionality - Helpers
#define kAuthenticationType @"authenticationType" #define kAuthenticationType @"authenticationType"
#define kBiometrics @"AuthenticationWithBiometrics" #define kAuthenticationTypeBiometrics @"AuthenticationWithBiometrics"
#define kAccessControlType @"accessControl" #define kAccessControlType @"accessControl"
#define kAccessControlUserPresence @"UserPresence" #define kAccessControlUserPresence @"UserPresence"
@ -124,12 +124,12 @@ NSString *serviceValue(NSDictionary *options)
#define kBiometryTypeTouchID @"TouchID" #define kBiometryTypeTouchID @"TouchID"
#define kBiometryTypeFaceID @"FaceID" #define kBiometryTypeFaceID @"FaceID"
#define kCustomPromptMessage @"customPrompt" #define kAuthenticationPromptMessage @"authenticationPrompt"
LAPolicy authPolicy(NSDictionary *options) LAPolicy authPolicy(NSDictionary *options)
{ {
if (options && options[kAuthenticationType]) { if (options && options[kAuthenticationType]) {
if ([ options[kAuthenticationType] isEqualToString:kBiometrics ]) { if ([ options[kAuthenticationType] isEqualToString:kAuthenticationTypeBiometrics ]) {
return LAPolicyDeviceOwnerAuthenticationWithBiometrics; return LAPolicyDeviceOwnerAuthenticationWithBiometrics;
} }
} }
@ -264,8 +264,8 @@ RCT_EXPORT_METHOD(getPasswordWithAuthentication:(NSDictionary *)options resolver
{ {
NSString *service = serviceValue(options); NSString *service = serviceValue(options);
NSString *promptMessage = @"Authenticate to retrieve secret!"; NSString *promptMessage = @"Authenticate to retrieve secret!";
if (options && options[kCustomPromptMessage]) { if (options && options[kAuthenticationPromptMessage]) {
promptMessage = options[kCustomPromptMessage]; promptMessage = options[kAuthenticationPromptMessage];
} }
NSMutableDictionary *dict = @{ (__bridge NSString *)kSecClass : (__bridge id)(kSecClassGenericPassword), NSMutableDictionary *dict = @{ (__bridge NSString *)kSecClass : (__bridge id)(kSecClassGenericPassword),

View File

@ -58,7 +58,7 @@ type LAPolicy = 'Authentication' | 'AuthenticationWithBiometrics';
type SecureOptions = { type SecureOptions = {
service?: string, service?: string,
customPrompt?: string, authenticationPrompt?: string,
authenticationType?: LAPolicy, authenticationType?: LAPolicy,
accessControl?: SecAccessControl, accessControl?: SecAccessControl,
}; };

View File

@ -12,8 +12,8 @@ declare module 'react-native-keychain' {
} }
export interface SecureOptions { export interface SecureOptions {
service: string; service?: string;
customPrompt?: string; authenticationPrompt?: string;
authenticationType?: string; authenticationType?: string;
accessControl?: string; accessControl?: string;
} }