igpapi — Instagram private API Simulator for Node.js (API reference) 4.14.0
    Preparing search index...

    Function IosApp

    • The Instagram iOS app on a virtual device, as a Layer: everything the package's public effects run on — the login, the launch and Direct flows, the shared mobile effects, ExportSnapshot and ProtocolDiagnostics.

      Start from seed (a deterministic new device) or from snapshot (a session exported earlier with ExportSnapshot). The other options are those of the native transport and the device's network.

      One build is one app process. Building the layer creates the device and session state, the native transport client and the process state (navigation, telemetry, what the app keeps only in memory); everything the program changes lives in that build. Provide the layer once around the whole program, or keep it in a ManagedRuntime you own: providing it to two programs separately starts two processes from the same input. Export the snapshot inside the program (or the runtime) whose state it should carry.

      A snapshot that cannot be restored (a damaged cookie jar or state) fails the build with SnapshotDecodeError, an expected failure to handle — usually by logging in again. A snapshot key present but undefined is not a snapshot: it is the caller's "no saved session", so the layer starts a fresh install instead of failing. Invalid options (a request timeout out of range) are a programming error and fail the build as a defect.

      Parameters

      Returns Layer<IosRuntimeServices, SnapshotDecodeError>

      import { ExportSnapshot, IosAppLaunchFlow, IosApp, IosLogin, IosPostLoginFlow } from '@igpapi/ios';
      import { Effect } from 'effect';

      const program = Effect.gen(function* () {
      yield* IosLogin({ username, password });
      yield* IosPostLoginFlow();
      yield* IosAppLaunchFlow();
      return yield* ExportSnapshot;
      });

      const snapshot = await Effect.runPromise(Effect.provide(program, IosApp({ seed: username })));