diff options
author | Kirill Rogovoy <[email protected]> | 2021-07-23 11:02:26 +0300 |
---|---|---|
committer | Kirill Rogovoy <[email protected]> | 2021-07-23 11:02:26 +0300 |
commit | 73308af061af5e17ac7d4a73fa027a2f303c70dd (patch) | |
tree | 816fb8231e13f58f7afe822742513b3150cdc871 /app_expo/utils/keychain.ts | |
parent | b8c58914cc1e251ce161905340647b6824d0a7c4 (diff) |
Update graph data when Emacs node changes + minor improvements
Diffstat (limited to 'app_expo/utils/keychain.ts')
-rw-r--r-- | app_expo/utils/keychain.ts | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/app_expo/utils/keychain.ts b/app_expo/utils/keychain.ts deleted file mode 100644 index bcbc379..0000000 --- a/app_expo/utils/keychain.ts +++ /dev/null @@ -1,63 +0,0 @@ -import * as ReactNativeKeychain from 'react-native-keychain' - -/** - * Saves some credentials securely. - * - * @param username The username - * @param password The password - * @param server The server these creds are for. - */ -export async function save(username: string, password: string, server?: string) { - if (server) { - await ReactNativeKeychain.setInternetCredentials(server, username, password) - return true - } else { - return ReactNativeKeychain.setGenericPassword(username, password) - } -} - -/** - * Loads credentials that were already saved. - * - * @param server The server that these creds are for - */ -export async function load(server?: string) { - if (server) { - const creds = await ReactNativeKeychain.getInternetCredentials(server) - return { - username: creds ? creds.username : null, - password: creds ? creds.password : null, - server, - } - } else { - const creds = await ReactNativeKeychain.getGenericPassword() - if (typeof creds === 'object') { - return { - username: creds.username, - password: creds.password, - server: null, - } - } else { - return { - username: null, - password: null, - server: null, - } - } - } -} - -/** - * Resets any existing credentials for the given server. - * - * @param server The server which has these creds - */ -export async function reset(server?: string) { - if (server) { - await ReactNativeKeychain.resetInternetCredentials(server) - return true - } else { - const result = await ReactNativeKeychain.resetGenericPassword() - return result - } -} |