Registry /
security / keychain-synced-storage
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
createKeychainSyncedStorage
✓ import { createKeychainSyncedStorage } from 'keychain-synced-storage'
✗ import createKeychainSyncedStorage from 'keychain-synced-storage'
Library only exports named function, not default.
KeychainSyncedStore
✓ const { store: KeychainSyncedStore } = createKeychainSyncedStorage(config)
✗ import { KeychainSyncedStore } from 'keychain-synced-storage'
The store is destructured from the factory return, not imported directly.
load
✓ const { load: initializeAuth } = createKeychainSyncedStorage(config)
✗ import { load } from 'keychain-synced-storage'
Must destructure from factory call; rename to avoid conflicts.
Demonstrates init, load, sync/async set/get, custom namespace, removal, and flush of keychain-synced-storage.
import { createKeychainSyncedStorage } from 'keychain-synced-storage';
import AsyncStorage from '@react-native-async-storage/async-storage';
// Initialize storage
const storage = createKeychainSyncedStorage({
storagePrefixKey: 'com.myapp.auth'
});
// Register custom namespace (optional)
const privateKeyStore = storage.registerCustomData({
service: 'private-key',
version: 1
});
const { store: KeychainSyncedStore, load } = storage;
// Initialize async (must complete before use)
await load();
// Write and read synchronously
KeychainSyncedStore.setItem('session', JSON.stringify({ token: 'abc' }));
const session = KeychainSyncedStore.getItem('session');
console.log(session); // '{"token":"abc"}'
// Async write (waits for encryption sync)
await KeychainSyncedStore.setItemAsync('refreshToken', 'xyz');
// Custom namespace usage
privateKeyStore.setItem('privateKey', '0x123...');
// Remove item
KeychainSyncedStore.removeItem('session');
// Force flush pending syncs
await KeychainSyncedStore.flush?.();
Errors
Common errors & fixes
TypeError: Cannot destructure property 'store' of 'createKeychainSyncedStorage(...)' as it is undefined.
Factory returned undefined due to missing peer dependency.
fixEnsure all peer dependencies are installed: npm install @react-native-async-storage/async-storage react-native-keychain react-native-aes-crypto
Error: registerCustomData must be called before load
registerCustomData called after load() or not at all.
fixCall registerCustomData immediately after createKeychainSyncedStorage, before load().
Attempt to getItem before storage is initialized
getItem called before load() completes.
fixGuard storage access behind a state flag set after load resolves.
Module "keychain-synced-storage" does not exist in the Haste module map
Metro cannot resolve the package; may be incorrectly linked.
fixClear Metro cache: npx react-native start --reset-cache
Audit
Dependencies
@react-native-async-storage/async-storagerequiredPersistence layer for encrypted blob
react-nativerequiredRequired for native modules (keychain, AES)
react-native-aes-cryptorequiredAES encryption/decryption of session data
react-native-keychainrequiredSecure storage of encryption key in device keychain/keystore