nodejs-insta-private-api-mqt 1.3.82 → 1.3.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-ts/dist/constants/constants.js +341 -0
- package/dist-ts/dist/constants/index.js +53 -0
- package/dist-ts/dist/core/client.js +437 -0
- package/dist-ts/dist/core/nav-chain.js +252 -0
- package/dist-ts/dist/core/repository.js +6 -0
- package/dist-ts/dist/core/request.js +358 -0
- package/dist-ts/dist/core/state.js +1428 -0
- package/dist-ts/dist/core/utils.js +723 -0
- package/dist-ts/dist/downloadMedia.js +336 -0
- package/dist-ts/dist/errors/index.js +37 -0
- package/dist-ts/dist/extend.js +157 -0
- package/dist-ts/dist/fbns/fbns.client.events.js +2 -0
- package/dist-ts/dist/fbns/fbns.client.js +237 -0
- package/dist-ts/dist/fbns/fbns.device-auth.js +59 -0
- package/dist-ts/dist/fbns/fbns.types.js +2 -0
- package/dist-ts/dist/fbns/fbns.utilities.js +78 -0
- package/dist-ts/dist/fbns/index.js +24 -0
- package/dist-ts/dist/index.js +137 -0
- package/dist-ts/dist/mqtt-shim.js +14 -0
- package/dist-ts/dist/mqttot/index.js +24 -0
- package/dist-ts/dist/mqttot/mqttot.client.js +322 -0
- package/dist-ts/dist/mqttot/mqttot.connect.request.packet.js +8 -0
- package/dist-ts/dist/mqttot/mqttot.connect.response.packet.js +23 -0
- package/dist-ts/dist/mqttot/mqttot.connection.js +68 -0
- package/dist-ts/dist/realtime/commands/commands.js +67 -0
- package/dist-ts/dist/realtime/commands/direct.commands.js +415 -0
- package/dist-ts/dist/realtime/commands/enhanced.direct.commands.js +1529 -0
- package/dist-ts/dist/realtime/commands/index.js +23 -0
- package/dist-ts/dist/realtime/delta-sync.manager.js +260 -0
- package/dist-ts/dist/realtime/features/dm-sender.js +94 -0
- package/dist-ts/dist/realtime/features/error-handler.js +167 -0
- package/dist-ts/dist/realtime/features/gap-handler.js +60 -0
- package/dist-ts/dist/realtime/features/persistent-logger.js +174 -0
- package/dist-ts/dist/realtime/features/presence.manager.js +68 -0
- package/dist-ts/dist/realtime/features/session-health-monitor.js +327 -0
- package/dist-ts/dist/realtime/index.js +21 -0
- package/dist-ts/dist/realtime/messages/app-presence.event.js +2 -0
- package/dist-ts/dist/realtime/messages/index.js +23 -0
- package/dist-ts/dist/realtime/messages/message-sync.message.js +42 -0
- package/dist-ts/dist/realtime/messages/realtime-sub.direct.data.js +2 -0
- package/dist-ts/dist/realtime/messages/thread-update.message.js +2 -0
- package/dist-ts/dist/realtime/mixins/index.js +23 -0
- package/dist-ts/dist/realtime/mixins/message-sync.mixin.js +585 -0
- package/dist-ts/dist/realtime/mixins/mixin.js +40 -0
- package/dist-ts/dist/realtime/mixins/presence-typing.mixin.js +29 -0
- package/dist-ts/dist/realtime/mixins/realtime-sub.mixin.js +171 -0
- package/dist-ts/dist/realtime/parsers/graphql-parser.js +43 -0
- package/dist-ts/dist/realtime/parsers/graphql.parser.js +22 -0
- package/dist-ts/dist/realtime/parsers/index.js +26 -0
- package/dist-ts/dist/realtime/parsers/iris-parser.js +43 -0
- package/dist-ts/dist/realtime/parsers/iris.parser.js +9 -0
- package/dist-ts/dist/realtime/parsers/json-parser.js +43 -0
- package/dist-ts/dist/realtime/parsers/json.parser.js +9 -0
- package/dist-ts/dist/realtime/parsers/parser.js +2 -0
- package/dist-ts/dist/realtime/parsers/region-hint-parser.js +43 -0
- package/dist-ts/dist/realtime/parsers/region-hint.parser.js +14 -0
- package/dist-ts/dist/realtime/parsers/skywalker-parser.js +43 -0
- package/dist-ts/dist/realtime/parsers/skywalker.parser.js +14 -0
- package/dist-ts/dist/realtime/parsers-advanced.js +138 -0
- package/dist-ts/dist/realtime/proto-parser.js +186 -0
- package/dist-ts/dist/realtime/protocols/iris.handshake.js +76 -0
- package/dist-ts/dist/realtime/protocols/skywalker.protocol.js +96 -0
- package/dist-ts/dist/realtime/realtime.client.events.js +2 -0
- package/dist-ts/dist/realtime/realtime.client.js +2117 -0
- package/dist-ts/dist/realtime/realtime.service.js +408 -0
- package/dist-ts/dist/realtime/reconnect.manager.js +72 -0
- package/dist-ts/dist/realtime/session.manager.js +106 -0
- package/dist-ts/dist/realtime/subscriptions/graphql.subscription.js +98 -0
- package/dist-ts/dist/realtime/subscriptions/index.js +22 -0
- package/dist-ts/dist/realtime/subscriptions/skywalker.subscription.js +12 -0
- package/dist-ts/dist/realtime/topic-map.js +57 -0
- package/dist-ts/dist/realtime/topic.js +76 -0
- package/dist-ts/dist/repositories/account.repository.js +1267 -0
- package/dist-ts/dist/repositories/bloks.repository.js +66 -0
- package/dist-ts/dist/repositories/captcha.repository.js +40 -0
- package/dist-ts/dist/repositories/challenge.repository.js +108 -0
- package/dist-ts/dist/repositories/clip.repository.js +134 -0
- package/dist-ts/dist/repositories/close-friends.repository.js +41 -0
- package/dist-ts/dist/repositories/collection.repository.js +64 -0
- package/dist-ts/dist/repositories/direct-thread.repository.js +423 -0
- package/dist-ts/dist/repositories/direct.repository.js +246 -0
- package/dist-ts/dist/repositories/explore.repository.js +60 -0
- package/dist-ts/dist/repositories/fbsearch.repository.js +124 -0
- package/dist-ts/dist/repositories/feed.repository.js +237 -0
- package/dist-ts/dist/repositories/friendship.repository.js +277 -0
- package/dist-ts/dist/repositories/fundraiser.repository.js +38 -0
- package/dist-ts/dist/repositories/hashtag.repository.js +80 -0
- package/dist-ts/dist/repositories/highlights.repository.js +100 -0
- package/dist-ts/dist/repositories/insights.repository.js +66 -0
- package/dist-ts/dist/repositories/location.repository.js +67 -0
- package/dist-ts/dist/repositories/media.repository.js +370 -0
- package/dist-ts/dist/repositories/multiple-accounts.repository.js +36 -0
- package/dist-ts/dist/repositories/news.repository.js +32 -0
- package/dist-ts/dist/repositories/note.repository.js +51 -0
- package/dist-ts/dist/repositories/notification.repository.js +77 -0
- package/dist-ts/dist/repositories/share.repository.js +34 -0
- package/dist-ts/dist/repositories/signup.repository.js +178 -0
- package/dist-ts/dist/repositories/story.repository.js +268 -0
- package/dist-ts/dist/repositories/timeline.repository.js +57 -0
- package/dist-ts/dist/repositories/totp.repository.js +124 -0
- package/dist-ts/dist/repositories/track.repository.js +50 -0
- package/dist-ts/dist/repositories/upload.repository.js +191 -0
- package/dist-ts/dist/repositories/user.repository.js +332 -0
- package/dist-ts/dist/sendmedia/index.js +24 -0
- package/dist-ts/dist/sendmedia/sendFile.js +56 -0
- package/dist-ts/dist/sendmedia/sendPhoto.js +132 -0
- package/dist-ts/dist/sendmedia/sendRavenPhoto.js +133 -0
- package/dist-ts/dist/sendmedia/sendRavenVideo.js +136 -0
- package/dist-ts/dist/sendmedia/uploadPhoto.js +89 -0
- package/dist-ts/dist/sendmedia/uploadfFile.js +108 -0
- package/dist-ts/dist/services/live.service.js +113 -0
- package/dist-ts/dist/services/search.service.js +91 -0
- package/dist-ts/dist/shared/index.js +98 -0
- package/dist-ts/dist/shared/shared.js +85 -0
- package/dist-ts/dist/thrift/index.js +23 -0
- package/dist-ts/dist/thrift/thrift.js +105 -0
- package/dist-ts/dist/thrift/thrift.reading.js +339 -0
- package/dist-ts/dist/thrift/thrift.writing.js +393 -0
- package/dist-ts/dist/types/index.js +276 -0
- package/dist-ts/dist/useMultiFileAuthState.js +1878 -0
- package/dist-ts/dist/utils/index.js +244 -0
- package/dist-ts/examples/listen-to-messages.js +73 -0
- package/package.json +1 -1
- package/src-ts/dist/realtime/protocols/proto-definitions.ts +80 -0
- package/{dist/repositories/account.repository.js → src-ts/dist/repositories/account.repository.ts} +54 -14
- package/src-ts/dist/utils/helper-1.ts +1 -0
- package/src-ts/dist/utils/helper-10.ts +1 -0
- package/src-ts/dist/utils/helper-11.ts +1 -0
- package/src-ts/dist/utils/helper-12.ts +1 -0
- package/src-ts/dist/utils/helper-13.ts +1 -0
- package/src-ts/dist/utils/helper-14.ts +1 -0
- package/src-ts/dist/utils/helper-15.ts +1 -0
- package/src-ts/dist/utils/helper-16.ts +1 -0
- package/src-ts/dist/utils/helper-17.ts +1 -0
- package/src-ts/dist/utils/helper-18.ts +1 -0
- package/src-ts/dist/utils/helper-19.ts +1 -0
- package/src-ts/dist/utils/helper-2.ts +1 -0
- package/src-ts/dist/utils/helper-20.ts +1 -0
- package/src-ts/dist/utils/helper-21.ts +1 -0
- package/src-ts/dist/utils/helper-22.ts +1 -0
- package/src-ts/dist/utils/helper-23.ts +1 -0
- package/src-ts/dist/utils/helper-24.ts +1 -0
- package/src-ts/dist/utils/helper-25.ts +1 -0
- package/src-ts/dist/utils/helper-26.ts +1 -0
- package/src-ts/dist/utils/helper-27.ts +1 -0
- package/src-ts/dist/utils/helper-28.ts +1 -0
- package/src-ts/dist/utils/helper-29.ts +1 -0
- package/src-ts/dist/utils/helper-3.ts +1 -0
- package/src-ts/dist/utils/helper-30.ts +1 -0
- package/src-ts/dist/utils/helper-4.ts +1 -0
- package/src-ts/dist/utils/helper-5.ts +1 -0
- package/src-ts/dist/utils/helper-6.ts +1 -0
- package/src-ts/dist/utils/helper-7.ts +1 -0
- package/src-ts/dist/utils/helper-8.ts +1 -0
- package/src-ts/dist/utils/helper-9.ts +1 -0
- package/src-ts/dist/utils/insta-mqtt-helper.ts +128 -0
- package/src-ts/examples/listen-to-messages.ts +86 -0
- package/dist/errors/index.d.ts +0 -16
- package/dist/errors/index.js.map +0 -1
- package/dist/fbns/fbns.client.d.ts +0 -32
- package/dist/fbns/fbns.client.events.d.ts +0 -41
- package/dist/fbns/fbns.client.events.js.map +0 -1
- package/dist/fbns/fbns.client.js.map +0 -1
- package/dist/fbns/fbns.device-auth.d.ts +0 -17
- package/dist/fbns/fbns.device-auth.js.map +0 -1
- package/dist/fbns/fbns.types.d.ts +0 -83
- package/dist/fbns/fbns.types.js.map +0 -1
- package/dist/fbns/fbns.utilities.d.ts +0 -2
- package/dist/fbns/fbns.utilities.js.map +0 -1
- package/dist/fbns/index.d.ts +0 -4
- package/dist/fbns/index.js.map +0 -1
- package/dist/mqtt-shim.d.ts +0 -96
- package/dist/mqttot/index.d.ts +0 -4
- package/dist/mqttot/index.js.map +0 -1
- package/dist/mqttot/mqttot.client.d.ts +0 -39
- package/dist/mqttot/mqttot.client.js.map +0 -1
- package/dist/mqttot/mqttot.connect.request.packet.d.ts +0 -7
- package/dist/mqttot/mqttot.connect.request.packet.js.map +0 -1
- package/dist/mqttot/mqttot.connect.response.packet.d.ts +0 -7
- package/dist/mqttot/mqttot.connect.response.packet.js.map +0 -1
- package/dist/mqttot/mqttot.connection.d.ts +0 -57
- package/dist/mqttot/mqttot.connection.js.map +0 -1
- package/dist/package.json +0 -59
- package/dist/realtime/commands/commands.d.ts +0 -15
- package/dist/realtime/commands/commands.js.map +0 -1
- package/dist/realtime/commands/direct.commands.d.ts +0 -75
- package/dist/realtime/commands/direct.commands.js.map +0 -1
- package/dist/realtime/commands/enhanced.direct.commands.js.bak +0 -967
- package/dist/realtime/commands/index.d.ts +0 -2
- package/dist/realtime/commands/index.js.map +0 -1
- package/dist/realtime/messages/app-presence.event.d.ts +0 -9
- package/dist/realtime/messages/app-presence.event.js.map +0 -1
- package/dist/realtime/messages/index.d.ts +0 -3
- package/dist/realtime/messages/index.js.map +0 -1
- package/dist/realtime/messages/message-sync.message.d.ts +0 -222
- package/dist/realtime/messages/message-sync.message.js.map +0 -1
- package/dist/realtime/messages/realtime-sub.direct.data.d.ts +0 -11
- package/dist/realtime/messages/realtime-sub.direct.data.js.map +0 -1
- package/dist/realtime/messages/thread-update.message.d.ts +0 -68
- package/dist/realtime/messages/thread-update.message.js.map +0 -1
- package/dist/realtime/mixins/index.d.ts +0 -3
- package/dist/realtime/mixins/index.js.map +0 -1
- package/dist/realtime/mixins/message-sync.mixin.d.ts +0 -8
- package/dist/realtime/mixins/message-sync.mixin.js.map +0 -1
- package/dist/realtime/mixins/mixin.d.ts +0 -19
- package/dist/realtime/mixins/mixin.js.map +0 -1
- package/dist/realtime/mixins/realtime-sub.mixin.d.ts +0 -8
- package/dist/realtime/mixins/realtime-sub.mixin.js.map +0 -1
- package/dist/realtime/parsers/graphql.parser.d.ts +0 -15
- package/dist/realtime/parsers/graphql.parser.js.map +0 -1
- package/dist/realtime/parsers/index.d.ts +0 -6
- package/dist/realtime/parsers/index.js.map +0 -1
- package/dist/realtime/parsers/iris.parser.d.ts +0 -17
- package/dist/realtime/parsers/iris.parser.js.map +0 -1
- package/dist/realtime/parsers/json.parser.d.ts +0 -6
- package/dist/realtime/parsers/json.parser.js.map +0 -1
- package/dist/realtime/parsers/parser.d.ts +0 -9
- package/dist/realtime/parsers/parser.js.map +0 -1
- package/dist/realtime/parsers/region-hint.parser.d.ts +0 -12
- package/dist/realtime/parsers/region-hint.parser.js.map +0 -1
- package/dist/realtime/parsers/skywalker.parser.d.ts +0 -12
- package/dist/realtime/parsers/skywalker.parser.js.map +0 -1
- package/dist/realtime/proto/common.proto +0 -38
- package/dist/realtime/proto/direct.proto +0 -65
- package/dist/realtime/proto/ig-messages.proto +0 -83
- package/dist/realtime/proto/iris.proto +0 -188
- package/dist/realtime/subscriptions/graphql.subscription.d.ts +0 -47
- package/dist/realtime/subscriptions/graphql.subscription.js.map +0 -1
- package/dist/realtime/subscriptions/index.d.ts +0 -2
- package/dist/realtime/subscriptions/index.js.map +0 -1
- package/dist/realtime/subscriptions/skywalker.subscription.d.ts +0 -4
- package/dist/realtime/subscriptions/skywalker.subscription.js.map +0 -1
- package/dist/thrift/index.d.ts +0 -3
- package/dist/thrift/index.js.map +0 -1
- package/dist/thrift/thrift.d.ts +0 -59
- package/dist/thrift/thrift.js.map +0 -1
- package/dist/thrift/thrift.reading.d.ts +0 -41
- package/dist/thrift/thrift.reading.js.map +0 -1
- package/dist/thrift/thrift.writing.d.ts +0 -44
- package/dist/thrift/thrift.writing.js.map +0 -1
- /package/{dist → dist-ts/dist}/realtime/protocols/proto-definitions.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-1.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-10.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-11.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-12.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-13.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-14.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-15.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-16.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-17.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-18.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-19.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-2.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-20.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-21.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-22.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-23.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-24.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-25.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-26.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-27.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-28.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-29.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-3.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-30.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-4.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-5.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-6.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-7.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-8.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-9.js +0 -0
- /package/{dist → dist-ts/dist}/utils/insta-mqtt-helper.js +0 -0
- /package/{dist/constants/constants.js → src-ts/dist/constants/constants.ts} +0 -0
- /package/{dist/constants/index.js → src-ts/dist/constants/index.ts} +0 -0
- /package/{dist/core/client.js → src-ts/dist/core/client.ts} +0 -0
- /package/{dist/core/nav-chain.js → src-ts/dist/core/nav-chain.ts} +0 -0
- /package/{dist/core/repository.js → src-ts/dist/core/repository.ts} +0 -0
- /package/{dist/core/request.js → src-ts/dist/core/request.ts} +0 -0
- /package/{dist/core/state.js → src-ts/dist/core/state.ts} +0 -0
- /package/{dist/core/utils.js → src-ts/dist/core/utils.ts} +0 -0
- /package/{dist/downloadMedia.js → src-ts/dist/downloadMedia.ts} +0 -0
- /package/{dist/errors/index.js → src-ts/dist/errors/index.ts} +0 -0
- /package/{dist/extend.js → src-ts/dist/extend.ts} +0 -0
- /package/{dist/fbns/fbns.client.events.js → src-ts/dist/fbns/fbns.client.events.ts} +0 -0
- /package/{dist/fbns/fbns.client.js → src-ts/dist/fbns/fbns.client.ts} +0 -0
- /package/{dist/fbns/fbns.device-auth.js → src-ts/dist/fbns/fbns.device-auth.ts} +0 -0
- /package/{dist/fbns/fbns.types.js → src-ts/dist/fbns/fbns.types.ts} +0 -0
- /package/{dist/fbns/fbns.utilities.js → src-ts/dist/fbns/fbns.utilities.ts} +0 -0
- /package/{dist/fbns/index.js → src-ts/dist/fbns/index.ts} +0 -0
- /package/{dist/index.js → src-ts/dist/index.ts} +0 -0
- /package/{dist/mqtt-shim.js → src-ts/dist/mqtt-shim.ts} +0 -0
- /package/{dist/mqttot/index.js → src-ts/dist/mqttot/index.ts} +0 -0
- /package/{dist/mqttot/mqttot.client.js → src-ts/dist/mqttot/mqttot.client.ts} +0 -0
- /package/{dist/mqttot/mqttot.connect.request.packet.js → src-ts/dist/mqttot/mqttot.connect.request.packet.ts} +0 -0
- /package/{dist/mqttot/mqttot.connect.response.packet.js → src-ts/dist/mqttot/mqttot.connect.response.packet.ts} +0 -0
- /package/{dist/mqttot/mqttot.connection.js → src-ts/dist/mqttot/mqttot.connection.ts} +0 -0
- /package/{dist/realtime/commands/commands.js → src-ts/dist/realtime/commands/commands.ts} +0 -0
- /package/{dist/realtime/commands/direct.commands.js → src-ts/dist/realtime/commands/direct.commands.ts} +0 -0
- /package/{dist/realtime/commands/enhanced.direct.commands.js → src-ts/dist/realtime/commands/enhanced.direct.commands.ts} +0 -0
- /package/{dist/realtime/commands/index.js → src-ts/dist/realtime/commands/index.ts} +0 -0
- /package/{dist/realtime/delta-sync.manager.js → src-ts/dist/realtime/delta-sync.manager.ts} +0 -0
- /package/{dist/realtime/features/dm-sender.js → src-ts/dist/realtime/features/dm-sender.ts} +0 -0
- /package/{dist/realtime/features/error-handler.js → src-ts/dist/realtime/features/error-handler.ts} +0 -0
- /package/{dist/realtime/features/gap-handler.js → src-ts/dist/realtime/features/gap-handler.ts} +0 -0
- /package/{dist/realtime/features/persistent-logger.js → src-ts/dist/realtime/features/persistent-logger.ts} +0 -0
- /package/{dist/realtime/features/presence.manager.js → src-ts/dist/realtime/features/presence.manager.ts} +0 -0
- /package/{dist/realtime/features/session-health-monitor.js → src-ts/dist/realtime/features/session-health-monitor.ts} +0 -0
- /package/{dist/realtime/index.js → src-ts/dist/realtime/index.ts} +0 -0
- /package/{dist/realtime/messages/app-presence.event.js → src-ts/dist/realtime/messages/app-presence.event.ts} +0 -0
- /package/{dist/realtime/messages/index.js → src-ts/dist/realtime/messages/index.ts} +0 -0
- /package/{dist/realtime/messages/message-sync.message.js → src-ts/dist/realtime/messages/message-sync.message.ts} +0 -0
- /package/{dist/realtime/messages/realtime-sub.direct.data.js → src-ts/dist/realtime/messages/realtime-sub.direct.data.ts} +0 -0
- /package/{dist/realtime/messages/thread-update.message.js → src-ts/dist/realtime/messages/thread-update.message.ts} +0 -0
- /package/{dist/realtime/mixins/index.js → src-ts/dist/realtime/mixins/index.ts} +0 -0
- /package/{dist/realtime/mixins/message-sync.mixin.js → src-ts/dist/realtime/mixins/message-sync.mixin.ts} +0 -0
- /package/{dist/realtime/mixins/mixin.js → src-ts/dist/realtime/mixins/mixin.ts} +0 -0
- /package/{dist/realtime/mixins/presence-typing.mixin.js → src-ts/dist/realtime/mixins/presence-typing.mixin.ts} +0 -0
- /package/{dist/realtime/mixins/realtime-sub.mixin.js → src-ts/dist/realtime/mixins/realtime-sub.mixin.ts} +0 -0
- /package/{dist/realtime/parsers/graphql-parser.js → src-ts/dist/realtime/parsers/graphql-parser.ts} +0 -0
- /package/{dist/realtime/parsers/graphql.parser.js → src-ts/dist/realtime/parsers/graphql.parser.ts} +0 -0
- /package/{dist/realtime/parsers/index.js → src-ts/dist/realtime/parsers/index.ts} +0 -0
- /package/{dist/realtime/parsers/iris-parser.js → src-ts/dist/realtime/parsers/iris-parser.ts} +0 -0
- /package/{dist/realtime/parsers/iris.parser.js → src-ts/dist/realtime/parsers/iris.parser.ts} +0 -0
- /package/{dist/realtime/parsers/json-parser.js → src-ts/dist/realtime/parsers/json-parser.ts} +0 -0
- /package/{dist/realtime/parsers/json.parser.js → src-ts/dist/realtime/parsers/json.parser.ts} +0 -0
- /package/{dist/realtime/parsers/parser.js → src-ts/dist/realtime/parsers/parser.ts} +0 -0
- /package/{dist/realtime/parsers/region-hint-parser.js → src-ts/dist/realtime/parsers/region-hint-parser.ts} +0 -0
- /package/{dist/realtime/parsers/region-hint.parser.js → src-ts/dist/realtime/parsers/region-hint.parser.ts} +0 -0
- /package/{dist/realtime/parsers/skywalker-parser.js → src-ts/dist/realtime/parsers/skywalker-parser.ts} +0 -0
- /package/{dist/realtime/parsers/skywalker.parser.js → src-ts/dist/realtime/parsers/skywalker.parser.ts} +0 -0
- /package/{dist/realtime/parsers-advanced.js → src-ts/dist/realtime/parsers-advanced.ts} +0 -0
- /package/{dist/realtime/proto-parser.js → src-ts/dist/realtime/proto-parser.ts} +0 -0
- /package/{dist/realtime/protocols/iris.handshake.js → src-ts/dist/realtime/protocols/iris.handshake.ts} +0 -0
- /package/{dist/realtime/protocols/skywalker.protocol.js → src-ts/dist/realtime/protocols/skywalker.protocol.ts} +0 -0
- /package/{dist/realtime/realtime.client.events.js → src-ts/dist/realtime/realtime.client.events.ts} +0 -0
- /package/{dist/realtime/realtime.client.js → src-ts/dist/realtime/realtime.client.ts} +0 -0
- /package/{dist/realtime/realtime.service.js → src-ts/dist/realtime/realtime.service.ts} +0 -0
- /package/{dist/realtime/reconnect.manager.js → src-ts/dist/realtime/reconnect.manager.ts} +0 -0
- /package/{dist/realtime/session.manager.js → src-ts/dist/realtime/session.manager.ts} +0 -0
- /package/{dist/realtime/subscriptions/graphql.subscription.js → src-ts/dist/realtime/subscriptions/graphql.subscription.ts} +0 -0
- /package/{dist/realtime/subscriptions/index.js → src-ts/dist/realtime/subscriptions/index.ts} +0 -0
- /package/{dist/realtime/subscriptions/skywalker.subscription.js → src-ts/dist/realtime/subscriptions/skywalker.subscription.ts} +0 -0
- /package/{dist/realtime/topic-map.js → src-ts/dist/realtime/topic-map.ts} +0 -0
- /package/{dist/realtime/topic.js → src-ts/dist/realtime/topic.ts} +0 -0
- /package/{dist/repositories/bloks.repository.js → src-ts/dist/repositories/bloks.repository.ts} +0 -0
- /package/{dist/repositories/captcha.repository.js → src-ts/dist/repositories/captcha.repository.ts} +0 -0
- /package/{dist/repositories/challenge.repository.js → src-ts/dist/repositories/challenge.repository.ts} +0 -0
- /package/{dist/repositories/clip.repository.js → src-ts/dist/repositories/clip.repository.ts} +0 -0
- /package/{dist/repositories/close-friends.repository.js → src-ts/dist/repositories/close-friends.repository.ts} +0 -0
- /package/{dist/repositories/collection.repository.js → src-ts/dist/repositories/collection.repository.ts} +0 -0
- /package/{dist/repositories/direct-thread.repository.js → src-ts/dist/repositories/direct-thread.repository.ts} +0 -0
- /package/{dist/repositories/direct.repository.js → src-ts/dist/repositories/direct.repository.ts} +0 -0
- /package/{dist/repositories/explore.repository.js → src-ts/dist/repositories/explore.repository.ts} +0 -0
- /package/{dist/repositories/fbsearch.repository.js → src-ts/dist/repositories/fbsearch.repository.ts} +0 -0
- /package/{dist/repositories/feed.repository.js → src-ts/dist/repositories/feed.repository.ts} +0 -0
- /package/{dist/repositories/friendship.repository.js → src-ts/dist/repositories/friendship.repository.ts} +0 -0
- /package/{dist/repositories/fundraiser.repository.js → src-ts/dist/repositories/fundraiser.repository.ts} +0 -0
- /package/{dist/repositories/hashtag.repository.js → src-ts/dist/repositories/hashtag.repository.ts} +0 -0
- /package/{dist/repositories/highlights.repository.js → src-ts/dist/repositories/highlights.repository.ts} +0 -0
- /package/{dist/repositories/insights.repository.js → src-ts/dist/repositories/insights.repository.ts} +0 -0
- /package/{dist/repositories/location.repository.js → src-ts/dist/repositories/location.repository.ts} +0 -0
- /package/{dist/repositories/media.repository.js → src-ts/dist/repositories/media.repository.ts} +0 -0
- /package/{dist/repositories/multiple-accounts.repository.js → src-ts/dist/repositories/multiple-accounts.repository.ts} +0 -0
- /package/{dist/repositories/news.repository.js → src-ts/dist/repositories/news.repository.ts} +0 -0
- /package/{dist/repositories/note.repository.js → src-ts/dist/repositories/note.repository.ts} +0 -0
- /package/{dist/repositories/notification.repository.js → src-ts/dist/repositories/notification.repository.ts} +0 -0
- /package/{dist/repositories/share.repository.js → src-ts/dist/repositories/share.repository.ts} +0 -0
- /package/{dist/repositories/signup.repository.js → src-ts/dist/repositories/signup.repository.ts} +0 -0
- /package/{dist/repositories/story.repository.js → src-ts/dist/repositories/story.repository.ts} +0 -0
- /package/{dist/repositories/timeline.repository.js → src-ts/dist/repositories/timeline.repository.ts} +0 -0
- /package/{dist/repositories/totp.repository.js → src-ts/dist/repositories/totp.repository.ts} +0 -0
- /package/{dist/repositories/track.repository.js → src-ts/dist/repositories/track.repository.ts} +0 -0
- /package/{dist/repositories/upload.repository.js → src-ts/dist/repositories/upload.repository.ts} +0 -0
- /package/{dist/repositories/user.repository.js → src-ts/dist/repositories/user.repository.ts} +0 -0
- /package/{dist/sendmedia/index.js → src-ts/dist/sendmedia/index.ts} +0 -0
- /package/{dist/sendmedia/sendFile.js → src-ts/dist/sendmedia/sendFile.ts} +0 -0
- /package/{dist/sendmedia/sendPhoto.js → src-ts/dist/sendmedia/sendPhoto.ts} +0 -0
- /package/{dist/sendmedia/sendRavenPhoto.js → src-ts/dist/sendmedia/sendRavenPhoto.ts} +0 -0
- /package/{dist/sendmedia/sendRavenVideo.js → src-ts/dist/sendmedia/sendRavenVideo.ts} +0 -0
- /package/{dist/sendmedia/uploadPhoto.js → src-ts/dist/sendmedia/uploadPhoto.ts} +0 -0
- /package/{dist/sendmedia/uploadfFile.js → src-ts/dist/sendmedia/uploadfFile.ts} +0 -0
- /package/{dist/services/live.service.js → src-ts/dist/services/live.service.ts} +0 -0
- /package/{dist/services/search.service.js → src-ts/dist/services/search.service.ts} +0 -0
- /package/{dist/shared/index.js → src-ts/dist/shared/index.ts} +0 -0
- /package/{dist/shared/shared.js → src-ts/dist/shared/shared.ts} +0 -0
- /package/{dist/thrift/index.js → src-ts/dist/thrift/index.ts} +0 -0
- /package/{dist/thrift/thrift.reading.js → src-ts/dist/thrift/thrift.reading.ts} +0 -0
- /package/{dist/thrift/thrift.js → src-ts/dist/thrift/thrift.ts} +0 -0
- /package/{dist/thrift/thrift.writing.js → src-ts/dist/thrift/thrift.writing.ts} +0 -0
- /package/{dist/types/index.js → src-ts/dist/types/index.ts} +0 -0
- /package/{dist/useMultiFileAuthState.js → src-ts/dist/useMultiFileAuthState.ts} +0 -0
- /package/{dist/utils/index.js → src-ts/dist/utils/index.ts} +0 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
const crypto = require('crypto');
|
|
2
|
+
const { random } = require('lodash');
|
|
3
|
+
class Utils {
|
|
4
|
+
// ========================
|
|
5
|
+
// ORIGINAL FUNCTIONS
|
|
6
|
+
// ========================
|
|
7
|
+
static generateUUID() {
|
|
8
|
+
if (crypto.randomUUID)
|
|
9
|
+
return crypto.randomUUID();
|
|
10
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
11
|
+
const r = Math.random() * 16 | 0;
|
|
12
|
+
const v = c === 'x' ? r : (r & 0x3 | 0x8);
|
|
13
|
+
return v.toString(16);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
static generateRandomString(length) {
|
|
17
|
+
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
18
|
+
let result = '';
|
|
19
|
+
for (let i = 0; i < length; i++) {
|
|
20
|
+
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
static generateDeviceId() {
|
|
25
|
+
return 'android-' + this.generateRandomString(16);
|
|
26
|
+
}
|
|
27
|
+
static generatePhoneId() {
|
|
28
|
+
return this.generateUUID();
|
|
29
|
+
}
|
|
30
|
+
static generateAdId() {
|
|
31
|
+
return this.generateUUID();
|
|
32
|
+
}
|
|
33
|
+
static sleep(ms) {
|
|
34
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
35
|
+
}
|
|
36
|
+
static randomDelay(min = 1000, max = 3000) {
|
|
37
|
+
return this.sleep(random(min, max));
|
|
38
|
+
}
|
|
39
|
+
static md5(data) {
|
|
40
|
+
return crypto.createHash('md5').update(data).digest('hex');
|
|
41
|
+
}
|
|
42
|
+
static sha256(data) {
|
|
43
|
+
return crypto.createHash('sha256').update(data).digest('hex');
|
|
44
|
+
}
|
|
45
|
+
static hmacSha256(data, key) {
|
|
46
|
+
return crypto.createHmac('sha256', key).update(data).digest('hex');
|
|
47
|
+
}
|
|
48
|
+
static base64Encode(data) {
|
|
49
|
+
return Buffer.from(data).toString('base64');
|
|
50
|
+
}
|
|
51
|
+
static base64Decode(data) {
|
|
52
|
+
return Buffer.from(data, 'base64').toString();
|
|
53
|
+
}
|
|
54
|
+
static getCurrentTimestamp() {
|
|
55
|
+
return Math.floor(Date.now() / 1000);
|
|
56
|
+
}
|
|
57
|
+
static getTimestampMs() {
|
|
58
|
+
return Date.now();
|
|
59
|
+
}
|
|
60
|
+
static formatUserAgent(appVersion, deviceString, language, appVersionCode) {
|
|
61
|
+
return `Instagram ${appVersion} Android (${deviceString}; ${language}; ${appVersionCode})`;
|
|
62
|
+
}
|
|
63
|
+
static formatWebUserAgent(devicePayload, build, appUserAgent) {
|
|
64
|
+
return `Mozilla/5.0 (Linux; Android ${devicePayload.android_release}; ${devicePayload.model} Build/${build}; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/131.0.6778.139 Mobile Safari/537.36 ${appUserAgent}`;
|
|
65
|
+
}
|
|
66
|
+
static parseUserId(userIdOrUsername) {
|
|
67
|
+
if (typeof userIdOrUsername === 'number' || /^\d+$/.test(userIdOrUsername)) {
|
|
68
|
+
return userIdOrUsername.toString();
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
static isValidEmail(email) {
|
|
73
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
74
|
+
return emailRegex.test(email);
|
|
75
|
+
}
|
|
76
|
+
static isValidUsername(username) {
|
|
77
|
+
const usernameRegex = /^[a-zA-Z0-9._]{1,30}$/;
|
|
78
|
+
return usernameRegex.test(username);
|
|
79
|
+
}
|
|
80
|
+
static sanitizeCaption(caption) {
|
|
81
|
+
if (!caption)
|
|
82
|
+
return '';
|
|
83
|
+
return caption.replace(/[\u0000-\u001F\u007F-\u009F]/g, '');
|
|
84
|
+
}
|
|
85
|
+
static chunkArray(array, chunkSize) {
|
|
86
|
+
const chunks = [];
|
|
87
|
+
for (let i = 0; i < array.length; i += chunkSize) {
|
|
88
|
+
chunks.push(array.slice(i, i + chunkSize));
|
|
89
|
+
}
|
|
90
|
+
return chunks;
|
|
91
|
+
}
|
|
92
|
+
static retryOperation(operation, maxRetries = 3, delay = 1000) {
|
|
93
|
+
return new Promise((resolve, reject) => {
|
|
94
|
+
let retries = 0;
|
|
95
|
+
const attempt = async () => {
|
|
96
|
+
try {
|
|
97
|
+
const result = await operation();
|
|
98
|
+
resolve(result);
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
retries++;
|
|
102
|
+
if (retries >= maxRetries) {
|
|
103
|
+
reject(error);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
setTimeout(attempt, delay * retries);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
attempt();
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
static validateFileSize(filePath, maxSizeBytes) {
|
|
114
|
+
const fs = require('fs');
|
|
115
|
+
try {
|
|
116
|
+
const stats = fs.statSync(filePath);
|
|
117
|
+
return stats.size <= maxSizeBytes;
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
static getFileExtension(filePath) {
|
|
124
|
+
return filePath.split('.').pop().toLowerCase();
|
|
125
|
+
}
|
|
126
|
+
static isImageFile(filePath) {
|
|
127
|
+
const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'];
|
|
128
|
+
const extension = this.getFileExtension(filePath);
|
|
129
|
+
return imageExtensions.includes(extension);
|
|
130
|
+
}
|
|
131
|
+
static isVideoFile(filePath) {
|
|
132
|
+
const videoExtensions = ['mp4', 'mov', 'avi', 'mkv', 'webm', '3gp'];
|
|
133
|
+
const extension = this.getFileExtension(filePath);
|
|
134
|
+
return videoExtensions.includes(extension);
|
|
135
|
+
}
|
|
136
|
+
static humanizeError(error) {
|
|
137
|
+
const errorMessages = {
|
|
138
|
+
'IgLoginBadPasswordError': 'The password you entered is incorrect. Please check your password and try again.',
|
|
139
|
+
'IgLoginInvalidUserError': 'The username you entered doesn\'t appear to belong to an account. Please check your username and try again.',
|
|
140
|
+
'IgLoginTwoFactorRequiredError': 'Two-factor authentication is required. Please enter the verification code.',
|
|
141
|
+
'IgCheckpointError': 'Instagram requires additional verification. Please complete the security challenge.',
|
|
142
|
+
'IgActionSpamError': 'This action has been blocked by Instagram\'s spam detection. Please try again later.',
|
|
143
|
+
'IgNotFoundError': 'The requested content could not be found.',
|
|
144
|
+
'IgPrivateUserError': 'This account is private. You must follow this user to see their content.',
|
|
145
|
+
'IgUserHasLoggedOutError': 'Your session has expired. Please log in again.',
|
|
146
|
+
'IgInactiveUserError': 'This account is inactive or has been suspended.',
|
|
147
|
+
'IgSentryBlockError': 'This request has been blocked by Instagram\'s security system.',
|
|
148
|
+
'IgNetworkError': 'A network error occurred. Please check your internet connection and try again.',
|
|
149
|
+
'IgUploadError': 'Failed to upload the file. Please check the file format and size.',
|
|
150
|
+
'IgConfigureMediaError': 'Failed to configure the media. Please try again.',
|
|
151
|
+
};
|
|
152
|
+
if (error.response && error.response.status) {
|
|
153
|
+
return `Request failed with status ${error.response.status}: ${error.response.statusText || ''}`;
|
|
154
|
+
}
|
|
155
|
+
return errorMessages[error.name] || error.message || 'An unknown error occurred.';
|
|
156
|
+
}
|
|
157
|
+
static rateLimitDelay(retryAfter = null) {
|
|
158
|
+
if (retryAfter) {
|
|
159
|
+
return parseInt(retryAfter) * 1000;
|
|
160
|
+
}
|
|
161
|
+
return random(5000, 15000);
|
|
162
|
+
}
|
|
163
|
+
static createUserAgentFromDevice(device) {
|
|
164
|
+
return `Instagram 415.0.0.36.76 Android (${device.android_version}/${device.android_release}; ${device.dpi}dpi; ${device.resolution}; ${device.manufacturer}; ${device.model}; ${device.device}; ${device.cpu})`;
|
|
165
|
+
}
|
|
166
|
+
// ========================
|
|
167
|
+
// NEW ENHANCEMENTS
|
|
168
|
+
// ========================
|
|
169
|
+
static generateSecureRandomString(length) {
|
|
170
|
+
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
171
|
+
const randomBytes = crypto.randomBytes(length);
|
|
172
|
+
let result = '';
|
|
173
|
+
for (let i = 0; i < length; i++) {
|
|
174
|
+
result += characters[randomBytes[i] % characters.length];
|
|
175
|
+
}
|
|
176
|
+
return result;
|
|
177
|
+
}
|
|
178
|
+
static fileHash(filePath, algorithm = 'sha256') {
|
|
179
|
+
const fs = require('fs');
|
|
180
|
+
const data = fs.readFileSync(filePath);
|
|
181
|
+
return crypto.createHash(algorithm).update(data).digest('hex');
|
|
182
|
+
}
|
|
183
|
+
static prettyBytes(bytes) {
|
|
184
|
+
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
185
|
+
let i = 0;
|
|
186
|
+
while (bytes >= 1024 && i < units.length - 1) {
|
|
187
|
+
bytes /= 1024;
|
|
188
|
+
i++;
|
|
189
|
+
}
|
|
190
|
+
return `${bytes.toFixed(2)} ${units[i]}`;
|
|
191
|
+
}
|
|
192
|
+
static async retryWithBackoff(operation, maxRetries = 5, baseDelay = 1000) {
|
|
193
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
194
|
+
try {
|
|
195
|
+
return await operation();
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
if (attempt === maxRetries)
|
|
199
|
+
throw error;
|
|
200
|
+
const delay = baseDelay * Math.pow(2, attempt - 1) + Math.random() * 500;
|
|
201
|
+
await this.sleep(delay);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
static logError(error, context = '') {
|
|
206
|
+
var _a;
|
|
207
|
+
console.error(`[${new Date().toISOString()}] ❌ ${context}:`, {
|
|
208
|
+
name: error.name,
|
|
209
|
+
message: error.message,
|
|
210
|
+
stack: (_a = error.stack) === null || _a === void 0 ? void 0 : _a.split('\n').slice(0, 3).join('\n')
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
static debugLog(message) {
|
|
214
|
+
if (process.env.DEBUG === 'true') {
|
|
215
|
+
console.log(`[DEBUG] ${new Date().toISOString()} - ${message}`);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
static generateAndroidDevice() {
|
|
219
|
+
const versions = ['11', '12', '13', '14'];
|
|
220
|
+
const models = ['Pixel 6', 'SM-G991B', 'Redmi Note 10', 'OnePlus 9'];
|
|
221
|
+
const manufacturer = ['Google', 'Samsung', 'Xiaomi', 'OnePlus'];
|
|
222
|
+
const randomIndex = Math.floor(Math.random() * models.length);
|
|
223
|
+
return {
|
|
224
|
+
android_release: versions[randomIndex],
|
|
225
|
+
model: models[randomIndex],
|
|
226
|
+
manufacturer: manufacturer[randomIndex],
|
|
227
|
+
dpi: 480,
|
|
228
|
+
resolution: '1080x2400',
|
|
229
|
+
device: models[randomIndex].replace(/\s+/g, '_').toLowerCase(),
|
|
230
|
+
cpu: 'arm64-v8a',
|
|
231
|
+
android_version: versions[randomIndex]
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
static generateHeaders(userAgent) {
|
|
235
|
+
return {
|
|
236
|
+
'User-Agent': userAgent,
|
|
237
|
+
'Accept': '*/*',
|
|
238
|
+
'Accept-Language': 'en-US',
|
|
239
|
+
'X-Requested-With': 'com.instagram.android',
|
|
240
|
+
'Connection': 'keep-alive'
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
module.exports = Utils;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const { IgApiClient, RealtimeClient } = require('../dist/index');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
// Listen to Instagram Direct Messages in Real-Time
|
|
5
|
+
// Setup: export INSTAGRAM_USERNAME, INSTAGRAM_PASSWORD, INSTAGRAM_EMAIL
|
|
6
|
+
// Run: node examples/listen-to-messages.js
|
|
7
|
+
async function main() {
|
|
8
|
+
const username = process.env.INSTAGRAM_USERNAME;
|
|
9
|
+
const password = process.env.INSTAGRAM_PASSWORD;
|
|
10
|
+
const email = process.env.INSTAGRAM_EMAIL;
|
|
11
|
+
if (!username || !password || !email) {
|
|
12
|
+
console.error('Missing credentials!');
|
|
13
|
+
console.error('Set: INSTAGRAM_USERNAME, INSTAGRAM_PASSWORD, INSTAGRAM_EMAIL');
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
console.log('\n📱 Instagram Direct Messages Listener\n');
|
|
18
|
+
const ig = new IgApiClient();
|
|
19
|
+
// Try to load saved session
|
|
20
|
+
const sessionFile = path.join(__dirname, '../.session');
|
|
21
|
+
if (fs.existsSync(sessionFile)) {
|
|
22
|
+
console.log('Loading saved session...');
|
|
23
|
+
const session = JSON.parse(fs.readFileSync(sessionFile, 'utf8'));
|
|
24
|
+
await ig.loadSession(session);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
console.log('Logging in...');
|
|
28
|
+
await ig.login({ username, password, email });
|
|
29
|
+
const session = await ig.saveSession();
|
|
30
|
+
fs.writeFileSync(sessionFile, JSON.stringify(session));
|
|
31
|
+
}
|
|
32
|
+
console.log(`✓ Logged in as @${username}\n`);
|
|
33
|
+
const realtime = new RealtimeClient(ig);
|
|
34
|
+
realtime.on('connected', () => {
|
|
35
|
+
console.log('✓ Connected to MQTT\n');
|
|
36
|
+
console.log('Waiting for messages... (send a DM to yourself)\n');
|
|
37
|
+
});
|
|
38
|
+
realtime.on('receive', (topic, messages) => {
|
|
39
|
+
if (Array.isArray(messages)) {
|
|
40
|
+
messages.forEach(msg => {
|
|
41
|
+
var _a;
|
|
42
|
+
if (msg.body) {
|
|
43
|
+
console.log('━━━━━━━━━━━━━━━━━━━━━━━');
|
|
44
|
+
console.log(`From: ${msg.from_user_id}`);
|
|
45
|
+
console.log(`Message: ${msg.body}`);
|
|
46
|
+
console.log('━━━━━━━━━━━━━━━━━━━━━━━\n');
|
|
47
|
+
}
|
|
48
|
+
if ((_a = msg.message_data) === null || _a === void 0 ? void 0 : _a.body) {
|
|
49
|
+
console.log('━━━━━━━━━━━━━━━━━━━━━━━');
|
|
50
|
+
console.log(`From: ${msg.from_user_id}`);
|
|
51
|
+
console.log(`Message: ${msg.message_data.body}`);
|
|
52
|
+
console.log('━━━━━━━━━━━━━━━━━━━━━━━\n');
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
realtime.on('error', (error) => {
|
|
58
|
+
console.error('✗ Error:', error.message);
|
|
59
|
+
});
|
|
60
|
+
console.log('Connecting to Instagram MQTT...');
|
|
61
|
+
await realtime.connect({
|
|
62
|
+
graphQlSubs: ['ig_sub_direct'],
|
|
63
|
+
irisData: null
|
|
64
|
+
});
|
|
65
|
+
console.log('Press Ctrl+C to stop\n');
|
|
66
|
+
await new Promise(() => { });
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
console.error('Error:', error.message);
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
main();
|
package/package.json
CHANGED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PROTO_DEFINITIONS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Protobuf Definitions for Instagram MQTT Protocol
|
|
6
|
+
* These are the message schemas used in IRIS, Skywalker, and DirectMessage topics
|
|
7
|
+
*/
|
|
8
|
+
exports.PROTO_DEFINITIONS = {
|
|
9
|
+
DirectRealtimePayload: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
fields: {
|
|
12
|
+
messageType: { type: 'uint32', id: 1 },
|
|
13
|
+
payload: { type: 'bytes', id: 2 },
|
|
14
|
+
timestamp: { type: 'uint64', id: 3 },
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
IrisMessage: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
fields: {
|
|
20
|
+
messageId: { type: 'string', id: 1 },
|
|
21
|
+
threadId: { type: 'string', id: 2 },
|
|
22
|
+
userId: { type: 'uint64', id: 3 },
|
|
23
|
+
text: { type: 'string', id: 4 },
|
|
24
|
+
timestamp: { type: 'uint64', id: 5 },
|
|
25
|
+
itemType: { type: 'string', id: 6 },
|
|
26
|
+
mediaId: { type: 'string', id: 7 },
|
|
27
|
+
isDelivered: { type: 'bool', id: 8 },
|
|
28
|
+
isSeen: { type: 'bool', id: 9 },
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
SkywalkerCommand: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
fields: {
|
|
34
|
+
action: { type: 'string', id: 1 },
|
|
35
|
+
threadId: { type: 'string', id: 2 },
|
|
36
|
+
data: { type: 'bytes', id: 3 },
|
|
37
|
+
timestamp: { type: 'uint64', id: 4 },
|
|
38
|
+
clientContext: { type: 'string', id: 5 },
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
PresenceEvent: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
fields: {
|
|
44
|
+
userId: { type: 'uint64', id: 1 },
|
|
45
|
+
status: { type: 'string', id: 2 }, // online, offline, away
|
|
46
|
+
lastActivity: { type: 'uint64', id: 3 },
|
|
47
|
+
device: { type: 'string', id: 4 }, // mobile, web, unknown
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
TypingIndicator: {
|
|
51
|
+
type: 'object',
|
|
52
|
+
fields: {
|
|
53
|
+
threadId: { type: 'string', id: 1 },
|
|
54
|
+
userId: { type: 'uint64', id: 2 },
|
|
55
|
+
isTyping: { type: 'bool', id: 3 },
|
|
56
|
+
timestamp: { type: 'uint64', id: 4 },
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
MessageReaction: {
|
|
60
|
+
type: 'object',
|
|
61
|
+
fields: {
|
|
62
|
+
messageId: { type: 'string', id: 1 },
|
|
63
|
+
threadId: { type: 'string', id: 2 },
|
|
64
|
+
userId: { type: 'uint64', id: 3 },
|
|
65
|
+
emoji: { type: 'string', id: 4 },
|
|
66
|
+
timestamp: { type: 'uint64', id: 5 },
|
|
67
|
+
operation: { type: 'string', id: 6 }, // add, remove
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
ClientPayload: {
|
|
71
|
+
type: 'object',
|
|
72
|
+
fields: {
|
|
73
|
+
clientVersion: { type: 'string', id: 1 },
|
|
74
|
+
clientUserID: { type: 'uint64', id: 2 },
|
|
75
|
+
clientContext: { type: 'object', id: 3 },
|
|
76
|
+
capabilities: { type: 'object', id: 4 },
|
|
77
|
+
subscribeProtoMask: { type: 'uint32', id: 5 },
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
};
|
package/{dist/repositories/account.repository.js → src-ts/dist/repositories/account.repository.ts}
RENAMED
|
@@ -1138,34 +1138,74 @@ class AccountRepository extends Repository {
|
|
|
1138
1138
|
});
|
|
1139
1139
|
}
|
|
1140
1140
|
|
|
1141
|
-
|
|
1141
|
+
static generateAttestParams(state) {
|
|
1142
|
+
// Emulate Instagram's keystore attestation as closely as possible:
|
|
1143
|
+
// - version: 2
|
|
1144
|
+
// - type: "keystore"
|
|
1145
|
+
// - errors: [0]
|
|
1146
|
+
// - challenge_nonce: random base64url
|
|
1147
|
+
// - signed_nonce: ECDSA signature over the nonce
|
|
1148
|
+
// - key_hash: sha256(spki(publicKey))
|
|
1149
|
+
// - certificate_chain: 4 PEM certificates concatenated (leaf + 2 intermediates + root)
|
|
1150
|
+
//
|
|
1151
|
+
// NOTE: This is *not* a real hardware-backed attestation chain, but it mirrors
|
|
1152
|
+
// the structure of the official app very closely so the server sees the same
|
|
1153
|
+
// shape: a single attestation object with a 4‑certificate chain.
|
|
1142
1154
|
const challengeNonce = crypto.randomBytes(24).toString('base64url');
|
|
1143
1155
|
|
|
1144
1156
|
const { privateKey, publicKey } = crypto.generateKeyPairSync('ec', {
|
|
1145
1157
|
namedCurve: 'prime256v1',
|
|
1146
1158
|
});
|
|
1147
1159
|
|
|
1160
|
+
// Sign the challenge nonce with the private key (simulating TEE signing).
|
|
1148
1161
|
const signedData = crypto.sign(null, Buffer.from(challengeNonce), privateKey);
|
|
1149
1162
|
const signedNonce = signedData.toString('base64');
|
|
1150
1163
|
|
|
1151
1164
|
const publicKeyDer = publicKey.export({ type: 'spki', format: 'der' });
|
|
1152
1165
|
const keyHash = crypto.createHash('sha256').update(publicKeyDer).digest('hex');
|
|
1153
1166
|
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1167
|
+
// Build a 4‑certificate chain (leaf + 2 intermediates + root), just like
|
|
1168
|
+
// what we saw in the captured traffic from the real Instagram app.
|
|
1169
|
+
const leafCertPem = AccountRepository._generateSelfSignedCert(
|
|
1170
|
+
privateKey,
|
|
1171
|
+
publicKey,
|
|
1172
|
+
'Android Keystore Key'
|
|
1173
|
+
);
|
|
1174
|
+
const intermediate1Pem = AccountRepository._generateSelfSignedCert(
|
|
1175
|
+
privateKey,
|
|
1176
|
+
publicKey,
|
|
1177
|
+
'Android Keystore Key Attestation'
|
|
1178
|
+
);
|
|
1179
|
+
const intermediate2Pem = AccountRepository._generateSelfSignedCert(
|
|
1180
|
+
privateKey,
|
|
1181
|
+
publicKey,
|
|
1182
|
+
'Android Hardware Keystore'
|
|
1183
|
+
);
|
|
1184
|
+
const rootCertPem = AccountRepository._generateSelfSignedCert(
|
|
1185
|
+
privateKey,
|
|
1186
|
+
publicKey,
|
|
1187
|
+
'Android Keystore Root'
|
|
1188
|
+
);
|
|
1189
|
+
|
|
1190
|
+
const certificateChain = [
|
|
1191
|
+
leafCertPem,
|
|
1192
|
+
intermediate1Pem,
|
|
1193
|
+
intermediate2Pem,
|
|
1194
|
+
rootCertPem,
|
|
1195
|
+
].join('\n');
|
|
1158
1196
|
|
|
1159
1197
|
return {
|
|
1160
|
-
attestation: [
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1198
|
+
attestation: [
|
|
1199
|
+
{
|
|
1200
|
+
version: 2,
|
|
1201
|
+
type: 'keystore',
|
|
1202
|
+
errors: [0],
|
|
1203
|
+
challenge_nonce: challengeNonce,
|
|
1204
|
+
signed_nonce: signedNonce,
|
|
1205
|
+
key_hash: keyHash,
|
|
1206
|
+
certificate_chain: certificateChain,
|
|
1207
|
+
},
|
|
1208
|
+
],
|
|
1169
1209
|
};
|
|
1170
1210
|
}
|
|
1171
1211
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 10
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 11
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 12
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 13
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 14
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 15
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 16
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 17
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 18
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 19
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 20
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 21
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 22
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 23
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 24
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 25
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 26
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 27
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 28
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 29
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 3
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 30
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 4
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 5
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 6
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 7
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 8
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Helper utility file 9
|