IGPAPI
    Preparing search index...

    Function createClientInternals

    • Builds the client state from the options: a new device from seed, or the restored snapshot, plus the native transport client.

      Invalid options throw what they always threw (a RangeError for the request timeout, the native client's own error for a proxy or protocol mode it rejects); a snapshot that cannot be restored throws SnapshotDecodeError.

      Restored snapshots keep their stored application, with two exceptions. A snapshot whose app version equals the current defaultApplication version keeps its device and session; its application becomes the presented build's when the snapshot carries another released version (a restore is an app update), and a same-version snapshot adopts any version-bound field it omits — the GraphQL doc-id table, GRAPHQL_OMIT_PRETTY, the Direct inbox directInboxMode, the launch wire launchWire (the feed/timeline block, the feeds' appnetsession pair, the shared launch requests, the inbox-tray form, the save-credentials placement and the dictionary fan-out) and the launch constants shoppingExperiments and directSearchGenAiBotsLimit (so snapshots made between a version bump and this change still resolve the new ids, form shape, inbox mode, feed wire and launch constants). Every other application keeps its literals. See withDefaultVersionBoundFields.

      Parameters

      Returns Promise<
          {
              application: MobileApplicationState;
              client: Client;
              cookieJar: CookieJarLike;
              device: {
                  adid: string;
                  adsOptOut?: boolean;
                  aymhAccounts?: readonly { readonly [key: string]: unknown }[];
                  batteryLevel?: number;
                  build: string;
                  cloudTrustToken?: string;
                  currentKeyboardLanguage?: string;
                  descriptor: string;
                  deviceStatus?: { readonly [key: string]: unknown };
                  familyDeviceSynced?: boolean;
                  familyId: string;
                  flashCallPermissionsStatus?: {
                      ANSWER_PHONE_CALLS: "GRANTED" | "DENIED";
                      READ_CALL_LOG: "GRANTED" | "DENIED";
                      READ_PHONE_STATE: "GRANTED" | "DENIED";
                  };
                  gmsCallRetrieverEligibility?: "eligible"
                  | "not_eligible";
                  hasCameraPermission?: boolean;
                  id: string;
                  isCharging?: boolean;
                  isFoldable?: boolean;
                  isLayoutRTL: boolean;
                  keyboardLanguage?: string;
                  language: string;
                  network?: { kind: "cellular"; radio: "LTE" } | { kind: "wifi" };
                  networkInfo?: {
                      active_subscriptions_info: null;
                      default_subscription_info: {
                          group_id_level_1: number | null;
                          is_data_roaming: number;
                          is_esim: number | null;
                          is_gsm_roaming: number;
                          is_mobile_data_enabled: number;
                          is_sim_sms_capable: number | null;
                          network_operator: string | number;
                          network_type: string | number | null;
                          signal_strength: number;
                          sim_carrier_id: number;
                          sim_carrier_id_name: string | null;
                          sim_operator: string | number;
                          sim_operator_name: string;
                          sim_state: number;
                      };
                      is_active_network_cellular: number;
                      is_airplane_mode: number;
                      is_device_sms_capable: number;
                      is_wifi: number;
                      sim_count: number;
                  };
                  phoneId: string;
                  pushHpkeIdentity?: {
                      keystoreId: string;
                      privKeyPem: string;
                      pubKeyB64: string;
                  };
                  radioType?: string;
                  systemLanguages?: readonly string[];
                  systemLocale?: string;
                  timezoneName?: string;
                  timezoneOffset: string;
                  usdidIdentity?: {
                      kid: string;
                      privKeyPem: string;
                      pubKeySpkiB64: string;
                      uuid: string;
                  };
                  uuid: string;
              };
              protocolDiagnostics: () => readonly Readonly<ProtocolDiagnostic>[];
              requestTimeoutMs: number;
              session: {
                  appStartPhase?: "cold";
                  appStartTimeMs?: number;
                  authorization?: string;
                  bandwidth?: { bytes: number; carried?: true; ms: number };
                  challenge?: { readonly [key: string]: unknown };
                  checkpoint?: { readonly [key: string]: unknown };
                  clientSessionIdLifetime: number;
                  dsUserId?: string;
                  familyDeviceIdBound?: boolean;
                  igWWWClaim?: string;
                  passwordEncryptionKeyId?: string;
                  passwordEncryptionPubKey?: string;
                  pigeonSessionIdLifetime: number;
                  regionHint?: string;
                  rmd?: { kind: "no-valid-map" | "url-eligible" };
                  rur?: string;
                  sessionStartPhase?: "starting";
                  shbid?: string;
                  shbts?: string;
                  thumbnailCacheBustingValue: number;
                  xMetaUsdid?: string;
                  xMid?: string;
                  zeroInterface?: boolean;
                  zeroPhase?: "logged-out" | "authenticated" | "rmd-evaluated";
              };
          },
      >