react-native-keychain icon indicating copy to clipboard operation
react-native-keychain copied to clipboard

fix: update alias handling in CipherStorage to include prefix based on cipher and auth requirements

Open Bowlerr opened this issue 9 months ago • 5 comments

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>
  • Adds helper function getPrefixedAlias in CipherStorageKeystoreAesGcm.kt
  • Call helper function when using alias
  • Migration process:
    1. Attempts to use new prefixed alias
    2. Falls back to legacy format if needed
    3. Verifies new key functionality
    4. Safely removes old key

Updated to handle migration on Base Storage for each cipher having it's own prefix.

Bowlerr avatar Mar 17 '25 18:03 Bowlerr