setStorageCallbacks method

int setStorageCallbacks()

Attach host-provided secure-storage callbacks so the native core can persist state (consent tokens, device records, …) across app restarts.

Resolves synheart_native_secure_store / …_load / …_delete from the process (iOS) or from libsynheart_native_crypto.so (Android) and hands the function pointers to synheart_core_set_storage_callbacks.

Returns:

  • 0 on success,
  • -1 if the runtime is disposed,
  • -2 if synheart_core_set_storage_callbacks isn't exported by this core build,
  • -3 if the native symbols are missing (no storage backend available),
  • any other non-zero value the core's FFI returned.

Implementation

int setStorageCallbacks() {
  if (_disposed) return -1;
  final setter = _ffi.sdkFfi.setStorageCallbacks;
  if (setter == null) return -2;
  final triple = PlatformNativeSdkStorageCallbacks.tryResolveTriple();
  if (triple == null) return -3;
  final rc = setter(_handle, triple.store, triple.load, triple.delete);
  return _checked(rc, failed: rc != 0);
}