Registry / security / cordova-plugin-secure-storage-echo

cordova-plugin-secure-storage-echo

JSON →
library5.1.1jsnpmunverified

A Cordova plugin for securely storing strings (credentials, tokens) using platform-native keychains: iOS Keychain (SAMKeychain), Android keystore (AES encryption with generated key), Windows Data Protection API. Forked from Crypho's plugin to maintain compatibility. Version 5.1.1 supports Android, iOS, and Windows (8.x/10/UWP). Uses a namespace-based API with callbacks (not Promises). Alternatives include cordova-plugin-secure-storage (original) and cordova-plugin-ios-keychain.

npm install cordova-plugin-secure-storage-echo
INSTALL
IMPORT
SIG · CORDOVA-PLUGIN-SEC
C
cordova-plugin-secure-storage-echo
securityjavascriptv5.1.1
harness data pending
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.

SecureStorage
var ss = new cordova.plugins.SecureStorage(successCb, errorCb, 'namespace');
var ss = new SecureStorage(successCb, errorCb, 'namespace');
Must be accessed via cordova.plugins.SecureStorage after deviceready. Not a module import – plugin is loaded globally by Cordova.
SecureStorage.set
ss.set(successCb, errorCb, 'key', 'value');
ss.set('key', 'value');
set/get/remove take callback functions as first two arguments, then key/value. Forgetting callbacks causes undefined errors.
SecureStorage.get
ss.get(successCb, errorCb, 'key');
ss.get('key').then(...)
Returns void, not a Promise. Use callbacks. Does not support async/await without manual promisification.

Demonstrates creating a SecureStorage instance, setting, getting, removing, listing keys, and clearing all values.

// Wait for Cordova to initialize document.addEventListener('deviceready', function() { // Create a namespace (like 'my_app') var ss = new cordova.plugins.SecureStorage( function() { console.log('Storage ready'); }, function(err) { console.error('Error creating storage:', err); }, 'my_app' ); // Store a value ss.set( function(key) { console.log('Set ' + key); }, function(err) { console.error('Error setting:', err); }, 'username', 'johndoe' ); // Retrieve the value ss.get( function(value) { console.log('Got: ' + value); }, function(err) { console.error('Error getting:', err); }, 'username' ); // Remove the key ss.remove( function(key) { console.log('Removed ' + key); }, function(err) { console.error('Error removing:', err); }, 'username' ); // List all keys ss.keys( function(keys) { console.log('Keys: ' + keys.join(', ')); }, function(err) { console.error('Error listing keys:', err); } ); // Clear all keys in the namespace ss.clear( function() { console.log('Cleared'); }, function(err) { console.error('Error clearing:', err); } ); }, false);
Debug
Known issues
breakingMust wait for deviceready event before accessing cordova.plugins.SecureStorage. Accessing too early results in undefined.
fix
Wrap all plugin calls inside document.addEventListener('deviceready', function() { ... })
affects: >=1.0
breakingConstructor expects success and error callbacks as first two arguments. Omitting them or passing null will cause the plugin to fail silently.
fix
Always provide both callback functions (even if empty). Example: new cordova.plugins.SecureStorage(function(){}, function(){}, 'ns')
affects: >=1.0
gotchaKeys and values must be strings. Passing numbers, objects, or booleans without string conversion will cause unexpected behavior.
fix
Always convert non-string data: JSON.stringify(value) for objects, String(num) for numbers, etc.
affects: >=1.0
gotchaiOS KeychainAccessibility preference must be set in config.xml before building. Changing it after initial storage may cause access issues on subsequent launches.
fix
Set preference before first use. If changing, you may need to clear the app's keychain or uninstall/reinstall.
affects: >=1.0
deprecatedWindows platform support uses Data Protection API but may not be fully maintained in future versions. Check for Windows-specific bugs.
fix
Test on Windows thoroughly. Consider using cordova-plugin-secure-storage-echo only for iOS/Android if Windows is critical.
affects: >=5.0
Errors
Common errors & fixes
TypeError: Cannot read property 'SecureStorage' of undefined
Accessing cordova.plugins.SecureStorage before deviceready event fires.
fix
Move initialization inside deviceready listener.
Error: SecureStorage is not defined
Plugin not installed or not loaded properly. Missing cordova plugin add command.
fix
Run: cordova plugin add cordova-plugin-secure-storage-echo
Java exception was raised during method invocation
Android: Trying to set/get non-string data or corrupted storage.
fix
Ensure all keys and values are strings. If persistent, uninstall/reinstall app or clear app data.
NSInvalidArgumentException
iOS: Passing nil or non-string to a method that expects a string.
fix
Verify that all arguments are valid strings. For optional null values, pass empty string '' instead.
Upgrade
Version history
5.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
36 hits · last 30 days
node
34
OpenAI (training)
1
Resources
cordova-plugin-secure-storage-echo — npm install cordova-plugin-secure-storage-echo · libregistry