1 | declare module 'react-native-keychain' {
|
2 | export interface Result {
|
3 | service: string;
|
4 | storage: string;
|
5 | }
|
6 |
|
7 | export interface UserCredentials extends Result {
|
8 | username: string;
|
9 | password: string;
|
10 | }
|
11 |
|
12 | export interface SharedWebCredentials extends UserCredentials {
|
13 | server: string;
|
14 | }
|
15 |
|
16 | export enum ACCESSIBLE {
|
17 | WHEN_UNLOCKED = 'AccessibleWhenUnlocked',
|
18 | AFTER_FIRST_UNLOCK = 'AccessibleAfterFirstUnlock',
|
19 | ALWAYS = 'AccessibleAlways',
|
20 | WHEN_PASSCODE_SET_THIS_DEVICE_ONLY = 'AccessibleWhenPasscodeSetThisDeviceOnly',
|
21 | WHEN_UNLOCKED_THIS_DEVICE_ONLY = 'AccessibleWhenUnlockedThisDeviceOnly',
|
22 | AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY = 'AccessibleAfterFirstUnlockThisDeviceOnly',
|
23 | ALWAYS_THIS_DEVICE_ONLY = 'AccessibleAlwaysThisDeviceOnly',
|
24 | }
|
25 |
|
26 | export enum ACCESS_CONTROL {
|
27 | USER_PRESENCE = 'UserPresence',
|
28 | BIOMETRY_ANY = 'BiometryAny',
|
29 | BIOMETRY_CURRENT_SET = 'BiometryCurrentSet',
|
30 | DEVICE_PASSCODE = 'DevicePasscode',
|
31 | APPLICATION_PASSWORD = 'ApplicationPassword',
|
32 | BIOMETRY_ANY_OR_DEVICE_PASSCODE = 'BiometryAnyOrDevicePasscode',
|
33 | BIOMETRY_CURRENT_SET_OR_DEVICE_PASSCODE = 'BiometryCurrentSetOrDevicePasscode',
|
34 | }
|
35 |
|
36 | export enum AUTHENTICATION_TYPE {
|
37 | DEVICE_PASSCODE_OR_BIOMETRICS = 'AuthenticationWithBiometricsDevicePasscode',
|
38 | BIOMETRICS = 'AuthenticationWithBiometrics',
|
39 | }
|
40 |
|
41 | export enum SECURITY_LEVEL {
|
42 | SECURE_SOFTWARE,
|
43 | SECURE_HARDWARE,
|
44 | ANY,
|
45 | }
|
46 |
|
47 | export enum BIOMETRY_TYPE {
|
48 | TOUCH_ID = 'TouchID',
|
49 | FACE_ID = 'FaceID',
|
50 | FINGERPRINT = 'Fingerprint',
|
51 | FACE = 'Face',
|
52 | IRIS = 'Iris',
|
53 | }
|
54 |
|
55 | export enum STORAGE_TYPE {
|
56 | FB = 'FacebookConceal',
|
57 | AES = 'KeystoreAESCBC',
|
58 | RSA = 'KeystoreRSAECB',
|
59 | KC = 'keychain',
|
60 | }
|
61 |
|
62 | export enum SECURITY_RULES {
|
63 | NONE = 'none',
|
64 | AUTOMATIC_UPGRADE = 'automaticUpgradeToMoreSecuredStorage',
|
65 | }
|
66 |
|
67 | export interface AuthenticationPrompt {
|
68 | title?: string;
|
69 | subtitle?: string;
|
70 | description?: string;
|
71 | cancel?: string;
|
72 | }
|
73 |
|
74 | export interface Options {
|
75 | accessControl?: ACCESS_CONTROL;
|
76 | accessGroup?: string;
|
77 | accessible?: ACCESSIBLE;
|
78 | authenticationPrompt?: string | AuthenticationPrompt;
|
79 | authenticationType?: AUTHENTICATION_TYPE;
|
80 | service?: string;
|
81 | securityLevel?: SECURITY_LEVEL;
|
82 | storage?: STORAGE_TYPE;
|
83 | rules?: SECURITY_RULES;
|
84 | }
|
85 |
|
86 | function setGenericPassword(
|
87 | username: string,
|
88 | password: string,
|
89 | options?: Options
|
90 | ): Promise<false | Result>;
|
91 |
|
92 | function getGenericPassword(
|
93 | options?: Options
|
94 | ): Promise<false | UserCredentials>;
|
95 |
|
96 | function resetGenericPassword(options?: Options): Promise<boolean>;
|
97 |
|
98 | function hasInternetCredentials(server: string): Promise<false | Result>;
|
99 |
|
100 | function setInternetCredentials(
|
101 | server: string,
|
102 | username: string,
|
103 | password: string,
|
104 | options?: Options
|
105 | ): Promise<false | Result>;
|
106 |
|
107 | function getInternetCredentials(
|
108 | server: string,
|
109 | options?: Options
|
110 | ): Promise<false | SharedWebCredentials>;
|
111 |
|
112 | function resetInternetCredentials(
|
113 | server: string,
|
114 | options?: Options
|
115 | ): Promise<void>;
|
116 |
|
117 | function getSupportedBiometryType(
|
118 | options?: Options
|
119 | ): Promise<null | BIOMETRY_TYPE>;
|
120 |
|
121 |
|
122 |
|
123 | function requestSharedWebCredentials(): Promise<false | SharedWebCredentials>;
|
124 |
|
125 | function setSharedWebCredentials(
|
126 | server: string,
|
127 | username: string,
|
128 | password?: string
|
129 | ): Promise<void>;
|
130 |
|
131 | function canImplyAuthentication(options?: Options): Promise<boolean>;
|
132 |
|
133 |
|
134 |
|
135 | function getSecurityLevel(options?: Options): Promise<null | SECURITY_LEVEL>;
|
136 | }
|