How to use the react-native-keychain.ACCESSIBLE function in react-native-keychain

To help you get started, we’ve selected a few react-native-keychain examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MetaMask / metamask-mobile / app / core / SecureKeychain.js View on Github external
const decrypted = await instance.decryptPassword(encryptedPassword);
				keychainObject.password = decrypted.password;
				instance.isAuthenticating = false;
				return keychainObject;
			}
			instance.isAuthenticating = false;
		}
		return null;
	},

	async setGenericPassword(key, password, authOptions) {
		const encryptedPassword = await instance.encryptPassword(password);
		return Keychain.setGenericPassword(key, encryptedPassword, { ...defaultOptions, ...authOptions });
	},
	ACCESS_CONTROL: Keychain.ACCESS_CONTROL,
	ACCESSIBLE: Keychain.ACCESSIBLE,
	AUTHENTICATION_TYPE: Keychain.AUTHENTICATION_TYPE
};
github pillarwallet / pillarwallet / src / utils / keychain.js View on Github external
export const setKeychainDataObject = (data: KeyChainData) => Keychain
  .setGenericPassword(KEYCHAIN_DATA_KEY, JSON.stringify(data), {
    accessControl: Platform.select({
      ios: Keychain.ACCESS_CONTROL.BIOMETRY_ANY_OR_DEVICE_PASSCODE,
      android: Keychain.ACCESS_CONTROL.BIOMETRY_ANY,
    }),
    accessible: Keychain.ACCESSIBLE.WHEN_UNLOCKED,
    service: KEYCHAIN_SERVICE,
  })
  .catch(() => null);
github Emurgo / yoroi-mobile / src / crypto / KeyStore.js View on Github external
if (Platform.OS === 'android') {
      await KeyStoreBridge.initFingerprintKeys(dataKey)

      const fingerprintEncryptedMasterKey = await KeyStoreBridge.encryptData(
        masterKey,
        dataKey,
      )

      return fingerprintEncryptedMasterKey
    }

    if (Platform.OS === 'ios') {
      await Keychain.setGenericPassword('', masterKey, {
        service: dataKey,
        accessControl: Keychain.ACCESS_CONTROL.BIOMETRY_ANY_OR_DEVICE_PASSCODE,
        accessible: Keychain.ACCESSIBLE.WHEN_UNLOCKED_THIS_DEVICE_ONLY,
      })
      return ''
    }

    throw new Error('Unsupported platform')
  }
github burst-apps-team / phoenix / mobile / src / core / utils / keychain.ts View on Github external
export function setCredentials ({ username, password }: KeychainCredentials, service?: string): Promise {
  return Keychain.setGenericPassword(
    username,
    password,
    { service, accessible: Keychain.ACCESSIBLE.AFTER_FIRST_UNLOCK }
  );
}