-
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2687 from kaloudis/zeus-2683
ZEUS-2683: Storage: migrate from `react-native-encrypted-storage` to `react-native-keychain`
- Loading branch information
Showing
35 changed files
with
1,353 additions
and
562 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import * as Keychain from 'react-native-keychain'; | ||
|
||
class Storage { | ||
getItem = async (key: string) => { | ||
const response: any = await Keychain.getInternetCredentials(key); | ||
if (response.password) { | ||
return response.password; | ||
} | ||
return false; | ||
}; | ||
|
||
setItem = async (key: string, value: any) => { | ||
const response = await Keychain.setInternetCredentials( | ||
key, | ||
key, | ||
typeof value === 'string' ? value : JSON.stringify(value) | ||
); | ||
return response; | ||
}; | ||
|
||
removeItem = async (key: string) => { | ||
const response = await Keychain.resetInternetCredentials(key); | ||
return response; | ||
}; | ||
} | ||
|
||
const storage = new Storage(); | ||
export default storage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.