mirror of
https://github.com/status-im/react-native-keychain.git
synced 2025-02-17 15:47:29 +00:00
Fix tvOS support
This commit is contained in:
parent
8a30ba0341
commit
9455bac5e9
@ -9,30 +9,36 @@
|
|||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
5D82368F1B0CE3CB005A9EF3 /* RNKeychainManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D82368C1B0CE2A6005A9EF3 /* RNKeychainManager.m */; };
|
5D82368F1B0CE3CB005A9EF3 /* RNKeychainManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D82368C1B0CE2A6005A9EF3 /* RNKeychainManager.m */; };
|
||||||
5D8236911B0CE3D6005A9EF3 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D8236901B0CE3D6005A9EF3 /* Security.framework */; };
|
5D8236911B0CE3D6005A9EF3 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D8236901B0CE3D6005A9EF3 /* Security.framework */; };
|
||||||
B2AF06371E97BF10006435CD /* LocalAuthentication.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2AF06361E97BF10006435CD /* LocalAuthentication.framework */; };
|
5DE632D52043423E004F9598 /* LocalAuthentication.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DE632D42043423E004F9598 /* LocalAuthentication.framework */; };
|
||||||
B2AF063D1E97DE25006435CD /* RNKeychainAuthenticationListener.h in Headers */ = {isa = PBXBuildFile; fileRef = B22856161E950BB300CCF753 /* RNKeychainAuthenticationListener.h */; };
|
5DE632D720434276004F9598 /* RNKeychainAuthenticationListener.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5DE632D62043426A004F9598 /* RNKeychainAuthenticationListener.h */; };
|
||||||
B2AF063F1E97DF85006435CD /* RNKeychainAuthenticationListener.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = B22856161E950BB300CCF753 /* RNKeychainAuthenticationListener.h */; };
|
5DE632D920434291004F9598 /* RNKeychainAuthenticationListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DE632D62043426A004F9598 /* RNKeychainAuthenticationListener.h */; };
|
||||||
|
5DE632DB204342AE004F9598 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DE632DA204342AE004F9598 /* Security.framework */; };
|
||||||
|
5DE632DC204342B5004F9598 /* RNKeychainAuthenticationListener.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 5DE632D62043426A004F9598 /* RNKeychainAuthenticationListener.h */; };
|
||||||
|
5DE632DE204342C3004F9598 /* RNKeychainAuthenticationListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DE632D62043426A004F9598 /* RNKeychainAuthenticationListener.h */; };
|
||||||
|
6478986B1F38BFA100DA1C12 /* RNKeychainManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D82368C1B0CE2A6005A9EF3 /* RNKeychainManager.m */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXCopyFilesBuildPhase section */
|
/* Begin PBXCopyFilesBuildPhase section */
|
||||||
5D82366D1B0CE05B005A9EF3 /* Copy Headers */ = {
|
5D82366D1B0CE05B005A9EF3 /* Copy Headers */ = {
|
||||||
isa = PBXCopyFilesBuildPhase;
|
isa = PBXCopyFilesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
dstPath = include/RNKeychain;
|
dstPath = "include/$(PRODUCT_NAME)";
|
||||||
dstSubfolderSpec = 16;
|
dstSubfolderSpec = 16;
|
||||||
files = (
|
files = (
|
||||||
B2AF063F1E97DF85006435CD /* RNKeychainAuthenticationListener.h in Copy Headers */,
|
5DE632D720434276004F9598 /* RNKeychainAuthenticationListener.h in Copy Headers */,
|
||||||
);
|
);
|
||||||
name = "Copy Headers";
|
name = "Copy Headers";
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
6478985D1F38BF9100DA1C12 /* CopyFiles */ = {
|
6478985D1F38BF9100DA1C12 /* Copy Headers */ = {
|
||||||
isa = PBXCopyFilesBuildPhase;
|
isa = PBXCopyFilesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
dstPath = "include/$(PRODUCT_NAME)";
|
dstPath = "include/$(PRODUCT_NAME)";
|
||||||
dstSubfolderSpec = 16;
|
dstSubfolderSpec = 16;
|
||||||
files = (
|
files = (
|
||||||
|
5DE632DC204342B5004F9598 /* RNKeychainAuthenticationListener.h in Copy Headers */,
|
||||||
);
|
);
|
||||||
|
name = "Copy Headers";
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
/* End PBXCopyFilesBuildPhase section */
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
@ -42,8 +48,10 @@
|
|||||||
5D82368B1B0CE2A6005A9EF3 /* RNKeychainManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNKeychainManager.h; sourceTree = "<group>"; };
|
5D82368B1B0CE2A6005A9EF3 /* RNKeychainManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNKeychainManager.h; sourceTree = "<group>"; };
|
||||||
5D82368C1B0CE2A6005A9EF3 /* RNKeychainManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNKeychainManager.m; sourceTree = "<group>"; };
|
5D82368C1B0CE2A6005A9EF3 /* RNKeychainManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNKeychainManager.m; sourceTree = "<group>"; };
|
||||||
5D8236901B0CE3D6005A9EF3 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
|
5D8236901B0CE3D6005A9EF3 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
|
||||||
B22856161E950BB300CCF753 /* RNKeychainAuthenticationListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNKeychainAuthenticationListener.h; sourceTree = "<group>"; };
|
5DE632D42043423E004F9598 /* LocalAuthentication.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LocalAuthentication.framework; path = System/Library/Frameworks/LocalAuthentication.framework; sourceTree = SDKROOT; };
|
||||||
B2AF06361E97BF10006435CD /* LocalAuthentication.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LocalAuthentication.framework; path = System/Library/Frameworks/LocalAuthentication.framework; sourceTree = SDKROOT; };
|
5DE632D62043426A004F9598 /* RNKeychainAuthenticationListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNKeychainAuthenticationListener.h; sourceTree = "<group>"; };
|
||||||
|
5DE632DA204342AE004F9598 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS11.2.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; };
|
||||||
|
6478985F1F38BF9100DA1C12 /* libRNKeychain.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNKeychain.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@ -51,7 +59,7 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
B2AF06371E97BF10006435CD /* LocalAuthentication.framework in Frameworks */,
|
5DE632D52043423E004F9598 /* LocalAuthentication.framework in Frameworks */,
|
||||||
5D8236911B0CE3D6005A9EF3 /* Security.framework in Frameworks */,
|
5D8236911B0CE3D6005A9EF3 /* Security.framework in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@ -60,7 +68,7 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
6478986A1F38BF9D00DA1C12 /* Security.framework in Frameworks */,
|
5DE632DB204342AE004F9598 /* Security.framework in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -72,7 +80,7 @@
|
|||||||
children = (
|
children = (
|
||||||
5D82368A1B0CE2A6005A9EF3 /* RNKeychainManager */,
|
5D82368A1B0CE2A6005A9EF3 /* RNKeychainManager */,
|
||||||
5D8236701B0CE05B005A9EF3 /* Products */,
|
5D8236701B0CE05B005A9EF3 /* Products */,
|
||||||
B2AF06351E97BF10006435CD /* Frameworks */,
|
647898681F38BF9C00DA1C12 /* Frameworks */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
wrapsLines = 0;
|
wrapsLines = 0;
|
||||||
@ -89,17 +97,19 @@
|
|||||||
5D82368A1B0CE2A6005A9EF3 /* RNKeychainManager */ = {
|
5D82368A1B0CE2A6005A9EF3 /* RNKeychainManager */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
5DE632D62043426A004F9598 /* RNKeychainAuthenticationListener.h */,
|
||||||
5D82368B1B0CE2A6005A9EF3 /* RNKeychainManager.h */,
|
5D82368B1B0CE2A6005A9EF3 /* RNKeychainManager.h */,
|
||||||
5D82368C1B0CE2A6005A9EF3 /* RNKeychainManager.m */,
|
5D82368C1B0CE2A6005A9EF3 /* RNKeychainManager.m */,
|
||||||
B22856161E950BB300CCF753 /* RNKeychainAuthenticationListener.h */,
|
|
||||||
);
|
);
|
||||||
path = RNKeychainManager;
|
path = RNKeychainManager;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
B2AF06351E97BF10006435CD /* Frameworks */ = {
|
647898681F38BF9C00DA1C12 /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
B2AF06361E97BF10006435CD /* LocalAuthentication.framework */,
|
5DE632DA204342AE004F9598 /* Security.framework */,
|
||||||
|
5DE632D42043423E004F9598 /* LocalAuthentication.framework */,
|
||||||
|
5D8236901B0CE3D6005A9EF3 /* Security.framework */,
|
||||||
);
|
);
|
||||||
name = Frameworks;
|
name = Frameworks;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -107,11 +117,19 @@
|
|||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
|
|
||||||
/* Begin PBXHeadersBuildPhase section */
|
/* Begin PBXHeadersBuildPhase section */
|
||||||
B2AF063C1E97DE1E006435CD /* Headers */ = {
|
5DE632D820434281004F9598 /* Headers */ = {
|
||||||
isa = PBXHeadersBuildPhase;
|
isa = PBXHeadersBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
B2AF063D1E97DE25006435CD /* RNKeychainAuthenticationListener.h in Headers */,
|
5DE632D920434291004F9598 /* RNKeychainAuthenticationListener.h in Headers */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
5DE632DD204342BC004F9598 /* Headers */ = {
|
||||||
|
isa = PBXHeadersBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
5DE632DE204342C3004F9598 /* RNKeychainAuthenticationListener.h in Headers */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -124,7 +142,7 @@
|
|||||||
buildPhases = (
|
buildPhases = (
|
||||||
5D82366B1B0CE05B005A9EF3 /* Sources */,
|
5D82366B1B0CE05B005A9EF3 /* Sources */,
|
||||||
5D82366C1B0CE05B005A9EF3 /* Frameworks */,
|
5D82366C1B0CE05B005A9EF3 /* Frameworks */,
|
||||||
B2AF063C1E97DE1E006435CD /* Headers */,
|
5DE632D820434281004F9598 /* Headers */,
|
||||||
5D82366D1B0CE05B005A9EF3 /* Copy Headers */,
|
5D82366D1B0CE05B005A9EF3 /* Copy Headers */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
@ -142,7 +160,8 @@
|
|||||||
buildPhases = (
|
buildPhases = (
|
||||||
6478985B1F38BF9100DA1C12 /* Sources */,
|
6478985B1F38BF9100DA1C12 /* Sources */,
|
||||||
6478985C1F38BF9100DA1C12 /* Frameworks */,
|
6478985C1F38BF9100DA1C12 /* Frameworks */,
|
||||||
6478985D1F38BF9100DA1C12 /* CopyFiles */,
|
5DE632DD204342BC004F9598 /* Headers */,
|
||||||
|
6478985D1F38BF9100DA1C12 /* Copy Headers */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
|
@ -165,6 +165,7 @@ SecAccessControlCreateFlags secureAccessControl(NSDictionary *options)
|
|||||||
|
|
||||||
#pragma mark - Proposed functionality - RCT_EXPORT_METHOD
|
#pragma mark - Proposed functionality - RCT_EXPORT_METHOD
|
||||||
|
|
||||||
|
#if TARGET_OS_IOS
|
||||||
RCT_EXPORT_METHOD(canCheckAuthentication:(NSDictionary *)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
RCT_EXPORT_METHOD(canCheckAuthentication:(NSDictionary *)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
||||||
{
|
{
|
||||||
LAPolicy policyToEvaluate = authPolicy(options);
|
LAPolicy policyToEvaluate = authPolicy(options);
|
||||||
@ -178,7 +179,9 @@ RCT_EXPORT_METHOD(canCheckAuthentication:(NSDictionary *)options resolver:(RCTPr
|
|||||||
return resolve(@(YES));
|
return resolve(@(YES));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if TARGET_OS_IOS
|
||||||
RCT_EXPORT_METHOD(getSupportedBiometryType:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
RCT_EXPORT_METHOD(getSupportedBiometryType:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
||||||
{
|
{
|
||||||
NSError *aerr = nil;
|
NSError *aerr = nil;
|
||||||
@ -193,8 +196,10 @@ RCT_EXPORT_METHOD(getSupportedBiometryType:(RCTPromiseResolveBlock)resolve rejec
|
|||||||
}
|
}
|
||||||
return resolve(kBiometryTypeTouchID);
|
return resolve(kBiometryTypeTouchID);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolve([NSNull null]);
|
return resolve([NSNull null]);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
- (BOOL) canCheckAuthentication:(LAPolicy)policyToEvaluate error:(NSError **)err {
|
- (BOOL) canCheckAuthentication:(LAPolicy)policyToEvaluate error:(NSError **)err {
|
||||||
return [[[ LAContext alloc] init ] canEvaluatePolicy:policyToEvaluate error:err ];
|
return [[[ LAContext alloc] init ] canEvaluatePolicy:policyToEvaluate error:err ];
|
||||||
|
8
index.js
8
index.js
@ -70,11 +70,9 @@ type SecureOptions = {
|
|||||||
* @return {Promise} Resolves to `true` when supported, otherwise `false`
|
* @return {Promise} Resolves to `true` when supported, otherwise `false`
|
||||||
*/
|
*/
|
||||||
export function canImplyAuthentication(options?: SecureOptions): Promise {
|
export function canImplyAuthentication(options?: SecureOptions): Promise {
|
||||||
if (Platform.OS !== 'ios') {
|
if (RNKeychainManager.canCheckAuthentication) {
|
||||||
return Promise.reject(
|
return Promise.reject(
|
||||||
new Error(
|
new Error(`canImplyAuthentication() is not supported on this platform`)
|
||||||
`canImplyAuthentication() is not supported on ${Platform.OS} yet`
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return RNKeychainManager.canCheckAuthentication(options);
|
return RNKeychainManager.canCheckAuthentication(options);
|
||||||
@ -86,7 +84,7 @@ export function canImplyAuthentication(options?: SecureOptions): Promise {
|
|||||||
* @return {Promise} Resolves to a `BIOMETRY_TYPE` when supported, otherwise `null`
|
* @return {Promise} Resolves to a `BIOMETRY_TYPE` when supported, otherwise `null`
|
||||||
*/
|
*/
|
||||||
export function getSupportedBiometryType(): Promise {
|
export function getSupportedBiometryType(): Promise {
|
||||||
if (Platform.OS !== 'ios') {
|
if (!RNKeychainManager.getSupportedBiometryType) {
|
||||||
return Promise.resolve(null);
|
return Promise.resolve(null);
|
||||||
}
|
}
|
||||||
return RNKeychainManager.getSupportedBiometryType();
|
return RNKeychainManager.getSupportedBiometryType();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user