-
-
Notifications
You must be signed in to change notification settings - Fork 60
/
rn-secure-storage.d.ts
110 lines (96 loc) · 3.37 KB
/
rn-secure-storage.d.ts
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// Type definitions for rn-secure-storage 3.0.0
// Project: https://github.com/akiver/rn-secure-storage
// Definitions by: Talut TASGIRAN <https://github.com/talut>
// TypeScript Version: 3.9.6
declare module "rn-secure-storage" {
export enum ACCESSIBLE {
/**
* The data in the keychain item cannot be accessed after a restart until the device
* has been unlocked once by the user.
*/
AFTER_FIRST_UNLOCK = "AccessibleAfterFirstUnlock",
/**
* The data in the keychain item cannot be accessed after a restart until the device
* has been unlocked once by the user.
* Items with this attribute never migrate to a new device.
*/
AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY = "AccessibleAfterFirstUnlockThisDeviceOnly",
/**
* The data in the keychain item can always be accessed regardless of whether
* the device is locked.
*/
ALWAYS = "AccessibleAlways",
/**
* The data in the keychain item can always be accessed regardless of whether the
* device is locked.
* Items with this attribute never migrate to a new device.
*/
ALWAYS_THIS_DEVICE_ONLY = "AccessibleAlwaysThisDeviceOnly",
/**
* The data in the keychain can only be accessed when the device is unlocked.
* Only available if a passcode is set on the device.
* Items with this attribute never migrate to a new device.
*/
WHEN_PASSCODE_SET_THIS_DEVICE_ONLY = "AccessibleWhenPasscodeSetThisDeviceOnly",
/**
* The data in the keychain item can be accessed only while the device is
* unlocked by the user.
* This is the default value.
*/
WHEN_UNLOCKED = "AccessibleWhenUnlocked",
/**
* The data in the keychain item can be accessed only while the device is
* unlocked by the user.
* Items with this attribute do not migrate to a new device.
*/
WHEN_UNLOCKED_THIS_DEVICE_ONLY = "AccessibleWhenUnlockedThisDeviceOnly",
}
type SetOptions = {
/**
* iOS ONLY!
* This indicates when a keychain item is accessible, see possible values in RNSecureStorage.ACCESSIBLE.
* Default: ACCESSIBLE.WHEN_UNLOCKED
*/
accessible?: ACCESSIBLE,
}
const RNSecureStorage: RNSecureStorageStatic;
export interface RNSecureStorageStatic {
/**
* Set a value.
*/
setItem(key: string, value: string, options: SetOptions): Promise<string | null>;
/**
* Get a value from secure storage.
*/
getItem(key: string): Promise<string | null>;
/**
* Checks if a key has been set.
*/
exist(key: string): Promise<boolean | null>;
/**
* Get all keys from secure storage.
*/
getAllKeys(): Promise<string[] | null>;
/**
* Multiple key pair set for secure storage
*/
multiSet(pairs: { [key: string]: string }, options: SetOptions): Promise<string[] | null>;
/**
* Get multiple values from secure storage.
*/
multiGet(keys: string[]): Promise<{[key: string]: string} | null>;
/**
* Remove a value from secure storage.
*/
removeItem(key: string): Promise<string | null>;
/**
* Remove values from secure storage (On error will return unremoved keys)
*/
multiRemove(keys: string[]): Promise<string | null>;
/**
* Removes whole RNSecureStorage data (On error will return unremoved keys)
*/
clear(): Promise<string | null>;
}
export default RNSecureStorage;
}