createDefaultDeviceSignerKeyStorage function

DeviceSignerKeyStorage createDefaultDeviceSignerKeyStorage()

Creates the default device signer key storage.

Returns the native plugin adapter (hardware-backed Secure Enclave / Keystore) when available, or falls back to SoftwareDeviceSignerKeyStorage for dev/test environments where the native plugin is not installed.

This matches the official Crossmint RN SDK's createDeviceSignerKeyStorage() which uses NativeDeviceSignerKeyStorage when the native module exists and SoftwareDeviceSignerKeyStorage for Expo Go / dev builds.

Implementation

DeviceSignerKeyStorage createDefaultDeviceSignerKeyStorage() {
  try {
    return PluginCrossmintDeviceSignerAdapter();
  } on Exception catch (_) {
    return SoftwareDeviceSignerKeyStorage();
  }
}