mirror of
https://github.com/status-im/react-native-keychain.git
synced 2025-02-10 20:26:46 +00:00
Throw on methods not yet supported on android
This commit is contained in:
parent
126c69266e
commit
1497383434
17
index.js
17
index.js
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user