Store persistent key-value data, secure auth tokens, and web session state in encrypted native storage.
Store persistent key-value data in encrypted native OS storage. Nativine embeds native iOS UserDefaults / Keychain and Android EncryptedSharedPreferences / Room bridges, bypassing web LocalStorage size limits and domain isolation restrictions.
Browser LocalStorage can be cleared by Safari/Chrome OS cleanup policies or domain changes. Nativine's Native Datastore plugin provides un-clearable, encrypted hardware storage:
To read, write, or remove key-value items in Native Datastore from JavaScript, call nativine.datastore.setItem():
// Store value in encrypted datastore
nativine.datastore.setItem({
key: 'auth_session_token',
value: 'eyJhbGciOiJIUzI1NiIsInR5c...',
isEncrypted: true
});
// Retrieve value
nativine.datastore.getItem({
key: 'auth_session_token',
callback: 'onTokenRetrieved'
});
function onTokenRetrieved(result) {
console.log("Stored Token:", result.value);
}
| Parameter | Type | Description |
|---|---|---|
key | string | Required. Datastore key identifier string. |
value | string | Required. Value string to persist in native storage. |
isEncrypted | boolean | Optional. Set true to store inside hardware-backed Keychain/KeyStore. |
Yes. Native Datastore keys remain completely intact when users update the app via App Store or Google Play.
You can configure individual keys to either sync via iCloud Keychain or remain device-restricted for security.