Throw on methods not yet supported on android

This commit is contained in:
Joel Arvidsson 2018-02-25 16:29:33 +01:00
parent 126c69266e
commit 1497383434
1 changed files with 17 additions and 0 deletions

View File

@ -39,6 +39,13 @@ type SecureOptions = {
* @return {Promise} Resolves to `true` when successful * @return {Promise} Resolves to `true` when successful
*/ */
export function canImplyAuthentication(options?: SecureOptions): Promise { export function canImplyAuthentication(options?: SecureOptions): Promise {
if (Platform.OS !== 'ios') {
return Promise.reject(
new Error(
`canImplyAuthentication() is not supported on ${Platform.OS} yet`
)
);
}
return RNKeychainManager.canCheckAuthentication(options); return RNKeychainManager.canCheckAuthentication(options);
} }
@ -56,6 +63,11 @@ export function setSecurePassword(
password: string, password: string,
options?: SecureOptions options?: SecureOptions
): Promise { ): Promise {
if (Platform.OS !== 'ios') {
return Promise.reject(
new Error(`setSecurePassword() is not supported on ${Platform.OS} yet`)
);
}
return RNKeychainManager.setSecurePasswordForService( return RNKeychainManager.setSecurePasswordForService(
service, service,
username, username,
@ -73,6 +85,11 @@ export function getSecurePassword(
service: string, service: string,
options?: SecureOptions options?: SecureOptions
): Promise { ): Promise {
if (Platform.OS !== 'ios') {
return Promise.reject(
new Error(`getSecurePassword() is not supported on ${Platform.OS} yet`)
);
}
return RNKeychainManager.getSecurePasswordForService(service, options); return RNKeychainManager.getSecurePasswordForService(service, options);
} }