forked from SelfLender/react-native-biometrics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
61 lines (58 loc) · 1.98 KB
/
Copy pathindex.js
File metadata and controls
61 lines (58 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { NativeModules } from 'react-native'
const { ReactNativeBiometrics } = NativeModules
export default {
/**
* Enum for touch id sensor type
*/
TouchID: 'TouchID',
/**
* Enum for face id sensor type
*/
FaceID: 'FaceID',
/**
* Returns promise that resolves to null, TouchID, or FaceID
* @returns {Promise} Promise that resolves to null, TouchID, or FaceID
*/
isSensorAvailable: () => {
return ReactNativeBiometrics.isSensorAvailable()
},
/**
* Prompts user with biometrics dialog using the passed in prompt message if
* it is provided, returns promise that resolves to the public key of the
* newly generated key pair
* @param {string} promptMessage
* @returns {Promise} Promise that resolves to newly generated public key
*/
createKeys: (promptMessage) => {
return ReactNativeBiometrics.createKeys(promptMessage)
},
/**
* Returns promise that resolves to true or false indicating if the keys
* were properly deleted
* @returns {Promise} Promise that resolves to true or false
*/
deleteKeys: () => {
return ReactNativeBiometrics.deleteKeys()
},
/**
* Prompts user with biometrics dialog using the passed in prompt message and
* returns promise that resolves to a cryptographic signature of the payload
* @param {string} promptMessage
* @param {string} payload
* @returns {Promise} Promise that resolves to cryptographic signature
*/
createSignature: (promptMessage, payload) => {
return ReactNativeBiometrics.createSignature(promptMessage, payload)
},
/**
* Prompts user with biometrics dialog using the passed in prompt message and
* returns promise that resolves if the user passes, and
* rejects if the user fails or cancels
* @param {string} promptMessage
* @returns {Promise} Promise that resolves if the user passes, and
* rejects if the user fails or cancels
*/
simplePrompt: (promptMessage) => {
return ReactNativeBiometrics.simplePrompt(promptMessage)
}
}