react-native-keychain
react-native-keychain copied to clipboard
fix: update alias handling in CipherStorage to include prefix based on cipher and auth requirements
Merge in https://github.com/oblador/react-native-keychain/pull/746 first to fix tests
Fixes - https://github.com/oblador/react-native-keychain/issues/730 if I understood correctly, this issue is caused by bio and non bio auth alias being considered the same. This prefix solves that issue. @DorianMazur is also working on a solution but was wondering if this fix would work so I can patch it in asap.
Changes
- New prefixed format:
- Authenticated:
AES_GCM_<alias> - Standard:
AES_GCM_NO_AUTH_<alias>
- Authenticated:
- Adds helper function
getPrefixedAliasinCipherStorageKeystoreAesGcm.kt - Call helper function when using alias
- Migration process:
- Attempts to use new prefixed alias
- Falls back to legacy format if needed
- Verifies new key functionality
- Safely removes old key
Updated to handle migration on Base Storage for each cipher having it's own prefix.