Download the PHP package smronju/nativephp-secure-storage without Composer
On this page you can find all versions of the php package smronju/nativephp-secure-storage. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download smronju/nativephp-secure-storage
More information about smronju/nativephp-secure-storage
Files in smronju/nativephp-secure-storage
Package nativephp-secure-storage
Short Description Implements NativePHP Mobile's SecureStorage::set()/get()/delete() on both platforms — Android Keystore (AES-256-GCM) on Android, the Keychain on iOS.
License MIT
Homepage https://github.com/smronju/nativephp-secure-storage
Informations about the package nativephp-secure-storage
NativePHP Secure Storage
Implements NativePHP Mobile's SecureStorage facade
on Android and iOS: SecureStorage::set(), get(), read() and delete().
nativephp/mobile core ships the PHP side (Native\Mobile\Facades\SecureStorage)
but registers the SecureStorage.* bridge functions on neither platform, so
without a plugin every call silently returns false / null on a device.
This plugin adds the native side only. There is no new facade to learn.
How values are stored
- Android: AES-256-GCM, with the key held in the Android Keystore (it
never leaves secure hardware or the TEE). The ciphertext lives in the app's
private SharedPreferences. No Gradle dependencies;
EncryptedSharedPreferencesis deprecated, so it isn't used. - iOS: one Keychain generic-password item per key, scoped to the app's
bundle id. Every accessibility is a
ThisDeviceOnlyone, so items never sync to iCloud Keychain or restore onto another device.
Uninstalling the app removes everything on Android. On iOS the Keychain can outlive an uninstall, as it does for every app.
Requirements
nativephp/mobile^4.1- Android API 23+
- iOS 15.0+
Installation
Then rebuild: php artisan native:run.
Don't install it alongside nativephp/mobile-secure-storage: both register
the same SecureStorage.* functions.
Usage
Exactly as core documents it:
read() statuses:
| Status | Android | iOS |
|---|---|---|
found |
stored and decrypted | stored |
not_found |
never stored, or deleted | never stored, or deleted |
unavailable |
never (see below) | device locked and the item is WhenUnlocked / WhenPasscodeSet |
error |
DECRYPT_FAILED: the Keystore key is gone, e.g. after a credential reset |
KEYCHAIN_<OSStatus> |
The accessibility argument is ignored on Android, as core documents: a Keystore key without user-authentication requirements is usable whenever the app runs, which is already after-first-unlock behaviour.
Testing
License
MIT