├── .gitignore
├── README.md
├── enum.d.ts
├── examples
├── find_member_in_groups.js
├── login_qr.js
├── mention_user.js
├── moderation
│ ├── kick_all_members_that_has_blacklist_words.js
│ └── kick_blacklist_words_group.js
└── simple.js
├── index.d.ts
├── index.js
├── package-lock.json
├── package.json
└── src
├── CONSENT
├── gen-nodejs
│ ├── AuthService.js
│ ├── AuthService_types.js
│ ├── SecondaryQrCodeLoginPermitNoticeService.js
│ ├── SecondaryQrCodeLoginPermitNoticeService_types.js
│ ├── SecondaryQrCodeLoginService.js
│ ├── SecondaryQrCodeLoginService_types.js
│ ├── TalkService.js
│ └── TalkService_types.js
└── index.js
├── Client
├── Client.js
├── actions
│ ├── -INVITE_INTO_CHAT.js
│ ├── -SEND_MESSAGE.js
│ ├── ACCEPT_CHAT_INVITATION.js
│ ├── CREATE_CHAT.js
│ ├── DELETE_OTHER_FROM_CHAT.js
│ ├── DELETE_SELF_FROM_CHAT.js
│ ├── DESTROY_MESSAGE.js
│ ├── DUMMY.js
│ ├── END_OF_OPERATION.js
│ ├── INVITE_INTO_CHAT.js
│ ├── NOTIFIED_ACCEPT_CHAT_INVITATION.js
│ ├── NOTIFIED_CANCEL_CHAT_INVITATION.js
│ ├── NOTIFIED_DELETE_SELF_FROM_CHAT.js
│ ├── NOTIFIED_INVITE_INTO_CHAT.js
│ ├── NOTIFIED_JOIN_CHAT.js
│ ├── NOTIFIED_LEAVE_CHAT.js
│ ├── NOTIFIED_READ_MESSAGE.js
│ ├── NOTIFIED_RECEIVED_CALL.js
│ ├── NOTIFIED_UPDATE_PROFILE.js
│ ├── RECEIVE_MESSAGE.js
│ ├── REJECT_CHAT_INVITATION.js
│ └── SEND_CHAT_REMOVED.js
├── auth
│ ├── login_qr.js
│ └── login_user_pass.js
└── thrift
│ ├── Thrift_Client.js
│ └── Thrift_Manager.js
├── Managers
├── BaseManager.js
├── ChannelManager.js
├── GroupChannelManager.js
├── GroupMemberManager.js
├── MessageManager.js
└── UserManager.js
├── structures
├── Base.js
├── Channel
│ ├── Channel.js
│ ├── GroupChannel.js
│ └── TextBaseChannel.js
├── Chat_Invite.js
├── Location
│ └── Location.js
├── Message
│ └── Message.js
└── User
│ ├── Base_User.js
│ ├── Client_User.js
│ ├── Group_Member.js
│ └── User.js
└── util
├── Collection.js
├── LimitedCollection.js
└── Util.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | ### Node template
3 | # Logs
4 | /except
5 | test.js
6 | *.log
7 | npm-debug.log*
8 | yarn-debug.log*
9 | yarn-error.log*
10 | /config/config.js
11 | # Runtime data
12 | pids
13 | *.pid
14 | *.seed
15 | *.pid.lock
16 |
17 | # Directory for instrumented libs generated by jscoverage/JSCover
18 | lib-cov
19 |
20 | # Coverage directory used by tools like istanbul
21 | coverage
22 |
23 | # nyc test coverage
24 | .nyc_output
25 |
26 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
27 | .grunt
28 |
29 | # Bower dependency directory (https://bower.io/)
30 | bower_components
31 |
32 | # node-waf configuration
33 | .lock-wscript
34 |
35 | # Compiled binary addons (https://nodejs.org/api/addons.html)
36 | build/Release
37 |
38 | # Dependency directories
39 | node_modules/
40 | jspm_packages/
41 |
42 | # TypeScript v1 declaration files
43 | typings/
44 |
45 | # Optional npm cache directory
46 | .npm
47 |
48 | # Optional eslint cache
49 | .eslintcache
50 |
51 | # Optional REPL history
52 | .node_repl_history
53 |
54 | # Output of 'npm pack'
55 | *.tgz
56 |
57 | # Yarn Integrity file
58 | .yarn-integrity
59 |
60 | # dotenv environment variables file
61 | .env
62 |
63 | # parcel-bundler cache (https://parceljs.org/)
64 | .cache
65 |
66 | # next.js build output
67 | .next
68 |
69 | # nuxt.js build output
70 | .nuxt
71 | # Nuxt generate
72 | dist
73 |
74 | # vuepress build output
75 | .vuepress/dist
76 |
77 | # Serverless directories
78 | .serverless
79 |
80 | # IDE / Editor
81 | .idea
82 |
83 | # Service worker
84 | sw.*
85 |
86 | # macOS
87 | .DS_Store
88 |
89 | # Vim swap files
90 | *.swp
91 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # LineJS(No E2E Support)
2 | LINE's selfbot libraries written in NodeJS.
3 |
4 | ***
5 |
6 |
Latest Version: LINEJS (E2EE Supported)
7 |
8 | ***
9 |
10 | **Please note that this project is not heavily maintained and some functions are not tested yet.**
11 |
12 | ## Installation
13 | ```sh
14 | npm install node-linejs
15 | ```
16 |
17 | ## Examples
18 | More examples can be found [here](https://github.com/chanios/node-linejs/tree/main/examples/)
19 | ```js
20 | const { Client } = require('node-linejs');
21 | const bot = new Client();
22 |
23 | bot.on('ready',()=>{console.log('Logged in as ' + bot.user.displayName)})
24 |
25 | bot.on('message',(message)=>{
26 | if(message.author.id == bot.user.id) return;
27 | if(message.content == 'ping') {
28 | return message.channel.send('pong')
29 | }
30 | })
31 |
32 | bot.login()
33 | ```
34 |
35 | ## References
36 | [LRTT/linepy](https://github.com/LRTT/linepy)
37 |
38 | [LRTT/LINE-SERVICES](https://github.com/LRTT/LINE-SERVICES)
39 |
40 | [crash-override404/linepy-modified](https://github.com/crash-override404/linepy-modified)
41 |
42 | [herywinarto/SIMPLE-PROTECTV2](herywinarto/SIMPLE-PROTECTV2)
43 |
44 | [discordjs/collection](https://www.npmjs.com/package/@discordjs/collection)
45 | ## License
46 | 
This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.
47 |
--------------------------------------------------------------------------------
/enum.d.ts:
--------------------------------------------------------------------------------
1 |
2 | export enum ErrorCode {
3 | 'ILLEGAL_ARGUMENT' = 0,
4 | 'AUTHENTICATION_FAILED' = 1,
5 | 'DB_FAILED' = 2,
6 | 'INVALID_STATE' = 3,
7 | 'EXCESSIVE_ACCESS' = 4,
8 | 'NOT_FOUND' = 5,
9 | 'INVALID_MID' = 9,
10 | 'NOT_A_MEMBER' = 10,
11 | 'INVALID_LENGTH' = 6,
12 | 'NOT_AVAILABLE_USER' = 7,
13 | 'NOT_AUTHORIZED_DEVICE' = 8,
14 | 'NOT_AUTHORIZED_SESSION' = 14,
15 | 'INCOMPATIBLE_APP_VERSION' = 11,
16 | 'NOT_READY' = 12,
17 | 'NOT_AVAILABLE_SESSION' = 13,
18 | 'SYSTEM_ERROR' = 15,
19 | 'NO_AVAILABLE_VERIFICATION_METHOD' = 16,
20 | 'NOT_AUTHENTICATED' = 17,
21 | 'INVALID_IDENTITY_CREDENTIAL' = 18,
22 | 'NOT_AVAILABLE_IDENTITY_IDENTIFIER' = 19,
23 | 'INTERNAL_ERROR' = 20,
24 | 'NO_SUCH_IDENTITY_IDENFIER' = 21,
25 | 'DEACTIVATED_ACCOUNT_BOUND_TO_THIS_IDENTITY' = 22,
26 | 'ILLEGAL_IDENTITY_CREDENTIAL' = 23,
27 | 'UNKNOWN_CHANNEL' = 24,
28 | 'NO_SUCH_MESSAGE_BOX' = 25,
29 | 'NOT_AVAILABLE_MESSAGE_BOX' = 26,
30 | 'CHANNEL_DOES_NOT_MATCH' = 27,
31 | 'NOT_YOUR_MESSAGE' = 28,
32 | 'MESSAGE_DEFINED_ERROR' = 29,
33 | 'USER_CANNOT_ACCEPT_PRESENTS' = 30,
34 | 'USER_NOT_STICKER_OWNER' = 32,
35 | 'MAINTENANCE_ERROR' = 33,
36 | 'ACCOUNT_NOT_MATCHED' = 34,
37 | 'ABUSE_BLOCK' = 35,
38 | 'NOT_FRIEND' = 36,
39 | 'NOT_ALLOWED_CALL' = 37,
40 | 'BLOCK_FRIEND' = 38,
41 | 'INCOMPATIBLE_VOIP_VERSION' = 39,
42 | 'INVALID_SNS_ACCESS_TOKEN' = 40,
43 | 'EXTERNAL_SERVICE_NOT_AVAILABLE' = 41,
44 | 'NOT_ALLOWED_ADD_CONTACT' = 42,
45 | 'NOT_CERTIFICATED' = 43,
46 | 'NOT_ALLOWED_SECONDARY_DEVICE' = 44,
47 | 'INVALID_PIN_CODE' = 45,
48 | 'NOT_FOUND_IDENTITY_CREDENTIAL' = 46,
49 | 'EXCEED_FILE_MAX_SIZE' = 47,
50 | 'EXCEED_DAILY_QUOTA' = 48,
51 | 'NOT_SUPPORT_SEND_FILE' = 49,
52 | 'MUST_UPGRADE' = 50,
53 | 'NOT_AVAILABLE_PIN_CODE_SESSION' = 51,
54 | 'EXPIRED_REVISION' = 52,
55 | 'NOT_YET_PHONE_NUMBER' = 54,
56 | 'BAD_CALL_NUMBER' = 55,
57 | 'UNAVAILABLE_CALL_NUMBER' = 56,
58 | 'NOT_SUPPORT_CALL_SERVICE' = 57,
59 | 'CONGESTION_CONTROL' = 58,
60 | 'NO_BALANCE' = 59,
61 | 'NOT_PERMITTED_CALLER_ID' = 60,
62 | 'NO_CALLER_ID_LIMIT_EXCEEDED' = 61,
63 | 'CALLER_ID_VERIFICATION_REQUIRED' = 62,
64 | 'NO_CALLER_ID_LIMIT_EXCEEDED_AND_VERIFICATION_REQUIRED' = 63,
65 | 'MESSAGE_NOT_FOUND' = 64,
66 | 'INVALID_ACCOUNT_MIGRATION_PINCODE_FORMAT' = 65,
67 | 'ACCOUNT_MIGRATION_PINCODE_NOT_MATCHED' = 66,
68 | 'ACCOUNT_MIGRATION_PINCODE_BLOCKED' = 67,
69 | 'INVALID_PASSWORD_FORMAT' = 69,
70 | 'FEATURE_RESTRICTED' = 70,
71 | 'MESSAGE_NOT_DESTRUCTIBLE' = 71,
72 | 'PAID_CALL_REDEEM_FAILED' = 72,
73 | 'PREVENTED_JOIN_BY_TICKET' = 73,
74 | 'SEND_MESSAGE_NOT_PERMITTED_FROM_LINE_AT' = 75,
75 | 'SEND_MESSAGE_NOT_PERMITTED_WHILE_AUTO_REPLY' = 76,
76 | 'SECURITY_CENTER_NOT_VERIFIED' = 77,
77 | 'SECURITY_CENTER_BLOCKED_BY_SETTING' = 78,
78 | 'SECURITY_CENTER_BLOCKED' = 79,
79 | 'TALK_PROXY_EXCEPTION' = 80,
80 | 'E2EE_INVALID_PROTOCOL' = 81,
81 | 'E2EE_RETRY_ENCRYPT' = 82,
82 | 'E2EE_UPDATE_SENDER_KEY' = 83,
83 | 'E2EE_UPDATE_RECEIVER_KEY' = 84,
84 | 'E2EE_INVALID_ARGUMENT' = 85,
85 | 'E2EE_INVALID_VERSION' = 86,
86 | 'E2EE_SENDER_DISABLED' = 87,
87 | 'E2EE_RECEIVER_DISABLED' = 88,
88 | 'E2EE_SENDER_NOT_ALLOWED' = 89,
89 | 'E2EE_RECEIVER_NOT_ALLOWED' = 90,
90 | 'E2EE_RESEND_FAIL' = 91,
91 | 'E2EE_RESEND_OK' = 92,
92 | 'HITOKOTO_BACKUP_NO_AVAILABLE_DATA' = 93,
93 | 'E2EE_UPDATE_PRIMARY_DEVICE' = 94,
94 | 'SUCCESS' = 95,
95 | 'CANCEL' = 96,
96 | 'E2EE_PRIMARY_NOT_SUPPORT' = 97,
97 | 'E2EE_RETRY_PLAIN' = 98,
98 | 'E2EE_RECREATE_GROUP_KEY' = 99,
99 | 'E2EE_GROUP_TOO_MANY_MEMBERS' = 100,
100 | 'SERVER_BUSY' = 101,
101 | 'NOT_ALLOWED_ADD_FOLLOW' = 102,
102 | 'INCOMING_FRIEND_REQUEST_LIMIT' = 103,
103 | 'OUTGOING_FRIEND_REQUEST_LIMIT' = 104,
104 | 'OUTGOING_FRIEND_REQUEST_QUOTA' = 105,
105 | 'DUPLICATED' = 106,
106 | 'BANNED' = 107,
107 | 'NOT_AN_INVITEE' = 108,
108 | 'NOT_AN_OUTSIDER' = 109,
109 | 'EMPTY_GROUP' = 111,
110 | 'EXCEED_FOLLOW_LIMIT' = 112,
111 | 'UNSUPPORTED_ACCOUNT_TYPE' = 113
112 | };
113 | export enum ProfileAttribute {
114 | 'ALL' = 511,
115 | 'EMAIL' = 1,
116 | 'DISPLAY_NAME' = 2,
117 | 'PHONETIC_NAME' = 4,
118 | 'PICTURE' = 8,
119 | 'STATUS_MESSAGE' = 16,
120 | 'ALLOW_SEARCH_BY_USERID' = 32,
121 | 'ALLOW_SEARCH_BY_EMAIL' = 64,
122 | 'BUDDY_STATUS' = 128,
123 | 'MUSIC_PROFILE' = 256,
124 | 'AVATAR_PROFILE' = 512
125 | };
126 | export enum SettingsAttributeEx {
127 | 'NOTIFICATION_ENABLE' = 0,
128 | 'NOTIFICATION_MUTE_EXPIRATION' = 1,
129 | 'NOTIFICATION_NEW_MESSAGE' = 2,
130 | 'NOTIFICATION_GROUP_INVITATION' = 3,
131 | 'NOTIFICATION_SHOW_MESSAGE' = 4,
132 | 'NOTIFICATION_INCOMING_CALL' = 5,
133 | 'NOTIFICATION_SOUND_MESSAGE' = 8,
134 | 'NOTIFICATION_SOUND_GROUP' = 9,
135 | 'NOTIFICATION_DISABLED_WITH_SUB' = 16,
136 | 'NOTIFICATION_PAYMENT' = 17,
137 | 'NOTIFICATION_MENTION' = 40,
138 | 'NOTIFICATION_THUMBNAIL' = 45,
139 | 'PRIVACY_SYNC_CONTACTS' = 6,
140 | 'PRIVACY_SEARCH_BY_PHONE_NUMBER' = 7,
141 | 'PRIVACY_SEARCH_BY_USERID' = 13,
142 | 'PRIVACY_SEARCH_BY_EMAIL' = 14,
143 | 'PRIVACY_SHARE_PERSONAL_INFO_TO_FRIENDS' = 51,
144 | 'PRIVACY_ALLOW_SECONDARY_DEVICE_LOGIN' = 21,
145 | 'PRIVACY_PROFILE_IMAGE_POST_TO_MYHOME' = 23,
146 | 'PRIVACY_PROFILE_MUSIC_POST_TO_MYHOME' = 35,
147 | 'PRIVACY_PROFILE_HISTORY' = 57,
148 | 'PRIVACY_STATUS_MESSAGE_HISTORY' = 54,
149 | 'PRIVACY_ALLOW_FRIEND_REQUEST' = 30,
150 | 'PRIVACY_RECV_MESSAGES_FROM_NOT_FRIEND' = 25,
151 | 'PRIVACY_AGREE_USE_LINECOIN_TO_PAIDCALL' = 26,
152 | 'PRIVACY_AGREE_USE_PAIDCALL' = 27,
153 | 'PRIVACY_AGE_RESULT' = 60,
154 | 'PRIVACY_AGE_RESULT_RECEIVED' = 61,
155 | 'PRIVACY_ALLOW_FOLLOW' = 63,
156 | 'PRIVACY_SHOW_FOLLOW_LIST' = 64,
157 | 'CONTACT_MY_TICKET' = 10,
158 | 'IDENTITY_PROVIDER' = 11,
159 | 'IDENTITY_IDENTIFIER' = 12,
160 | 'SNS_ACCOUNT' = 19,
161 | 'PHONE_REGISTRATION' = 20,
162 | 'PREFERENCE_LOCALE' = 15,
163 | 'CUSTOM_MODE' = 22,
164 | 'EMAIL_CONFIRMATION_STATUS' = 24,
165 | 'ACCOUNT_MIGRATION_PINCODE' = 28,
166 | 'ENFORCED_INPUT_ACCOUNT_MIGRATION_PINCODE' = 29,
167 | 'SECURITY_CENTER_SETTINGS' = 18,
168 | 'E2EE_ENABLE' = 33,
169 | 'HITOKOTO_BACKUP_REQUESTED' = 34,
170 | 'CONTACT_ALLOW_FOLLOWING' = 36,
171 | 'PRIVACY_ALLOW_NEARBY' = 37,
172 | 'AGREEMENT_NEARBY' = 38,
173 | 'AGREEMENT_SQUARE' = 39,
174 | 'ALLOW_UNREGISTRATION_SECONDARY_DEVICE' = 41,
175 | 'AGREEMENT_BOT_USE' = 42,
176 | 'AGREEMENT_SHAKE_FUNCTION' = 43,
177 | 'AGREEMENT_MOBILE_CONTACT_NAME' = 44,
178 | 'AGREEMENT_SOUND_TO_TEXT' = 46,
179 | 'AGREEMENT_PRIVACY_POLICY_VERSION' = 47,
180 | 'AGREEMENT_AD_BY_WEB_ACCESS' = 48,
181 | 'AGREEMENT_PHONE_NUMBER_MATCHING' = 49,
182 | 'AGREEMENT_COMMUNICATION_INFO' = 50,
183 | 'AGREEMENT_THINGS_WIRELESS_COMMUNICATION' = 52,
184 | 'AGREEMENT_GDPR' = 53,
185 | 'AGREEMENT_PROVIDE_LOCATION' = 55,
186 | 'AGREEMENT_BEACON' = 56,
187 | 'AGREEMENT_CONTENTS_SUGGEST' = 58,
188 | 'AGREEMENT_CONTENTS_SUGGEST_DATA_COLLECTION' = 59,
189 | 'AGREEMENT_OCR_IMAGE_COLLECTION' = 62
190 | };
191 | export enum SyncReason {
192 | 'UNSPECIFIED' = 0,
193 | 'UNKNOWN' = 1,
194 | 'INITIALIZATION' = 2,
195 | 'OPERATION' = 3,
196 | 'FULL_SYNC' = 4,
197 | 'AUTO_REPAIR' = 5,
198 | 'MANUAL_REPAIR' = 6,
199 | 'INTERNAL' = 7
200 | };
201 | export enum ContactType {
202 | 'MID' = 0,
203 | 'PHONE' = 1,
204 | 'EMAIL' = 2,
205 | 'USERID' = 3,
206 | 'PROXIMITY' = 4,
207 | 'GROUP' = 5,
208 | 'USER' = 6,
209 | 'QRCODE' = 7,
210 | 'PROMOTION_BOT' = 8,
211 | 'CONTACT_MESSAGE' = 9,
212 | 'FRIEND_REQUEST' = 10,
213 | 'REPAIR' = 128,
214 | 'FACEBOOK' = 2305,
215 | 'SINA' = 2306,
216 | 'RENREN' = 2307,
217 | 'FEIXIN' = 2308,
218 | 'BBM' = 2309,
219 | 'BEACON' = 11
220 | };
221 | export enum ContactStatus {
222 | 'UNSPECIFIED' = 0,
223 | 'FRIEND' = 1,
224 | 'FRIEND_BLOCKED' = 2,
225 | 'RECOMMEND' = 3,
226 | 'RECOMMEND_BLOCKED' = 4,
227 | 'DELETED' = 5,
228 | 'DELETED_BLOCKED' = 6
229 | };
230 | export enum ContactRelation {
231 | 'ONEWAY' = 0,
232 | 'BOTH' = 1,
233 | 'NOT_REGISTERED' = 2
234 | };
235 | export enum FriendRequestStatus {
236 | 'NONE' = 0,
237 | 'AVAILABLE' = 1,
238 | 'ALREADY_REQUESTED' = 2,
239 | 'UNAVAILABLE' = 3
240 | };
241 | export enum OpType {
242 | 'END_OF_OPERATION' = 0,
243 | 'UPDATE_PROFILE' = 1,
244 | 'UPDATE_SETTINGS' = 36,
245 | 'NOTIFIED_UPDATE_PROFILE' = 2,
246 | 'REGISTER_USERID' = 3,
247 | 'ADD_CONTACT' = 4,
248 | 'NOTIFIED_ADD_CONTACT' = 5,
249 | 'BLOCK_CONTACT' = 6,
250 | 'UNBLOCK_CONTACT' = 7,
251 | 'NOTIFIED_RECOMMEND_CONTACT' = 8,
252 | 'CREATE_GROUP' = 9,
253 | 'UPDATE_GROUP' = 10,
254 | 'NOTIFIED_UPDATE_GROUP' = 11,
255 | 'INVITE_INTO_GROUP' = 12,
256 | 'NOTIFIED_INVITE_INTO_GROUP' = 13,
257 | 'CANCEL_INVITATION_GROUP' = 31,
258 | 'NOTIFIED_CANCEL_INVITATION_GROUP' = 32,
259 | 'LEAVE_GROUP' = 14,
260 | 'NOTIFIED_LEAVE_GROUP' = 15,
261 | 'ACCEPT_GROUP_INVITATION' = 16,
262 | 'NOTIFIED_ACCEPT_GROUP_INVITATION' = 17,
263 | 'REJECT_GROUP_INVITATION' = 34,
264 | 'NOTIFIED_REJECT_GROUP_INVITATION' = 35,
265 | 'KICKOUT_FROM_GROUP' = 18,
266 | 'NOTIFIED_KICKOUT_FROM_GROUP' = 19,
267 | 'CREATE_ROOM' = 20,
268 | 'INVITE_INTO_ROOM' = 21,
269 | 'NOTIFIED_INVITE_INTO_ROOM' = 22,
270 | 'LEAVE_ROOM' = 23,
271 | 'NOTIFIED_LEAVE_ROOM' = 24,
272 | 'SEND_MESSAGE' = 25,
273 | 'RECEIVE_MESSAGE' = 26,
274 | 'SEND_MESSAGE_RECEIPT' = 27,
275 | 'RECEIVE_MESSAGE_RECEIPT' = 28,
276 | 'SEND_CONTENT_RECEIPT' = 29,
277 | 'SEND_CHAT_CHECKED' = 40,
278 | 'SEND_CHAT_REMOVED' = 41,
279 | 'RECEIVE_ANNOUNCEMENT' = 30,
280 | 'INVITE_VIA_EMAIL' = 38,
281 | 'NOTIFIED_REGISTER_USER' = 37,
282 | 'NOTIFIED_UNREGISTER_USER' = 33,
283 | 'NOTIFIED_REQUEST_RECOVERY' = 39,
284 | 'NOTIFIED_FORCE_SYNC' = 42,
285 | 'SEND_CONTENT' = 43,
286 | 'SEND_MESSAGE_MYHOME' = 44,
287 | 'NOTIFIED_UPDATE_CONTENT_PREVIEW' = 45,
288 | 'REMOVE_ALL_MESSAGES' = 46,
289 | 'NOTIFIED_UPDATE_PURCHASES' = 47,
290 | 'DUMMY' = 48,
291 | 'UPDATE_CONTACT' = 49,
292 | 'NOTIFIED_RECEIVED_CALL' = 50,
293 | 'CANCEL_CALL' = 51,
294 | 'NOTIFIED_REDIRECT' = 52,
295 | 'NOTIFIED_CHANNEL_SYNC' = 53,
296 | 'FAILED_SEND_MESSAGE' = 54,
297 | 'NOTIFIED_READ_MESSAGE' = 55,
298 | 'FAILED_EMAIL_CONFIRMATION' = 56,
299 | 'NOTIFIED_PUSH_NOTICENTER_ITEM' = 59,
300 | 'NOTIFIED_CHAT_CONTENT' = 58,
301 | 'NOTIFIED_JOIN_CHAT' = 60,
302 | 'NOTIFIED_LEAVE_CHAT' = 61,
303 | 'NOTIFIED_TYPING' = 62,
304 | 'FRIEND_REQUEST_ACCEPTED' = 63,
305 | 'DESTROY_MESSAGE' = 64,
306 | 'NOTIFIED_DESTROY_MESSAGE' = 65,
307 | 'UPDATE_PUBLICKEYCHAIN' = 66,
308 | 'NOTIFIED_UPDATE_PUBLICKEYCHAIN' = 67,
309 | 'NOTIFIED_BLOCK_CONTACT' = 68,
310 | 'NOTIFIED_UNBLOCK_CONTACT' = 69,
311 | 'UPDATE_GROUPPREFERENCE' = 70,
312 | 'NOTIFIED_PAYMENT_EVENT' = 71,
313 | 'REGISTER_E2EE_PUBLICKEY' = 72,
314 | 'NOTIFIED_E2EE_KEY_EXCHANGE_REQ' = 73,
315 | 'NOTIFIED_E2EE_KEY_EXCHANGE_RESP' = 74,
316 | 'NOTIFIED_E2EE_MESSAGE_RESEND_REQ' = 75,
317 | 'NOTIFIED_E2EE_MESSAGE_RESEND_RESP' = 76,
318 | 'NOTIFIED_E2EE_KEY_UPDATE' = 77,
319 | 'NOTIFIED_BUDDY_UPDATE_PROFILE' = 78,
320 | 'NOTIFIED_UPDATE_LINEAT_TABS' = 79,
321 | 'UPDATE_ROOM' = 80,
322 | 'NOTIFIED_BEACON_DETECTED' = 81,
323 | 'UPDATE_EXTENDED_PROFILE' = 82,
324 | 'ADD_FOLLOW' = 83,
325 | 'NOTIFIED_ADD_FOLLOW' = 84,
326 | 'DELETE_FOLLOW' = 85,
327 | 'NOTIFIED_DELETE_FOLLOW' = 86,
328 | 'UPDATE_TIMELINE_SETTINGS' = 87,
329 | 'NOTIFIED_FRIEND_REQUEST' = 88,
330 | 'UPDATE_RINGBACK_TONE' = 89,
331 | 'NOTIFIED_POSTBACK' = 90,
332 | 'RECEIVE_READ_WATERMARK' = 91,
333 | 'NOTIFIED_MESSAGE_DELIVERED' = 92,
334 | 'NOTIFIED_UPDATE_CHAT_BAR' = 93,
335 | 'NOTIFIED_CHATAPP_INSTALLED' = 94,
336 | 'NOTIFIED_CHATAPP_UPDATED' = 95,
337 | 'NOTIFIED_CHATAPP_NEW_MARK' = 96,
338 | 'NOTIFIED_CHATAPP_DELETED' = 97,
339 | 'NOTIFIED_CHATAPP_SYNC' = 98,
340 | 'NOTIFIED_UPDATE_MESSAGE' = 99,
341 | 'UPDATE_CHATROOMBGM' = 100,
342 | 'NOTIFIED_UPDATE_CHATROOMBGM' = 101,
343 | 'UPDATE_RINGTONE' = 102,
344 | 'UPDATE_USER_SETTINGS' = 118,
345 | 'NOTIFIED_UPDATE_STATUS_BAR' = 119,
346 | 'CREATE_CHAT' = 120,
347 | 'UPDATE_CHAT' = 121,
348 | 'NOTIFIED_UPDATE_CHAT' = 122,
349 | 'INVITE_INTO_CHAT' = 123,
350 | 'NOTIFIED_INVITE_INTO_CHAT' = 124,
351 | 'CANCEL_CHAT_INVITATION' = 125,
352 | 'NOTIFIED_CANCEL_CHAT_INVITATION' = 126,
353 | 'DELETE_SELF_FROM_CHAT' = 127,
354 | 'NOTIFIED_DELETE_SELF_FROM_CHAT' = 128,
355 | 'ACCEPT_CHAT_INVITATION' = 129,
356 | 'NOTIFIED_ACCEPT_CHAT_INVITATION' = 130,
357 | 'REJECT_CHAT_INVITATION' = 131,
358 | 'DELETE_OTHER_FROM_CHAT' = 132,
359 | 'NOTIFIED_DELETE_OTHER_FROM_CHAT' = 133
360 | };
361 | export enum OpStatus {
362 | 'NORMAL' = 0,
363 | 'ALERT_DISABLED' = 1,
364 | 'ALWAYS' = 2
365 | };
366 | export enum MIDType {
367 | 'USER' = 0,
368 | 'ROOM' = 1,
369 | 'GROUP' = 2,
370 | 'SQUARE' = 3,
371 | 'SQUARE_CHAT' = 4,
372 | 'SQUARE_MEMBER' = 5,
373 | 'BOT' = 6
374 | };
375 | export enum PlaceSearchProvider {
376 | 'GOOGLE' = 0,
377 | 'BAIDU' = 1,
378 | 'FOURSQUARE' = 2
379 | };
380 | export enum ContentType {
381 | 'NONE' = 0,
382 | 'IMAGE' = 1,
383 | 'VIDEO' = 2,
384 | 'AUDIO' = 3,
385 | 'HTML' = 4,
386 | 'PDF' = 5,
387 | 'CALL' = 6,
388 | 'STICKER' = 7,
389 | 'PRESENCE' = 8,
390 | 'GIFT' = 9,
391 | 'GROUPBOARD' = 10,
392 | 'APPLINK' = 11,
393 | 'LINK' = 12,
394 | 'CONTACT' = 13,
395 | 'FILE' = 14,
396 | 'LOCATION' = 15,
397 | 'POSTNOTIFICATION' = 16,
398 | 'RICH' = 17,
399 | 'CHATEVENT' = 18,
400 | 'MUSIC' = 19,
401 | 'PAYMENT' = 20,
402 | 'EXTIMAGE' = 21,
403 | 'FLEX' = 22
404 | };
405 | export enum MessageRelationType {
406 | 'FORWARD' = 0,
407 | 'AUTO_REPLY' = 1,
408 | 'SUBORDINATE' = 2,
409 | 'REPLY' = 3
410 | };
411 | export enum ServiceCode {
412 | 'UNKNOWN' = 0,
413 | 'TALK' = 1,
414 | 'SQUARE' = 2
415 | };
416 | export enum AppExtensionType {
417 | 'SIRI' = 1,
418 | 'GOOGLE_ASSISTANT' = 2,
419 | 'OS_SHARE' = 3
420 | };
421 | export enum ChatAttribute {
422 | 'NAME' = 1,
423 | 'PICTURE_STATUS' = 2,
424 | 'PREVENTED_JOIN_BY_TICKET' = 4,
425 | 'NOTIFICATION_SETTING' = 8,
426 | 'INVITATION_TICKET' = 16,
427 | 'FAVORITE_TIMESTAMP' = 32,
428 | 'CHAT_TYPE' = 64
429 | };
430 | export enum ChatType {
431 | 'GROUP' = 0,
432 | 'ROOM' = 1,
433 | 'PEER' = 2
434 | };
435 | export enum IdentityProvider {
436 | 'UNKNOWN' = 0,
437 | 'LINE' = 1,
438 | 'NAVER_KR' = 2,
439 | 'LINE_PHONE' = 3
440 | };
441 | export enum CountryGroup {
442 | 'UNKNOWN' = 0,
443 | 'EUROPEAN_ECONOMIC_AREA' = 1
444 | };
445 | export enum VerificationMethod {
446 | 'NO_AVAILABLE' = 0,
447 | 'PIN_VIA_SMS' = 1,
448 | 'CALLERID_INDIGO' = 2,
449 | 'PIN_VIA_TTS' = 4,
450 | 'SKIP' = 10
451 | };
452 | export enum CarrierCode {
453 | 'NOT_SPECIFIED' = 0,
454 | 'JP_DOCOMO' = 1,
455 | 'JP_AU' = 2,
456 | 'JP_SOFTBANK' = 3,
457 | 'KR_SKT' = 17,
458 | 'KR_KT' = 18,
459 | 'KR_LGT' = 19,
460 | 'JP_DOCOMO_LINE' = 4,
461 | 'JP_SOFTBANK_LINE' = 5,
462 | 'JP_AU_LINE' = 6
463 | };
464 | export enum ApplicationType {
465 | 'IOS' = 16,
466 | 'IOS_RC' = 17,
467 | 'IOS_BETA' = 18,
468 | 'IOS_ALPHA' = 19,
469 | 'ANDROID' = 32,
470 | 'ANDROID_RC' = 33,
471 | 'ANDROID_BETA' = 34,
472 | 'ANDROID_ALPHA' = 35,
473 | 'WAP' = 48,
474 | 'WAP_RC' = 49,
475 | 'WAP_BETA' = 50,
476 | 'WAP_ALPHA' = 51,
477 | 'BOT' = 64,
478 | 'BOT_RC' = 65,
479 | 'BOT_BETA' = 66,
480 | 'BOT_ALPHA' = 67,
481 | 'WEB' = 80,
482 | 'WEB_RC' = 81,
483 | 'WEB_BETA' = 82,
484 | 'WEB_ALPHA' = 83,
485 | 'DESKTOPWIN' = 96,
486 | 'DESKTOPWIN_RC' = 97,
487 | 'DESKTOPWIN_BETA' = 98,
488 | 'DESKTOPWIN_ALPHA' = 99,
489 | 'DESKTOPMAC' = 112,
490 | 'DESKTOPMAC_RC' = 113,
491 | 'DESKTOPMAC_BETA' = 114,
492 | 'DESKTOPMAC_ALPHA' = 115,
493 | 'CHANNELGW' = 128,
494 | 'CHANNELGW_RC' = 129,
495 | 'CHANNELGW_BETA' = 130,
496 | 'CHANNELGW_ALPHA' = 131,
497 | 'CHANNELCP' = 144,
498 | 'CHANNELCP_RC' = 145,
499 | 'CHANNELCP_BETA' = 146,
500 | 'CHANNELCP_ALPHA' = 147,
501 | 'WINPHONE' = 160,
502 | 'WINPHONE_RC' = 161,
503 | 'WINPHONE_BETA' = 162,
504 | 'WINPHONE_ALPHA' = 163,
505 | 'BLACKBERRY' = 176,
506 | 'BLACKBERRY_RC' = 177,
507 | 'BLACKBERRY_BETA' = 178,
508 | 'BLACKBERRY_ALPHA' = 179,
509 | 'WINMETRO' = 192,
510 | 'WINMETRO_RC' = 193,
511 | 'WINMETRO_BETA' = 194,
512 | 'WINMETRO_ALPHA' = 195,
513 | 'S40' = 208,
514 | 'S40_RC' = 209,
515 | 'S40_BETA' = 210,
516 | 'S40_ALPHA' = 211,
517 | 'CHRONO' = 224,
518 | 'CHRONO_RC' = 225,
519 | 'CHRONO_BETA' = 226,
520 | 'CHRONO_ALPHA' = 227,
521 | 'TIZEN' = 256,
522 | 'TIZEN_RC' = 257,
523 | 'TIZEN_BETA' = 258,
524 | 'TIZEN_ALPHA' = 259,
525 | 'VIRTUAL' = 272,
526 | 'FIREFOXOS' = 288,
527 | 'FIREFOXOS_RC' = 289,
528 | 'FIREFOXOS_BETA' = 290,
529 | 'FIREFOXOS_ALPHA' = 291,
530 | 'IOSIPAD' = 304,
531 | 'IOSIPAD_RC' = 305,
532 | 'IOSIPAD_BETA' = 306,
533 | 'IOSIPAD_ALPHA' = 307,
534 | 'BIZIOS' = 320,
535 | 'BIZIOS_RC' = 321,
536 | 'BIZIOS_BETA' = 322,
537 | 'BIZIOS_ALPHA' = 323,
538 | 'BIZANDROID' = 336,
539 | 'BIZANDROID_RC' = 337,
540 | 'BIZANDROID_BETA' = 338,
541 | 'BIZANDROID_ALPHA' = 339,
542 | 'BIZBOT' = 352,
543 | 'BIZBOT_RC' = 353,
544 | 'BIZBOT_BETA' = 354,
545 | 'BIZBOT_ALPHA' = 355,
546 | 'CHROMEOS' = 368,
547 | 'CHROMEOS_RC' = 369,
548 | 'CHROMEOS_BETA' = 370,
549 | 'CHROMEOS_ALPHA' = 371,
550 | 'ANDROIDLITE' = 384,
551 | 'ANDROIDLITE_RC' = 385,
552 | 'ANDROIDLITE_BETA' = 386,
553 | 'ANDROIDLITE_ALPHA' = 387,
554 | 'WIN10' = 400,
555 | 'WIN10_RC' = 401,
556 | 'WIN10_BETA' = 402,
557 | 'WIN10_ALPHA' = 403,
558 | 'BIZWEB' = 416,
559 | 'BIZWEB_RC' = 417,
560 | 'BIZWEB_BETA' = 418,
561 | 'BIZWEB_ALPHA' = 419,
562 | 'DUMMYPRIMARY' = 432,
563 | 'DUMMYPRIMARY_RC' = 433,
564 | 'DUMMYPRIMARY_BETA' = 434,
565 | 'DUMMYPRIMARY_ALPHA' = 435,
566 | 'SQUARE' = 448,
567 | 'SQUARE_RC' = 449,
568 | 'SQUARE_BETA' = 450,
569 | 'SQUARE_ALPHA' = 451,
570 | 'INTERNAL' = 464,
571 | 'INTERNAL_RC' = 465,
572 | 'INTERNAL_BETA' = 466,
573 | 'INTERNAL_ALPHA' = 467,
574 | 'CLOVAFRIENDS' = 480,
575 | 'CLOVAFRIENDS_RC' = 481,
576 | 'CLOVAFRIENDS_BETA' = 482,
577 | 'CLOVAFRIENDS_ALPHA' = 483,
578 | 'WATCHOS' = 496,
579 | 'WATCHOS_RC' = 497,
580 | 'WATCHOS_BETA' = 498,
581 | 'WATCHOS_ALPHA' = 499
582 | };
583 | export enum VerificationResult {
584 | 'FAILED' = 0,
585 | 'OK_NOT_REGISTERED_YET' = 1,
586 | 'OK_REGISTERED_WITH_SAME_DEVICE' = 2,
587 | 'OK_REGISTERED_WITH_ANOTHER_DEVICE' = 3
588 | };
589 | export enum AccountMigrationCheckType {
590 | 'SKIP' = 0,
591 | 'PINCODE' = 1,
592 | 'SECURITY_CENTER' = 2
593 | };
594 | export enum ProfileHistoryPrivacyType {
595 | 'OWNER' = 0,
596 | 'FRIEND' = 1
597 | };
598 | export enum StatusMessageHistoryPrivacyType {
599 | 'NONE' = 1,
600 | 'ALL' = 2
601 | };
602 | export enum PrivacyShareMyProfileType {
603 | 'NEVER_SHOW' = 0,
604 | 'ONE_WAY' = 1,
605 | 'MUTUAL' = 2
606 | };
607 | export enum UserAgeType {
608 | 'OVER' = 1,
609 | 'UNDER' = 2,
610 | 'UNDEFINED' = 3
611 | };
612 | export enum SnsIdType {
613 | 'FACEBOOK' = 1,
614 | 'SINA' = 2,
615 | 'RENREN' = 3,
616 | 'FEIXIN' = 4,
617 | 'BBM' = 5,
618 | 'APPLE' = 6
619 | };
620 | export enum EmailConfirmationStatus {
621 | 'NOT_SPECIFIED' = 0,
622 | 'NOT_YET' = 1,
623 | 'DONE' = 3,
624 | 'NEED_ENFORCED_INPUT' = 4
625 | };
626 | export enum AccountMigrationPincodeType {
627 | 'NOT_APPLICABLE' = 0,
628 | 'NOT_SET' = 1,
629 | 'SET' = 2,
630 | 'NEED_ENFORCED_INPUT' = 3
631 | };
632 | export enum SecurityCenterSettingsType {
633 | 'NOT_APPLICABLE' = 0,
634 | 'NOT_SET' = 1,
635 | 'SET' = 2,
636 | 'NEED_ENFORCED_INPUT' = 3
637 | };
638 | export enum CustomMode {
639 | 'PROMOTION_FRIENDS_INVITE' = 1,
640 | 'CAPABILITY_SERVER_SIDE_SMS' = 2,
641 | 'LINE_CLIENT_ANALYTICS_CONFIGURATION' = 3
642 | };
643 | export enum ModificationType {
644 | 'ADD' = 0,
645 | 'REMOVE' = 1,
646 | 'MODIFY' = 2
647 | };
648 | export enum ContactSetting {
649 | 'CONTACT_SETTING_NOTIFICATION_DISABLE' = 1,
650 | 'CONTACT_SETTING_DISPLAY_NAME_OVERRIDE' = 2,
651 | 'CONTACT_SETTING_CONTACT_HIDE' = 4,
652 | 'CONTACT_SETTING_FAVORITE' = 8,
653 | 'CONTACT_SETTING_DELETE' = 16
654 | };
655 | export enum NotificationType {
656 | 'APPLE_APNS' = 1,
657 | 'GOOGLE_C2DM' = 2,
658 | 'NHN_NNI' = 3,
659 | 'SKT_AOM' = 4,
660 | 'MS_MPNS' = 5,
661 | 'RIM_BIS' = 6,
662 | 'GOOGLE_GCM' = 7,
663 | 'NOKIA_NNAPI' = 8,
664 | 'TIZEN' = 9,
665 | 'MOZILLA_SIMPLE' = 10,
666 | 'LINE_BOT' = 17,
667 | 'LINE_WAP' = 18,
668 | 'APPLE_APNS_VOIP' = 19,
669 | 'MS_WNS' = 20,
670 | 'GOOGLE_FCM' = 21,
671 | 'CLOVA' = 22,
672 | 'CLOVA_VOIP' = 23,
673 | 'HUAWEI_HCM' = 24
674 | };
--------------------------------------------------------------------------------
/examples/find_member_in_groups.js:
--------------------------------------------------------------------------------
1 | const { Client } = require("..");
2 | const bot = new Client();
3 |
4 | bot.on('ready',async() => {
5 | console.log(`logged as ${bot.user.displayName} ${bot.user.id}`)
6 |
7 | let group = bot.groups.cache.find(g => g.name.match(/some_awesome_group_name/))
8 | await group.members.fetch()//Fetch All member First
9 |
10 | let member = group.members.cache.find(member => member.user.displayName == "someawesome")//now find member with that name
11 |
12 | await member.user.send('HeW looo ' + member.user.displayName)//Now Dm to that user
13 | member.kick()//Now Kick that Member
14 |
15 | group.invite(member)// Hey Comeback :3
16 |
17 | member.user.block()// Block Him hmmm
18 | })
19 | bot.login()
--------------------------------------------------------------------------------
/examples/login_qr.js:
--------------------------------------------------------------------------------
1 | const { login_qr } = require("node-linejs")
2 | login_qr().then(session_info => {
3 | console.log("your access token: " + session_info.accessToken)
4 | })
--------------------------------------------------------------------------------
/examples/mention_user.js:
--------------------------------------------------------------------------------
1 | const { Client } = require("..");
2 | const bot = new Client();
3 |
4 | bot.on('ready',()=>{
5 | console.log(`logged as ${bot.user.displayName} ${bot.user.id}`)
6 |
7 | //mention with user object
8 | let user = bot.users.cache.get('someuserid')
9 | user.send(`hello ${user}`)
10 |
11 | //mention with user id
12 | user.send(`hello <@userid>`)
13 | })
14 | bot.login()
--------------------------------------------------------------------------------
/examples/moderation/kick_all_members_that_has_blacklist_words.js:
--------------------------------------------------------------------------------
1 | const { Client } = require("../..");
2 | const bot = new Client();
3 |
4 | bot.on('ready',async() => {
5 | console.log(`logged as ${bot.user.displayName} ${bot.user.id}`)
6 |
7 | let group = bot.groups.cache.find(g => g.name.match(/some_awesome_group_name/))
8 | await group.members.fetch()//Fetch All member First
9 |
10 | let members = group.members.cache.filter(member => member.user.displayName.match(someblacklistword))//now find member with that name
11 |
12 | group.kick(members)// Kick Em
13 | })
14 |
15 | bot.login()
--------------------------------------------------------------------------------
/examples/moderation/kick_blacklist_words_group.js:
--------------------------------------------------------------------------------
1 | const { Client } = require("../..");
2 | const bot = new Client();
3 |
4 | bot.on('ready',()=>{
5 | console.log(`logged as ${bot.user.displayName} ${bot.user.id}`)
6 | })
7 |
8 | bot.on('message',async(message)=>{
9 | if(message.author.id == bot.user.id) return;
10 | if(!message.group) return; // return if this message is not in group
11 | if(message.content.match(/blacklisted/)) {
12 | message.member.kick()
13 | }
14 | })
15 |
16 | bot.login()
--------------------------------------------------------------------------------
/examples/simple.js:
--------------------------------------------------------------------------------
1 | const { Client } = require("..");
2 | const bot = new Client();
3 |
4 | bot.on('ready',()=>{
5 | console.log(`logged as ${bot.user.displayName} ${bot.user.id}`)
6 | /*
7 | bot.users.cache.get('someuserid').send('Heww lo Line (⪴╰╯⪳)')
8 | bot.channels.cache.get('somechannelid').send('Heww lo Line (⪴╰╯⪳)')
9 | bot.groups.cache.get('somegroupid').send('Heww lo Line (⪴╰╯⪳)')
10 | */
11 | })
12 | bot.on('message',async(message)=>{
13 | if(message.author.id == bot.user.id) return;
14 | if(message.content == 'ping') {
15 | await message.channel.send('pong')
16 | }
17 | })
18 | bot.on('message_read',(message,user)=>{
19 | console.log(`${user.displayName} READ ${message.id} ${message.content}`)
20 | })
21 | bot.on('chat_invite',(group,inviter)=>{
22 | group.accept()
23 | console.log(`group ${group.name}(${group.id}) invite by ${inviter.displayName}`)
24 | })
25 | bot.on('chat_join',channel=>{
26 | channel.send('Chat Joined')
27 | })
28 | // Raw Data From Fetchops
29 | bot.on('raw',(op,data)=>{
30 | console.log(op,data)
31 | })
32 | bot.login()
--------------------------------------------------------------------------------
/index.d.ts:
--------------------------------------------------------------------------------
1 | import { ChatType, ContactType, MIDType, OpType, ContentType, ServiceCode, AppExtensionType } from "./enum";
2 | import login_qr from "./src/Client/auth/login_qr";
3 | import Thrift_Manager from "./src/Client/thrift/Thrift_Manager";
4 | import Base from "./src/structures/Base";
5 | import BaseCollection from '@discordjs/collection';
6 | export type ClientOptions = {
7 | keepalive: Number,
8 | debug: Boolean
9 | };
10 | export class Client extends EventEmitter {
11 | constructor (options: ClientOptions): this
12 | token: String
13 |
14 | user: Client_User
15 |
16 | users: UserManager
17 | groups: GroupChannelManager
18 | channels: ChannelManager
19 |
20 | transport: Thrift_Manager
21 | api: Record Promise> = {};
22 | /**
23 | * @example
24 | * // Login With Qrcode
25 | * client.login();
26 | *
27 | * // Login With AccessToken
28 | * client.login('token');
29 | */
30 | login(token: ?String): this
31 | /**
32 | * Destroy This Client
33 | */
34 | destroy(): this
35 | /**
36 | * When Client Has Ready
37 | */
38 | on(event: "ready", listener: () => any): this;
39 |
40 | once(event: "ready", listener: () => any): this;
41 | /**
42 | * When Send/Receive Message
43 | */
44 | on(event: "message", listener: (message: Message) => any): this;
45 |
46 | once(event: "message", listener: (message: Message) => any): this;
47 | /**
48 | * When Someone Invite Client
49 | */
50 | on(event: "chat_invite", listener: (group: GroupChannel,inviter: User) => any): this;
51 |
52 | once(event: "chat_invite", listener: (group: GroupChannel,inviter: User) => any): this;
53 | /**
54 | * When Someone Accept Invite
55 | */
56 | on(event: "chat_invite_accept", listener: (group: GroupChannel,user: User) => any): this;
57 |
58 | once(event: "chat_invite_accept", listener: (group: GroupChannel,user: User) => any): this;
59 | /**
60 | * When Someone Reject Invite
61 | */
62 | on(event: "chat_invite_reject", listener: (group: GroupChannel,user: User) => any): this;
63 |
64 | once(event: "chat_invite_reject", listener: (group: GroupChannel,user: User) => any): this;
65 | /**
66 | * When Someone Cancel Invite Client
67 | */
68 | on(event: "chat_invite_cancel", listener: (group: GroupChannel) => any): this;
69 |
70 | once(event: "chat_invite_cancel", listener: (group: GroupChannel) => any): this;
71 | /**
72 | * When Some One Delete other member from group
73 | */
74 | on(event: "chat_member_remove", listener: (member: GroupMember,deleter: GroupMember) => any): this;
75 |
76 | once(event: "chat_member_remove", listener: (member: GroupMember,deleter: GroupMember) => any): this;
77 |
78 | /**
79 | * When Client Join Chat
80 | */
81 | on(event: "chat_join", listener: (channel: GroupChannel) => any): this;
82 |
83 | once(event: "chat_join", listener: (channel: GroupChannel) => any): this;
84 | /**
85 | * When Client Leave Chat
86 | */
87 | on(event: "chat_leave", listener: (channel: GroupChannel) => any): this;
88 |
89 | once(event: "chat_leave", listener: (channel: GroupChannel) => any): this;
90 | /**
91 | * When Message Unsend
92 | */
93 | on(event: "message_unsend", listener: (message: Message) => any): this;
94 |
95 | once(event: "message_unsend", listener: (message: Message) => any): this;
96 | /**
97 | * When Message Read By Some User
98 | */
99 | on(event: "message_read", listener: (message: Message,user: User) => any): this;
100 |
101 | once(event: "message_read", listener: (message: Message,user: User) => any): this;
102 | /**
103 | * When Message Read By Some User
104 | */
105 | on(event: "UserUpdate", listener: (oldUser: User,newUser: User) => any): this;
106 |
107 | once(event: "UserUpdate", listener: (oldUser: User,newUser: User) => any): this;
108 | /**
109 | * Raw Message From Line FetchOps
110 | */
111 | on(event: "call_receive", listener: (channel: TextChannel) => any): this;
112 |
113 | once(event: "call_receive", listener: (channel: TextChannel) => any): this;
114 | /**
115 | * Raw Message From Line FetchOps
116 | */
117 | on(event: "raw", listener: (op: keyof typeof OpType,data: any) => any): this;
118 |
119 | once(event: "raw", listener: (op: keyof typeof OpType,data: any) => any): this;
120 | }
121 |
122 | export class Base_User extends Base {
123 | public channel: TextBaseChannel;
124 |
125 | public id: String;
126 | public createdTime: Date;
127 | public displayName: ?String;
128 | public phoneticName: ?String;
129 | public pictureStatus: ?String;
130 | public picturePath: ?String;
131 | public musicProfile: ?String;
132 | public videoProfile: ?String;
133 | public avatarProfile: ?any;
134 | public statusMessageContentMetadata: ?Object.;
135 | }
136 | export class User extends Base_User {
137 | public type: keyof typeof ContactType;
138 | public relation: Object;
139 | public pictureStatus: Object;
140 | public thumbnailUrl: ?String;
141 | public statusMessage: ?String;
142 | public displayNameOverridden: Object;
143 | public capableVoiceCall: Boolean;
144 | public capableVideoCall: Boolean;
145 | public capableMyhome: Boolean;
146 | public capableBuddy: Boolean;
147 | public attributes: any;
148 | public settings: any;
149 | public recommendParams: String;
150 | public friendRequestStatus: String;
151 | public phone: ?String;
152 |
153 | /**
154 | * Get Avatar Url of the user
155 | */
156 | public avatarURL(): String
157 |
158 | /**
159 | * Send Message to this user
160 | * @param {String} text
161 | * @param {?Object} options
162 | */
163 | public send(text, options={}): Promise
164 | public unblock(): Promise;
165 | public block(): Promise;
166 | }
167 | export type UserResolvable = User | GroupMember | Base_User | Client_User | String;
168 | export type TextChannel = GroupChannel | TextBaseChannel
169 | export class Client_User extends User {
170 | public phone: ?String;
171 | public email: ?String;
172 | public regionCode: ?String;
173 |
174 | /**
175 | * Destroy Client token
176 | * @param {String} text
177 | * @param {?Object} options
178 | */
179 | public logout(): Promise;
180 | }
181 | export class GroupMember extends Base {
182 | public readonly user: User;
183 | public readonly joined_date: Date;
184 | public readonly group: GroupChannel;
185 |
186 | public id: String;
187 | public groupID: ?String;
188 | public timestamp: ?Number;
189 |
190 | /**
191 | * fetch This Member
192 | */
193 | public fetch(): Promise;
194 | /**
195 | * Kick This User
196 | * @example
197 | * member.kick();
198 | */
199 | public kick(): Promise;
200 | }
201 |
202 | export class Channel extends Base {
203 | public id: String;
204 | public notificationDisabled: Boolean;
205 | public type: keyof typeof ChatType;
206 | public extra: Extra;
207 | }
208 |
209 | export class TextBaseChannel extends Channel {
210 | public messages: MessageMananger;
211 | public createdTime: Date;
212 | public favoriteTimestamp: Date;
213 | public name: String;
214 | public picturePath: ?String;
215 | public extra: ?Any;
216 |
217 | /**
218 | * Send Message to this Channel
219 | * @param {String} text
220 | * @param {?Object} options
221 | * @example
222 | * // send normal message
223 | * channel.send('Hello World')
224 | *
225 | * // send message and unsend
226 | * let msg = await channel.send('delete me')
227 | * msg.unsend()
228 | */
229 | public send(text, options={}): Promise
230 | }
231 | export class GroupChannel extends TextBaseChannel {
232 | public readonly owner: GroupMember
233 | public readonly joined_date: Date
234 | public readonly members: GroupMemberManager
235 | public readonly invites: GroupMemberManager
236 | public readonly joined: Boolean
237 | public readonly me: GroupMember;
238 |
239 | public picturePath: String;
240 | public extra: {
241 | groupExtra: {
242 | memberMids: String[]
243 | }
244 | };
245 |
246 | /**
247 | * Get Icon Url of the group
248 | */
249 | public iconURL(): String
250 |
251 | public fetch(): Promise;
252 | public leave(): Promise;
253 | /**
254 | * Invite User To join this Group Channel
255 | * @example
256 | * // invite with user id
257 | * group.invite('userid')
258 | *
259 | * // invite with array of user object
260 | * let user = client.users.cache.get('userid')
261 | * group.invite([user,message.author,user3])
262 | *
263 | * // invite with array of mix user object and user id
264 | * let user = client.users.cache.get('userid')
265 | * group.invite(['userid',user,user2,user3])
266 | */
267 | public invite(users: UserResolvable[] | String): Promise;
268 | /**
269 | * Kick User Out of this Group Channel
270 | * @example
271 | * // kick with user id
272 | * group.kick('userid')
273 | *
274 | * // kick with array of user object
275 | * let user = client.users.cache.get('userid')
276 | * group.kick([user,message.author,user3])
277 | *
278 | * // kick with array of mix user object and user id
279 | * let user = client.users.cache.get('userid')
280 | * group.kick(['userid',user,user2,user3])
281 | */
282 | public kick(users: UserResolvable[] | String): Promise;
283 |
284 | /**
285 | * Accept This Group Invite If not Joined
286 | */
287 | public accept(): Promise;
288 |
289 | /**
290 | * Reject This Group Invite If not Joined
291 | */
292 | public reject(): Promise;
293 | }
294 | export class Message extends Base {
295 | public deleted: Boolean;
296 | public readonly author: User;
297 | public readonly channel: TextBaseChannel;
298 | public readonly group: ?GroupChannel;
299 | public readonly member: ?GroupMember;
300 | public readonly content: String;
301 |
302 | public id: String;
303 | public text: String;
304 | public toType: keyof typeof MIDType;
305 | public deliveredTime: Date;
306 | public location: Location;
307 | public hasContent: Boolean;
308 | public contentType: keyof typeof ContentType;
309 | public contentMetadata: ?Object.;
310 | public contentPreview: String;
311 | public sessionId: Number;
312 | public chunks: ?String[];
313 | public relatedMessageId: String;
314 | public messageRelationType: ?String[];
315 | public readCount: Number;
316 | public relatedMessageServiceCode: keyof typeof ServiceCode;
317 | public appExtensionType: keyof typeof AppExtensionType;
318 | public _from: String;
319 | public deleted: Boolean;
320 |
321 | /**
322 | * Unsend Message from channel
323 | * @example
324 | * message.unsend()
325 | */
326 | public unsend(): Promise;
327 | }
328 |
329 | export type ChannelResolvable = Channel | String;
330 |
331 | export abstract class BaseManager {
332 | public constructor(client: Client);
333 | public readonly client: Client;
334 | }
335 |
336 | export type GroupResolvable = GroupChannel | GroupMember | String;
337 |
338 | export abstract class DataManager extends BaseManager {
339 | public constructor(client: Client, holds: Constructable);
340 | public readonly holds: Constructable;
341 | public readonly cache: BaseCollection;
342 | public resolve(resolvable: Holds): Holds;
343 | public resolve(resolvable: R): Holds | null;
344 | public resolveId(resolvable: Holds): K;
345 | public resolveId(resolvable: R): K | null;
346 | public valueOf(): BaseCollection;
347 | }
348 |
349 | export abstract class CachedManager extends DataManager {
350 | public constructor(client: Client, holds: Constructable);
351 | private _add(data: unknown, cache?: boolean, { id, extras }?: { id: K; extras: unknown[] }): Holds;
352 | }
353 |
354 | export class ChannelManager extends CachedManager {
355 | public constructor(client: Client, iterable: Iterable);
356 | public fetch(id: String, options?: {}): Promise;
357 | }
358 |
359 | export class UserManager extends CachedManager {
360 | public constructor(client: Client, iterable: Iterable);
361 | /**
362 | * Fetch Users
363 | * @example
364 | * //fetch all know user in cache
365 | * let users = await client.users.fetch()
366 | *
367 | * //find member That Match Name(Chelos)
368 | * let user = await users.find(u=>u.user.displayName.match(/Chelos/))
369 | * //Send DM to That User
370 | * user.send("Hello Chelos")
371 | */
372 | public fetch(id: UserResolvable[] | String, options?: {}): Promise;
373 | }
374 | export class GroupChannelManager extends CachedManager {
375 | public constructor(client: Client, iterable: Iterable);
376 | /**
377 | * Create New Groups
378 | * @example
379 | * client.groups.create('new group',{
380 | * targetUserMids: [member,'userid','userid2']
381 | * })
382 | */
383 | public create(name: String, options?: {
384 | picturePath: ?String,
385 | targetUserMids: [UserResolvable]
386 | }): Promise;
387 | public fetch(id: String, options?: {}): Promise;
388 | }
389 | export class MessageMananger extends CachedManager {
390 | public constructor(client: Client, iterable: Iterable);
391 | }
392 | export class GroupMemberManager extends CachedManager {
393 | public constructor(client: Client, iterable: Iterable);
394 |
395 | /**
396 | * Fetch members in Groups
397 | * @example
398 | * let members = await group.members.fetch()
399 | *
400 | * //find member That Match Name(Chelos)
401 | * let member = await members.find(member=>member.user.displayName.match(/Chelos/))
402 | * //Send DM to That User
403 | * member.user.send("Hello Chelos")
404 | */
405 | public fetch(id: UserResolvable[] | String, options?: {}): Promise;
406 | }
407 | export { login_qr }
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | login_qr: require("./src/Client/auth/login_qr"),
3 |
4 | Client: require("./src/Client/Client"),
5 | User: require("./src/structures/User/User"),
6 | Group_Member: require("./src/structures/User/Group_Member"),
7 | Channel: require("./src/structures/Channel/Channel"),
8 | Message: require("./src/structures/Message/Message")
9 | }
--------------------------------------------------------------------------------
/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "node-linejs",
3 | "version": "1.0.9",
4 | "lockfileVersion": 1,
5 | "requires": true,
6 | "dependencies": {
7 | "@discordjs/collection": {
8 | "version": "0.1.6",
9 | "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz",
10 | "integrity": "sha512-utRNxnd9kSS2qhyivo9lMlt5qgAUasH2gb7BEOn6p0efFh24gjGomHzWKMAPn2hEReOPQZCJaRKoURwRotKucQ=="
11 | },
12 | "ansi-regex": {
13 | "version": "4.1.0",
14 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
15 | "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg=="
16 | },
17 | "ansi-styles": {
18 | "version": "3.2.1",
19 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
20 | "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
21 | "requires": {
22 | "color-convert": "^1.9.0"
23 | }
24 | },
25 | "async-limiter": {
26 | "version": "1.0.1",
27 | "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
28 | "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ=="
29 | },
30 | "base64-js": {
31 | "version": "1.5.1",
32 | "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
33 | "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
34 | },
35 | "browser-or-node": {
36 | "version": "1.3.0",
37 | "resolved": "https://registry.npmjs.org/browser-or-node/-/browser-or-node-1.3.0.tgz",
38 | "integrity": "sha512-0F2z/VSnLbmEeBcUrSuDH5l0HxTXdQQzLjkmBR4cYfvg1zJrKSlmIZFqyFR8oX0NrwPhy3c3HQ6i3OxMbew4Tg=="
39 | },
40 | "buffer": {
41 | "version": "5.7.1",
42 | "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
43 | "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
44 | "requires": {
45 | "base64-js": "^1.3.1",
46 | "ieee754": "^1.1.13"
47 | }
48 | },
49 | "buffer-alloc": {
50 | "version": "1.2.0",
51 | "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz",
52 | "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==",
53 | "requires": {
54 | "buffer-alloc-unsafe": "^1.1.0",
55 | "buffer-fill": "^1.0.0"
56 | }
57 | },
58 | "buffer-alloc-unsafe": {
59 | "version": "1.1.0",
60 | "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz",
61 | "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg=="
62 | },
63 | "buffer-fill": {
64 | "version": "1.0.0",
65 | "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz",
66 | "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw="
67 | },
68 | "buffer-from": {
69 | "version": "1.1.1",
70 | "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
71 | "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A=="
72 | },
73 | "camelcase": {
74 | "version": "5.3.1",
75 | "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
76 | "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
77 | },
78 | "cliui": {
79 | "version": "5.0.0",
80 | "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
81 | "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
82 | "requires": {
83 | "string-width": "^3.1.0",
84 | "strip-ansi": "^5.2.0",
85 | "wrap-ansi": "^5.1.0"
86 | }
87 | },
88 | "color-convert": {
89 | "version": "1.9.3",
90 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
91 | "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
92 | "requires": {
93 | "color-name": "1.1.3"
94 | }
95 | },
96 | "color-name": {
97 | "version": "1.1.3",
98 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
99 | "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
100 | },
101 | "curve25519-js": {
102 | "version": "0.0.4",
103 | "resolved": "https://registry.npmjs.org/curve25519-js/-/curve25519-js-0.0.4.tgz",
104 | "integrity": "sha512-axn2UMEnkhyDUPWOwVKBMVIzSQy2ejH2xRGy1wq81dqRwApXfIzfbE3hIX0ZRFBIihf/KDqK158DLwESu4AK1w=="
105 | },
106 | "decamelize": {
107 | "version": "1.2.0",
108 | "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
109 | "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
110 | },
111 | "dijkstrajs": {
112 | "version": "1.0.2",
113 | "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.2.tgz",
114 | "integrity": "sha512-QV6PMaHTCNmKSeP6QoXhVTw9snc9VD8MulTT0Bd99Pacp4SS1cjcrYPgBPmibqKVtMJJfqC6XvOXgPMEEPH/fg=="
115 | },
116 | "emoji-regex": {
117 | "version": "7.0.3",
118 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
119 | "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA=="
120 | },
121 | "find-up": {
122 | "version": "3.0.0",
123 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
124 | "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
125 | "requires": {
126 | "locate-path": "^3.0.0"
127 | }
128 | },
129 | "get-caller-file": {
130 | "version": "2.0.5",
131 | "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
132 | "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="
133 | },
134 | "ieee754": {
135 | "version": "1.2.1",
136 | "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
137 | "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
138 | },
139 | "is-fullwidth-code-point": {
140 | "version": "2.0.0",
141 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
142 | "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8="
143 | },
144 | "isarray": {
145 | "version": "2.0.5",
146 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
147 | "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw=="
148 | },
149 | "isomorphic-ws": {
150 | "version": "4.0.1",
151 | "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz",
152 | "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w=="
153 | },
154 | "locate-path": {
155 | "version": "3.0.0",
156 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
157 | "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
158 | "requires": {
159 | "p-locate": "^3.0.0",
160 | "path-exists": "^3.0.0"
161 | }
162 | },
163 | "nanoid": {
164 | "version": "3.1.23",
165 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.23.tgz",
166 | "integrity": "sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw=="
167 | },
168 | "node-fetch": {
169 | "version": "2.6.1",
170 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
171 | "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
172 | },
173 | "node-int64": {
174 | "version": "0.4.0",
175 | "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz",
176 | "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs="
177 | },
178 | "p-limit": {
179 | "version": "2.3.0",
180 | "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
181 | "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
182 | "requires": {
183 | "p-try": "^2.0.0"
184 | }
185 | },
186 | "p-locate": {
187 | "version": "3.0.0",
188 | "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
189 | "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
190 | "requires": {
191 | "p-limit": "^2.0.0"
192 | }
193 | },
194 | "p-try": {
195 | "version": "2.2.0",
196 | "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
197 | "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="
198 | },
199 | "path-exists": {
200 | "version": "3.0.0",
201 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
202 | "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU="
203 | },
204 | "pngjs": {
205 | "version": "3.4.0",
206 | "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz",
207 | "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w=="
208 | },
209 | "q": {
210 | "version": "1.5.1",
211 | "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz",
212 | "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc="
213 | },
214 | "qrcode": {
215 | "version": "1.4.4",
216 | "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.4.4.tgz",
217 | "integrity": "sha512-oLzEC5+NKFou9P0bMj5+v6Z40evexeE29Z9cummZXZ9QXyMr3lphkURzxjXgPJC5azpxcshoDWV1xE46z+/c3Q==",
218 | "requires": {
219 | "buffer": "^5.4.3",
220 | "buffer-alloc": "^1.2.0",
221 | "buffer-from": "^1.1.1",
222 | "dijkstrajs": "^1.0.1",
223 | "isarray": "^2.0.1",
224 | "pngjs": "^3.3.0",
225 | "yargs": "^13.2.4"
226 | }
227 | },
228 | "require-directory": {
229 | "version": "2.1.1",
230 | "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
231 | "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I="
232 | },
233 | "require-main-filename": {
234 | "version": "2.0.0",
235 | "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
236 | "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg=="
237 | },
238 | "set-blocking": {
239 | "version": "2.0.0",
240 | "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
241 | "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
242 | },
243 | "string-width": {
244 | "version": "3.1.0",
245 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
246 | "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
247 | "requires": {
248 | "emoji-regex": "^7.0.1",
249 | "is-fullwidth-code-point": "^2.0.0",
250 | "strip-ansi": "^5.1.0"
251 | }
252 | },
253 | "strip-ansi": {
254 | "version": "5.2.0",
255 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
256 | "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
257 | "requires": {
258 | "ansi-regex": "^4.1.0"
259 | }
260 | },
261 | "thrift": {
262 | "version": "0.14.2",
263 | "resolved": "https://registry.npmjs.org/thrift/-/thrift-0.14.2.tgz",
264 | "integrity": "sha512-bW8EaE6iw3hSt4HB2HpBdHW86Xpb9IUJfqufx4NwEu7OGuIpS0ISj+Yy1Z1Wvhfno6SPNhKRJ1qFXea84HcrOQ==",
265 | "requires": {
266 | "browser-or-node": "^1.2.1",
267 | "isomorphic-ws": "^4.0.1",
268 | "node-int64": "^0.4.0",
269 | "q": "^1.5.0",
270 | "ws": "^5.2.2"
271 | },
272 | "dependencies": {
273 | "ws": {
274 | "version": "5.2.3",
275 | "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.3.tgz",
276 | "integrity": "sha512-jZArVERrMsKUatIdnLzqvcfydI85dvd/Fp1u/VOpfdDWQ4c9qWXe+VIeAbQ5FrDwciAkr+lzofXLz3Kuf26AOA==",
277 | "requires": {
278 | "async-limiter": "~1.0.0"
279 | }
280 | }
281 | }
282 | },
283 | "typescript": {
284 | "version": "4.3.5",
285 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz",
286 | "integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==",
287 | "dev": true
288 | },
289 | "which-module": {
290 | "version": "2.0.0",
291 | "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
292 | "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho="
293 | },
294 | "wrap-ansi": {
295 | "version": "5.1.0",
296 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
297 | "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
298 | "requires": {
299 | "ansi-styles": "^3.2.0",
300 | "string-width": "^3.0.0",
301 | "strip-ansi": "^5.0.0"
302 | }
303 | },
304 | "ws": {
305 | "version": "7.5.3",
306 | "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.3.tgz",
307 | "integrity": "sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg=="
308 | },
309 | "y18n": {
310 | "version": "4.0.3",
311 | "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz",
312 | "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ=="
313 | },
314 | "yargs": {
315 | "version": "13.3.2",
316 | "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz",
317 | "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==",
318 | "requires": {
319 | "cliui": "^5.0.0",
320 | "find-up": "^3.0.0",
321 | "get-caller-file": "^2.0.1",
322 | "require-directory": "^2.1.1",
323 | "require-main-filename": "^2.0.0",
324 | "set-blocking": "^2.0.0",
325 | "string-width": "^3.0.0",
326 | "which-module": "^2.0.0",
327 | "y18n": "^4.0.0",
328 | "yargs-parser": "^13.1.2"
329 | }
330 | },
331 | "yargs-parser": {
332 | "version": "13.1.2",
333 | "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
334 | "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
335 | "requires": {
336 | "camelcase": "^5.0.0",
337 | "decamelize": "^1.2.0"
338 | }
339 | }
340 | }
341 | }
342 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "node-linejs",
3 | "version": "1.0.10",
4 | "description": "LINE's selfbot libraries written in NodeJS.",
5 | "main": "index.js",
6 | "dependencies": {
7 | "@discordjs/collection": "^0.1.6",
8 | "curve25519-js": "0.0.4",
9 | "nanoid": "^3.1.23",
10 | "node-fetch": "^2.6.1",
11 | "qrcode": "^1.4.4",
12 | "thrift": "^0.14.2",
13 | "ws": "^7.5.3"
14 | },
15 | "devDependencies": {
16 | "typescript": "^4.3.5"
17 | },
18 | "scripts": {
19 | "test": "echo \"Error: no test specified\""
20 | },
21 | "author": "Chelos",
22 | "license": "CC-BY-NC-3.0",
23 | "directories": {
24 | "example": "examples"
25 | },
26 | "repository": {
27 | "type": "git",
28 | "url": "git+https://github.com/chanios/node-linejs.git"
29 | },
30 | "keywords": [
31 | "line",
32 | "linejs",
33 | "linesdk",
34 | "botsdk"
35 | ],
36 | "bugs": {
37 | "url": "https://github.com/chanios/node-linejs/issues"
38 | },
39 | "homepage": "https://github.com/chanios/node-linejs#readme"
40 | }
41 |
--------------------------------------------------------------------------------
/src/CONSENT/gen-nodejs/AuthService_types.js:
--------------------------------------------------------------------------------
1 | //
2 | // Autogenerated by Thrift Compiler (0.14.1)
3 | //
4 | // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 | //
6 | "use strict";
7 |
8 | var thrift = require('thrift');
9 | var Thrift = thrift.Thrift;
10 | var Q = thrift.Q;
11 | var Int64 = require('node-int64');
12 |
13 | var TalkService_ttypes = require('./TalkService_types');
14 |
15 |
16 | var ttypes = module.exports = {};
17 | ttypes.LoginResultType = {
18 | 'SUCCESS' : 1,
19 | 'REQUIRE_QRCODE' : 2,
20 | 'REQUIRE_DEVICE_CONFIRM' : 3,
21 | 'REQUIRE_SMS_CONFIRM' : 4
22 | };
23 | ttypes.LoginType = {
24 | 'ID_CREDENTIAL' : 0,
25 | 'QRCODE' : 1,
26 | 'ID_CREDENTIAL_WITH_E2EE' : 2
27 | };
28 | ttypes.IdentityCredentialResponseType = {
29 | 'UNKNOWN' : 0,
30 | 'SUCCESS' : 1,
31 | 'REQUIRE_SERVER_SIDE_EMAIL' : 2,
32 | 'REQUIRE_CLIENT_SIDE_EMAIL' : 3
33 | };
34 | ttypes.EncryptionKeyVersion = {
35 | 'UNKNOWN' : 0,
36 | 'V1' : 1
37 | };
38 | var TokenIssueResult = module.exports.TokenIssueResult = function(args) {
39 | this.accessToken = null;
40 | this.refreshToken = null;
41 | this.appId = null;
42 | if (args) {
43 | if (args.accessToken !== undefined && args.accessToken !== null) {
44 | this.accessToken = args.accessToken;
45 | }
46 | if (args.refreshToken !== undefined && args.refreshToken !== null) {
47 | this.refreshToken = args.refreshToken;
48 | }
49 | if (args.appId !== undefined && args.appId !== null) {
50 | this.appId = args.appId;
51 | }
52 | }
53 | };
54 | TokenIssueResult.prototype = {};
55 | TokenIssueResult.prototype.read = function(input) {
56 | input.readStructBegin();
57 | while (true) {
58 | var ret = input.readFieldBegin();
59 | var ftype = ret.ftype;
60 | var fid = ret.fid;
61 | if (ftype == Thrift.Type.STOP) {
62 | break;
63 | }
64 | switch (fid) {
65 | case 1:
66 | if (ftype == Thrift.Type.STRING) {
67 | this.accessToken = input.readString();
68 | } else {
69 | input.skip(ftype);
70 | }
71 | break;
72 | case 2:
73 | if (ftype == Thrift.Type.STRING) {
74 | this.refreshToken = input.readString();
75 | } else {
76 | input.skip(ftype);
77 | }
78 | break;
79 | case 3:
80 | if (ftype == Thrift.Type.STRING) {
81 | this.appId = input.readString();
82 | } else {
83 | input.skip(ftype);
84 | }
85 | break;
86 | default:
87 | input.skip(ftype);
88 | }
89 | input.readFieldEnd();
90 | }
91 | input.readStructEnd();
92 | return;
93 | };
94 |
95 | TokenIssueResult.prototype.write = function(output) {
96 | output.writeStructBegin('TokenIssueResult');
97 | if (this.accessToken !== null && this.accessToken !== undefined) {
98 | output.writeFieldBegin('accessToken', Thrift.Type.STRING, 1);
99 | output.writeString(this.accessToken);
100 | output.writeFieldEnd();
101 | }
102 | if (this.refreshToken !== null && this.refreshToken !== undefined) {
103 | output.writeFieldBegin('refreshToken', Thrift.Type.STRING, 2);
104 | output.writeString(this.refreshToken);
105 | output.writeFieldEnd();
106 | }
107 | if (this.appId !== null && this.appId !== undefined) {
108 | output.writeFieldBegin('appId', Thrift.Type.STRING, 3);
109 | output.writeString(this.appId);
110 | output.writeFieldEnd();
111 | }
112 | output.writeFieldStop();
113 | output.writeStructEnd();
114 | return;
115 | };
116 |
117 | var LoginResult = module.exports.LoginResult = function(args) {
118 | this.authToken = null;
119 | this.certificate = null;
120 | this.verifier = null;
121 | this.pinCode = null;
122 | this.type = null;
123 | this.lastPrimaryBindTime = null;
124 | this.displayMessage = null;
125 | this.sessionForSMSConfirm = null;
126 | this.tokenIssueResult = null;
127 | if (args) {
128 | if (args.authToken !== undefined && args.authToken !== null) {
129 | this.authToken = args.authToken;
130 | }
131 | if (args.certificate !== undefined && args.certificate !== null) {
132 | this.certificate = args.certificate;
133 | }
134 | if (args.verifier !== undefined && args.verifier !== null) {
135 | this.verifier = args.verifier;
136 | }
137 | if (args.pinCode !== undefined && args.pinCode !== null) {
138 | this.pinCode = args.pinCode;
139 | }
140 | if (args.type !== undefined && args.type !== null) {
141 | this.type = args.type;
142 | }
143 | if (args.lastPrimaryBindTime !== undefined && args.lastPrimaryBindTime !== null) {
144 | this.lastPrimaryBindTime = args.lastPrimaryBindTime;
145 | }
146 | if (args.displayMessage !== undefined && args.displayMessage !== null) {
147 | this.displayMessage = args.displayMessage;
148 | }
149 | if (args.sessionForSMSConfirm !== undefined && args.sessionForSMSConfirm !== null) {
150 | this.sessionForSMSConfirm = new TalkService_ttypes.VerificationSessionData(args.sessionForSMSConfirm);
151 | }
152 | if (args.tokenIssueResult !== undefined && args.tokenIssueResult !== null) {
153 | this.tokenIssueResult = new ttypes.TokenIssueResult(args.tokenIssueResult);
154 | }
155 | }
156 | };
157 | LoginResult.prototype = {};
158 | LoginResult.prototype.read = function(input) {
159 | input.readStructBegin();
160 | while (true) {
161 | var ret = input.readFieldBegin();
162 | var ftype = ret.ftype;
163 | var fid = ret.fid;
164 | if (ftype == Thrift.Type.STOP) {
165 | break;
166 | }
167 | switch (fid) {
168 | case 1:
169 | if (ftype == Thrift.Type.STRING) {
170 | this.authToken = input.readString();
171 | } else {
172 | input.skip(ftype);
173 | }
174 | break;
175 | case 2:
176 | if (ftype == Thrift.Type.STRING) {
177 | this.certificate = input.readString();
178 | } else {
179 | input.skip(ftype);
180 | }
181 | break;
182 | case 3:
183 | if (ftype == Thrift.Type.STRING) {
184 | this.verifier = input.readString();
185 | } else {
186 | input.skip(ftype);
187 | }
188 | break;
189 | case 4:
190 | if (ftype == Thrift.Type.STRING) {
191 | this.pinCode = input.readString();
192 | } else {
193 | input.skip(ftype);
194 | }
195 | break;
196 | case 5:
197 | if (ftype == Thrift.Type.I32) {
198 | this.type = input.readI32();
199 | } else {
200 | input.skip(ftype);
201 | }
202 | break;
203 | case 6:
204 | if (ftype == Thrift.Type.I64) {
205 | this.lastPrimaryBindTime = input.readI64();
206 | } else {
207 | input.skip(ftype);
208 | }
209 | break;
210 | case 7:
211 | if (ftype == Thrift.Type.STRING) {
212 | this.displayMessage = input.readString();
213 | } else {
214 | input.skip(ftype);
215 | }
216 | break;
217 | case 8:
218 | if (ftype == Thrift.Type.STRUCT) {
219 | this.sessionForSMSConfirm = new TalkService_ttypes.VerificationSessionData();
220 | this.sessionForSMSConfirm.read(input);
221 | } else {
222 | input.skip(ftype);
223 | }
224 | break;
225 | case 9:
226 | if (ftype == Thrift.Type.STRUCT) {
227 | this.tokenIssueResult = new ttypes.TokenIssueResult();
228 | this.tokenIssueResult.read(input);
229 | } else {
230 | input.skip(ftype);
231 | }
232 | break;
233 | default:
234 | input.skip(ftype);
235 | }
236 | input.readFieldEnd();
237 | }
238 | input.readStructEnd();
239 | return;
240 | };
241 |
242 | LoginResult.prototype.write = function(output) {
243 | output.writeStructBegin('LoginResult');
244 | if (this.authToken !== null && this.authToken !== undefined) {
245 | output.writeFieldBegin('authToken', Thrift.Type.STRING, 1);
246 | output.writeString(this.authToken);
247 | output.writeFieldEnd();
248 | }
249 | if (this.certificate !== null && this.certificate !== undefined) {
250 | output.writeFieldBegin('certificate', Thrift.Type.STRING, 2);
251 | output.writeString(this.certificate);
252 | output.writeFieldEnd();
253 | }
254 | if (this.verifier !== null && this.verifier !== undefined) {
255 | output.writeFieldBegin('verifier', Thrift.Type.STRING, 3);
256 | output.writeString(this.verifier);
257 | output.writeFieldEnd();
258 | }
259 | if (this.pinCode !== null && this.pinCode !== undefined) {
260 | output.writeFieldBegin('pinCode', Thrift.Type.STRING, 4);
261 | output.writeString(this.pinCode);
262 | output.writeFieldEnd();
263 | }
264 | if (this.type !== null && this.type !== undefined) {
265 | output.writeFieldBegin('type', Thrift.Type.I32, 5);
266 | output.writeI32(this.type);
267 | output.writeFieldEnd();
268 | }
269 | if (this.lastPrimaryBindTime !== null && this.lastPrimaryBindTime !== undefined) {
270 | output.writeFieldBegin('lastPrimaryBindTime', Thrift.Type.I64, 6);
271 | output.writeI64(this.lastPrimaryBindTime);
272 | output.writeFieldEnd();
273 | }
274 | if (this.displayMessage !== null && this.displayMessage !== undefined) {
275 | output.writeFieldBegin('displayMessage', Thrift.Type.STRING, 7);
276 | output.writeString(this.displayMessage);
277 | output.writeFieldEnd();
278 | }
279 | if (this.sessionForSMSConfirm !== null && this.sessionForSMSConfirm !== undefined) {
280 | output.writeFieldBegin('sessionForSMSConfirm', Thrift.Type.STRUCT, 8);
281 | this.sessionForSMSConfirm.write(output);
282 | output.writeFieldEnd();
283 | }
284 | if (this.tokenIssueResult !== null && this.tokenIssueResult !== undefined) {
285 | output.writeFieldBegin('tokenIssueResult', Thrift.Type.STRUCT, 9);
286 | this.tokenIssueResult.write(output);
287 | output.writeFieldEnd();
288 | }
289 | output.writeFieldStop();
290 | output.writeStructEnd();
291 | return;
292 | };
293 |
294 | var LoginRequest = module.exports.LoginRequest = function(args) {
295 | this.e2eeVersion = null;
296 | this.type = null;
297 | this.identityProvider = null;
298 | this.identifier = null;
299 | this.password = null;
300 | this.keepLoggedIn = null;
301 | this.accessLocation = null;
302 | this.systemName = null;
303 | this.certificate = null;
304 | this.verifier = null;
305 | this.secret = null;
306 | if (args) {
307 | if (args.e2eeVersion !== undefined && args.e2eeVersion !== null) {
308 | this.e2eeVersion = args.e2eeVersion;
309 | }
310 | if (args.type !== undefined && args.type !== null) {
311 | this.type = args.type;
312 | }
313 | if (args.identityProvider !== undefined && args.identityProvider !== null) {
314 | this.identityProvider = args.identityProvider;
315 | }
316 | if (args.identifier !== undefined && args.identifier !== null) {
317 | this.identifier = args.identifier;
318 | }
319 | if (args.password !== undefined && args.password !== null) {
320 | this.password = args.password;
321 | }
322 | if (args.keepLoggedIn !== undefined && args.keepLoggedIn !== null) {
323 | this.keepLoggedIn = args.keepLoggedIn;
324 | }
325 | if (args.accessLocation !== undefined && args.accessLocation !== null) {
326 | this.accessLocation = args.accessLocation;
327 | }
328 | if (args.systemName !== undefined && args.systemName !== null) {
329 | this.systemName = args.systemName;
330 | }
331 | if (args.certificate !== undefined && args.certificate !== null) {
332 | this.certificate = args.certificate;
333 | }
334 | if (args.verifier !== undefined && args.verifier !== null) {
335 | this.verifier = args.verifier;
336 | }
337 | if (args.secret !== undefined && args.secret !== null) {
338 | this.secret = args.secret;
339 | }
340 | }
341 | };
342 | LoginRequest.prototype = {};
343 | LoginRequest.prototype.read = function(input) {
344 | input.readStructBegin();
345 | while (true) {
346 | var ret = input.readFieldBegin();
347 | var ftype = ret.ftype;
348 | var fid = ret.fid;
349 | if (ftype == Thrift.Type.STOP) {
350 | break;
351 | }
352 | switch (fid) {
353 | case 11:
354 | if (ftype == Thrift.Type.I32) {
355 | this.e2eeVersion = input.readI32();
356 | } else {
357 | input.skip(ftype);
358 | }
359 | break;
360 | case 1:
361 | if (ftype == Thrift.Type.I32) {
362 | this.type = input.readI32();
363 | } else {
364 | input.skip(ftype);
365 | }
366 | break;
367 | case 2:
368 | if (ftype == Thrift.Type.I32) {
369 | this.identityProvider = input.readI32();
370 | } else {
371 | input.skip(ftype);
372 | }
373 | break;
374 | case 3:
375 | if (ftype == Thrift.Type.STRING) {
376 | this.identifier = input.readString();
377 | } else {
378 | input.skip(ftype);
379 | }
380 | break;
381 | case 4:
382 | if (ftype == Thrift.Type.STRING) {
383 | this.password = input.readString();
384 | } else {
385 | input.skip(ftype);
386 | }
387 | break;
388 | case 5:
389 | if (ftype == Thrift.Type.BOOL) {
390 | this.keepLoggedIn = input.readBool();
391 | } else {
392 | input.skip(ftype);
393 | }
394 | break;
395 | case 6:
396 | if (ftype == Thrift.Type.STRING) {
397 | this.accessLocation = input.readString();
398 | } else {
399 | input.skip(ftype);
400 | }
401 | break;
402 | case 7:
403 | if (ftype == Thrift.Type.STRING) {
404 | this.systemName = input.readString();
405 | } else {
406 | input.skip(ftype);
407 | }
408 | break;
409 | case 8:
410 | if (ftype == Thrift.Type.STRING) {
411 | this.certificate = input.readString();
412 | } else {
413 | input.skip(ftype);
414 | }
415 | break;
416 | case 9:
417 | if (ftype == Thrift.Type.STRING) {
418 | this.verifier = input.readString();
419 | } else {
420 | input.skip(ftype);
421 | }
422 | break;
423 | case 10:
424 | if (ftype == Thrift.Type.STRING) {
425 | this.secret = input.readString();
426 | } else {
427 | input.skip(ftype);
428 | }
429 | break;
430 | default:
431 | input.skip(ftype);
432 | }
433 | input.readFieldEnd();
434 | }
435 | input.readStructEnd();
436 | return;
437 | };
438 |
439 | LoginRequest.prototype.write = function(output) {
440 | output.writeStructBegin('LoginRequest');
441 | if (this.e2eeVersion !== null && this.e2eeVersion !== undefined) {
442 | output.writeFieldBegin('e2eeVersion', Thrift.Type.I32, 11);
443 | output.writeI32(this.e2eeVersion);
444 | output.writeFieldEnd();
445 | }
446 | if (this.type !== null && this.type !== undefined) {
447 | output.writeFieldBegin('type', Thrift.Type.I32, 1);
448 | output.writeI32(this.type);
449 | output.writeFieldEnd();
450 | }
451 | if (this.identityProvider !== null && this.identityProvider !== undefined) {
452 | output.writeFieldBegin('identityProvider', Thrift.Type.I32, 2);
453 | output.writeI32(this.identityProvider);
454 | output.writeFieldEnd();
455 | }
456 | if (this.identifier !== null && this.identifier !== undefined) {
457 | output.writeFieldBegin('identifier', Thrift.Type.STRING, 3);
458 | output.writeString(this.identifier);
459 | output.writeFieldEnd();
460 | }
461 | if (this.password !== null && this.password !== undefined) {
462 | output.writeFieldBegin('password', Thrift.Type.STRING, 4);
463 | output.writeString(this.password);
464 | output.writeFieldEnd();
465 | }
466 | if (this.keepLoggedIn !== null && this.keepLoggedIn !== undefined) {
467 | output.writeFieldBegin('keepLoggedIn', Thrift.Type.BOOL, 5);
468 | output.writeBool(this.keepLoggedIn);
469 | output.writeFieldEnd();
470 | }
471 | if (this.accessLocation !== null && this.accessLocation !== undefined) {
472 | output.writeFieldBegin('accessLocation', Thrift.Type.STRING, 6);
473 | output.writeString(this.accessLocation);
474 | output.writeFieldEnd();
475 | }
476 | if (this.systemName !== null && this.systemName !== undefined) {
477 | output.writeFieldBegin('systemName', Thrift.Type.STRING, 7);
478 | output.writeString(this.systemName);
479 | output.writeFieldEnd();
480 | }
481 | if (this.certificate !== null && this.certificate !== undefined) {
482 | output.writeFieldBegin('certificate', Thrift.Type.STRING, 8);
483 | output.writeString(this.certificate);
484 | output.writeFieldEnd();
485 | }
486 | if (this.verifier !== null && this.verifier !== undefined) {
487 | output.writeFieldBegin('verifier', Thrift.Type.STRING, 9);
488 | output.writeString(this.verifier);
489 | output.writeFieldEnd();
490 | }
491 | if (this.secret !== null && this.secret !== undefined) {
492 | output.writeFieldBegin('secret', Thrift.Type.STRING, 10);
493 | output.writeString(this.secret);
494 | output.writeFieldEnd();
495 | }
496 | output.writeFieldStop();
497 | output.writeStructEnd();
498 | return;
499 | };
500 |
501 | var AuthSessionRequest = module.exports.AuthSessionRequest = function(args) {
502 | this.metaData = null;
503 | if (args) {
504 | if (args.metaData !== undefined && args.metaData !== null) {
505 | this.metaData = Thrift.copyMap(args.metaData, [null]);
506 | }
507 | }
508 | };
509 | AuthSessionRequest.prototype = {};
510 | AuthSessionRequest.prototype.read = function(input) {
511 | input.readStructBegin();
512 | while (true) {
513 | var ret = input.readFieldBegin();
514 | var ftype = ret.ftype;
515 | var fid = ret.fid;
516 | if (ftype == Thrift.Type.STOP) {
517 | break;
518 | }
519 | switch (fid) {
520 | case 1:
521 | if (ftype == Thrift.Type.MAP) {
522 | this.metaData = {};
523 | var _rtmp31 = input.readMapBegin();
524 | var _size0 = _rtmp31.size || 0;
525 | for (var _i2 = 0; _i2 < _size0; ++_i2) {
526 | var key3 = null;
527 | var val4 = null;
528 | key3 = input.readString();
529 | val4 = input.readString();
530 | this.metaData[key3] = val4;
531 | }
532 | input.readMapEnd();
533 | } else {
534 | input.skip(ftype);
535 | }
536 | break;
537 | case 0:
538 | input.skip(ftype);
539 | break;
540 | default:
541 | input.skip(ftype);
542 | }
543 | input.readFieldEnd();
544 | }
545 | input.readStructEnd();
546 | return;
547 | };
548 |
549 | AuthSessionRequest.prototype.write = function(output) {
550 | output.writeStructBegin('AuthSessionRequest');
551 | if (this.metaData !== null && this.metaData !== undefined) {
552 | output.writeFieldBegin('metaData', Thrift.Type.MAP, 1);
553 | output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.STRING, Thrift.objectLength(this.metaData));
554 | for (var kiter5 in this.metaData) {
555 | if (this.metaData.hasOwnProperty(kiter5)) {
556 | var viter6 = this.metaData[kiter5];
557 | output.writeString(kiter5);
558 | output.writeString(viter6);
559 | }
560 | }
561 | output.writeMapEnd();
562 | output.writeFieldEnd();
563 | }
564 | output.writeFieldStop();
565 | output.writeStructEnd();
566 | return;
567 | };
568 |
569 | var IdentityCredentialResponse = module.exports.IdentityCredentialResponse = function(args) {
570 | this.metaData = null;
571 | this.responseType = null;
572 | this.confirmationVerifier = null;
573 | this.timeoutInSeconds = null;
574 | if (args) {
575 | if (args.metaData !== undefined && args.metaData !== null) {
576 | this.metaData = Thrift.copyMap(args.metaData, [null]);
577 | }
578 | if (args.responseType !== undefined && args.responseType !== null) {
579 | this.responseType = args.responseType;
580 | }
581 | if (args.confirmationVerifier !== undefined && args.confirmationVerifier !== null) {
582 | this.confirmationVerifier = args.confirmationVerifier;
583 | }
584 | if (args.timeoutInSeconds !== undefined && args.timeoutInSeconds !== null) {
585 | this.timeoutInSeconds = args.timeoutInSeconds;
586 | }
587 | }
588 | };
589 | IdentityCredentialResponse.prototype = {};
590 | IdentityCredentialResponse.prototype.read = function(input) {
591 | input.readStructBegin();
592 | while (true) {
593 | var ret = input.readFieldBegin();
594 | var ftype = ret.ftype;
595 | var fid = ret.fid;
596 | if (ftype == Thrift.Type.STOP) {
597 | break;
598 | }
599 | switch (fid) {
600 | case 1:
601 | if (ftype == Thrift.Type.MAP) {
602 | this.metaData = {};
603 | var _rtmp38 = input.readMapBegin();
604 | var _size7 = _rtmp38.size || 0;
605 | for (var _i9 = 0; _i9 < _size7; ++_i9) {
606 | var key10 = null;
607 | var val11 = null;
608 | key10 = input.readString();
609 | val11 = input.readString();
610 | this.metaData[key10] = val11;
611 | }
612 | input.readMapEnd();
613 | } else {
614 | input.skip(ftype);
615 | }
616 | break;
617 | case 2:
618 | if (ftype == Thrift.Type.I32) {
619 | this.responseType = input.readI32();
620 | } else {
621 | input.skip(ftype);
622 | }
623 | break;
624 | case 3:
625 | if (ftype == Thrift.Type.STRING) {
626 | this.confirmationVerifier = input.readString();
627 | } else {
628 | input.skip(ftype);
629 | }
630 | break;
631 | case 4:
632 | if (ftype == Thrift.Type.I64) {
633 | this.timeoutInSeconds = input.readI64();
634 | } else {
635 | input.skip(ftype);
636 | }
637 | break;
638 | default:
639 | input.skip(ftype);
640 | }
641 | input.readFieldEnd();
642 | }
643 | input.readStructEnd();
644 | return;
645 | };
646 |
647 | IdentityCredentialResponse.prototype.write = function(output) {
648 | output.writeStructBegin('IdentityCredentialResponse');
649 | if (this.metaData !== null && this.metaData !== undefined) {
650 | output.writeFieldBegin('metaData', Thrift.Type.MAP, 1);
651 | output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.STRING, Thrift.objectLength(this.metaData));
652 | for (var kiter12 in this.metaData) {
653 | if (this.metaData.hasOwnProperty(kiter12)) {
654 | var viter13 = this.metaData[kiter12];
655 | output.writeString(kiter12);
656 | output.writeString(viter13);
657 | }
658 | }
659 | output.writeMapEnd();
660 | output.writeFieldEnd();
661 | }
662 | if (this.responseType !== null && this.responseType !== undefined) {
663 | output.writeFieldBegin('responseType', Thrift.Type.I32, 2);
664 | output.writeI32(this.responseType);
665 | output.writeFieldEnd();
666 | }
667 | if (this.confirmationVerifier !== null && this.confirmationVerifier !== undefined) {
668 | output.writeFieldBegin('confirmationVerifier', Thrift.Type.STRING, 3);
669 | output.writeString(this.confirmationVerifier);
670 | output.writeFieldEnd();
671 | }
672 | if (this.timeoutInSeconds !== null && this.timeoutInSeconds !== undefined) {
673 | output.writeFieldBegin('timeoutInSeconds', Thrift.Type.I64, 4);
674 | output.writeI64(this.timeoutInSeconds);
675 | output.writeFieldEnd();
676 | }
677 | output.writeFieldStop();
678 | output.writeStructEnd();
679 | return;
680 | };
681 |
682 | var IdentifierConfirmationRequest = module.exports.IdentifierConfirmationRequest = function(args) {
683 | this.metaData = null;
684 | this.forceRegistration = null;
685 | this.verificationCode = null;
686 | if (args) {
687 | if (args.metaData !== undefined && args.metaData !== null) {
688 | this.metaData = Thrift.copyMap(args.metaData, [null]);
689 | }
690 | if (args.forceRegistration !== undefined && args.forceRegistration !== null) {
691 | this.forceRegistration = args.forceRegistration;
692 | }
693 | if (args.verificationCode !== undefined && args.verificationCode !== null) {
694 | this.verificationCode = args.verificationCode;
695 | }
696 | }
697 | };
698 | IdentifierConfirmationRequest.prototype = {};
699 | IdentifierConfirmationRequest.prototype.read = function(input) {
700 | input.readStructBegin();
701 | while (true) {
702 | var ret = input.readFieldBegin();
703 | var ftype = ret.ftype;
704 | var fid = ret.fid;
705 | if (ftype == Thrift.Type.STOP) {
706 | break;
707 | }
708 | switch (fid) {
709 | case 1:
710 | if (ftype == Thrift.Type.MAP) {
711 | this.metaData = {};
712 | var _rtmp315 = input.readMapBegin();
713 | var _size14 = _rtmp315.size || 0;
714 | for (var _i16 = 0; _i16 < _size14; ++_i16) {
715 | var key17 = null;
716 | var val18 = null;
717 | key17 = input.readString();
718 | val18 = input.readString();
719 | this.metaData[key17] = val18;
720 | }
721 | input.readMapEnd();
722 | } else {
723 | input.skip(ftype);
724 | }
725 | break;
726 | case 2:
727 | if (ftype == Thrift.Type.BOOL) {
728 | this.forceRegistration = input.readBool();
729 | } else {
730 | input.skip(ftype);
731 | }
732 | break;
733 | case 3:
734 | if (ftype == Thrift.Type.STRING) {
735 | this.verificationCode = input.readString();
736 | } else {
737 | input.skip(ftype);
738 | }
739 | break;
740 | default:
741 | input.skip(ftype);
742 | }
743 | input.readFieldEnd();
744 | }
745 | input.readStructEnd();
746 | return;
747 | };
748 |
749 | IdentifierConfirmationRequest.prototype.write = function(output) {
750 | output.writeStructBegin('IdentifierConfirmationRequest');
751 | if (this.metaData !== null && this.metaData !== undefined) {
752 | output.writeFieldBegin('metaData', Thrift.Type.MAP, 1);
753 | output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.STRING, Thrift.objectLength(this.metaData));
754 | for (var kiter19 in this.metaData) {
755 | if (this.metaData.hasOwnProperty(kiter19)) {
756 | var viter20 = this.metaData[kiter19];
757 | output.writeString(kiter19);
758 | output.writeString(viter20);
759 | }
760 | }
761 | output.writeMapEnd();
762 | output.writeFieldEnd();
763 | }
764 | if (this.forceRegistration !== null && this.forceRegistration !== undefined) {
765 | output.writeFieldBegin('forceRegistration', Thrift.Type.BOOL, 2);
766 | output.writeBool(this.forceRegistration);
767 | output.writeFieldEnd();
768 | }
769 | if (this.verificationCode !== null && this.verificationCode !== undefined) {
770 | output.writeFieldBegin('verificationCode', Thrift.Type.STRING, 3);
771 | output.writeString(this.verificationCode);
772 | output.writeFieldEnd();
773 | }
774 | output.writeFieldStop();
775 | output.writeStructEnd();
776 | return;
777 | };
778 |
779 | var IdentityCredentialRequest = module.exports.IdentityCredentialRequest = function(args) {
780 | this.metaData = null;
781 | this.identityProvider = null;
782 | this.cipherKeyId = null;
783 | this.cipherText = null;
784 | this.confirmationRequest = null;
785 | if (args) {
786 | if (args.metaData !== undefined && args.metaData !== null) {
787 | this.metaData = Thrift.copyMap(args.metaData, [null]);
788 | }
789 | if (args.identityProvider !== undefined && args.identityProvider !== null) {
790 | this.identityProvider = args.identityProvider;
791 | }
792 | if (args.cipherKeyId !== undefined && args.cipherKeyId !== null) {
793 | this.cipherKeyId = args.cipherKeyId;
794 | }
795 | if (args.cipherText !== undefined && args.cipherText !== null) {
796 | this.cipherText = args.cipherText;
797 | }
798 | if (args.confirmationRequest !== undefined && args.confirmationRequest !== null) {
799 | this.confirmationRequest = new ttypes.IdentifierConfirmationRequest(args.confirmationRequest);
800 | }
801 | }
802 | };
803 | IdentityCredentialRequest.prototype = {};
804 | IdentityCredentialRequest.prototype.read = function(input) {
805 | input.readStructBegin();
806 | while (true) {
807 | var ret = input.readFieldBegin();
808 | var ftype = ret.ftype;
809 | var fid = ret.fid;
810 | if (ftype == Thrift.Type.STOP) {
811 | break;
812 | }
813 | switch (fid) {
814 | case 1:
815 | if (ftype == Thrift.Type.MAP) {
816 | this.metaData = {};
817 | var _rtmp322 = input.readMapBegin();
818 | var _size21 = _rtmp322.size || 0;
819 | for (var _i23 = 0; _i23 < _size21; ++_i23) {
820 | var key24 = null;
821 | var val25 = null;
822 | key24 = input.readString();
823 | val25 = input.readString();
824 | this.metaData[key24] = val25;
825 | }
826 | input.readMapEnd();
827 | } else {
828 | input.skip(ftype);
829 | }
830 | break;
831 | case 2:
832 | if (ftype == Thrift.Type.I32) {
833 | this.identityProvider = input.readI32();
834 | } else {
835 | input.skip(ftype);
836 | }
837 | break;
838 | case 3:
839 | if (ftype == Thrift.Type.STRING) {
840 | this.cipherKeyId = input.readString();
841 | } else {
842 | input.skip(ftype);
843 | }
844 | break;
845 | case 4:
846 | if (ftype == Thrift.Type.STRING) {
847 | this.cipherText = input.readString();
848 | } else {
849 | input.skip(ftype);
850 | }
851 | break;
852 | case 5:
853 | if (ftype == Thrift.Type.STRUCT) {
854 | this.confirmationRequest = new ttypes.IdentifierConfirmationRequest();
855 | this.confirmationRequest.read(input);
856 | } else {
857 | input.skip(ftype);
858 | }
859 | break;
860 | default:
861 | input.skip(ftype);
862 | }
863 | input.readFieldEnd();
864 | }
865 | input.readStructEnd();
866 | return;
867 | };
868 |
869 | IdentityCredentialRequest.prototype.write = function(output) {
870 | output.writeStructBegin('IdentityCredentialRequest');
871 | if (this.metaData !== null && this.metaData !== undefined) {
872 | output.writeFieldBegin('metaData', Thrift.Type.MAP, 1);
873 | output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.STRING, Thrift.objectLength(this.metaData));
874 | for (var kiter26 in this.metaData) {
875 | if (this.metaData.hasOwnProperty(kiter26)) {
876 | var viter27 = this.metaData[kiter26];
877 | output.writeString(kiter26);
878 | output.writeString(viter27);
879 | }
880 | }
881 | output.writeMapEnd();
882 | output.writeFieldEnd();
883 | }
884 | if (this.identityProvider !== null && this.identityProvider !== undefined) {
885 | output.writeFieldBegin('identityProvider', Thrift.Type.I32, 2);
886 | output.writeI32(this.identityProvider);
887 | output.writeFieldEnd();
888 | }
889 | if (this.cipherKeyId !== null && this.cipherKeyId !== undefined) {
890 | output.writeFieldBegin('cipherKeyId', Thrift.Type.STRING, 3);
891 | output.writeString(this.cipherKeyId);
892 | output.writeFieldEnd();
893 | }
894 | if (this.cipherText !== null && this.cipherText !== undefined) {
895 | output.writeFieldBegin('cipherText', Thrift.Type.STRING, 4);
896 | output.writeString(this.cipherText);
897 | output.writeFieldEnd();
898 | }
899 | if (this.confirmationRequest !== null && this.confirmationRequest !== undefined) {
900 | output.writeFieldBegin('confirmationRequest', Thrift.Type.STRUCT, 5);
901 | this.confirmationRequest.write(output);
902 | output.writeFieldEnd();
903 | }
904 | output.writeFieldStop();
905 | output.writeStructEnd();
906 | return;
907 | };
908 |
909 | var SecurityCenterResult = module.exports.SecurityCenterResult = function(args) {
910 | this.uri = null;
911 | this.token = null;
912 | this.cookiePath = null;
913 | this.skip = null;
914 | if (args) {
915 | if (args.uri !== undefined && args.uri !== null) {
916 | this.uri = args.uri;
917 | }
918 | if (args.token !== undefined && args.token !== null) {
919 | this.token = args.token;
920 | }
921 | if (args.cookiePath !== undefined && args.cookiePath !== null) {
922 | this.cookiePath = args.cookiePath;
923 | }
924 | if (args.skip !== undefined && args.skip !== null) {
925 | this.skip = args.skip;
926 | }
927 | }
928 | };
929 | SecurityCenterResult.prototype = {};
930 | SecurityCenterResult.prototype.read = function(input) {
931 | input.readStructBegin();
932 | while (true) {
933 | var ret = input.readFieldBegin();
934 | var ftype = ret.ftype;
935 | var fid = ret.fid;
936 | if (ftype == Thrift.Type.STOP) {
937 | break;
938 | }
939 | switch (fid) {
940 | case 1:
941 | if (ftype == Thrift.Type.STRING) {
942 | this.uri = input.readString();
943 | } else {
944 | input.skip(ftype);
945 | }
946 | break;
947 | case 2:
948 | if (ftype == Thrift.Type.STRING) {
949 | this.token = input.readString();
950 | } else {
951 | input.skip(ftype);
952 | }
953 | break;
954 | case 3:
955 | if (ftype == Thrift.Type.STRING) {
956 | this.cookiePath = input.readString();
957 | } else {
958 | input.skip(ftype);
959 | }
960 | break;
961 | case 4:
962 | if (ftype == Thrift.Type.BOOL) {
963 | this.skip = input.readBool();
964 | } else {
965 | input.skip(ftype);
966 | }
967 | break;
968 | default:
969 | input.skip(ftype);
970 | }
971 | input.readFieldEnd();
972 | }
973 | input.readStructEnd();
974 | return;
975 | };
976 |
977 | SecurityCenterResult.prototype.write = function(output) {
978 | output.writeStructBegin('SecurityCenterResult');
979 | if (this.uri !== null && this.uri !== undefined) {
980 | output.writeFieldBegin('uri', Thrift.Type.STRING, 1);
981 | output.writeString(this.uri);
982 | output.writeFieldEnd();
983 | }
984 | if (this.token !== null && this.token !== undefined) {
985 | output.writeFieldBegin('token', Thrift.Type.STRING, 2);
986 | output.writeString(this.token);
987 | output.writeFieldEnd();
988 | }
989 | if (this.cookiePath !== null && this.cookiePath !== undefined) {
990 | output.writeFieldBegin('cookiePath', Thrift.Type.STRING, 3);
991 | output.writeString(this.cookiePath);
992 | output.writeFieldEnd();
993 | }
994 | if (this.skip !== null && this.skip !== undefined) {
995 | output.writeFieldBegin('skip', Thrift.Type.BOOL, 4);
996 | output.writeBool(this.skip);
997 | output.writeFieldEnd();
998 | }
999 | output.writeFieldStop();
1000 | output.writeStructEnd();
1001 | return;
1002 | };
1003 |
1004 | var SetPasswordResponse = module.exports.SetPasswordResponse = function(args) {
1005 | };
1006 | SetPasswordResponse.prototype = {};
1007 | SetPasswordResponse.prototype.read = function(input) {
1008 | input.readStructBegin();
1009 | while (true) {
1010 | var ret = input.readFieldBegin();
1011 | var ftype = ret.ftype;
1012 | if (ftype == Thrift.Type.STOP) {
1013 | break;
1014 | }
1015 | input.skip(ftype);
1016 | input.readFieldEnd();
1017 | }
1018 | input.readStructEnd();
1019 | return;
1020 | };
1021 |
1022 | SetPasswordResponse.prototype.write = function(output) {
1023 | output.writeStructBegin('SetPasswordResponse');
1024 | output.writeFieldStop();
1025 | output.writeStructEnd();
1026 | return;
1027 | };
1028 |
1029 | var EncryptedPassword = module.exports.EncryptedPassword = function(args) {
1030 | this.encryptionKeyVersion = null;
1031 | this.cipherText = null;
1032 | if (args) {
1033 | if (args.encryptionKeyVersion !== undefined && args.encryptionKeyVersion !== null) {
1034 | this.encryptionKeyVersion = args.encryptionKeyVersion;
1035 | }
1036 | if (args.cipherText !== undefined && args.cipherText !== null) {
1037 | this.cipherText = args.cipherText;
1038 | }
1039 | }
1040 | };
1041 | EncryptedPassword.prototype = {};
1042 | EncryptedPassword.prototype.read = function(input) {
1043 | input.readStructBegin();
1044 | while (true) {
1045 | var ret = input.readFieldBegin();
1046 | var ftype = ret.ftype;
1047 | var fid = ret.fid;
1048 | if (ftype == Thrift.Type.STOP) {
1049 | break;
1050 | }
1051 | switch (fid) {
1052 | case 1:
1053 | if (ftype == Thrift.Type.I32) {
1054 | this.encryptionKeyVersion = input.readI32();
1055 | } else {
1056 | input.skip(ftype);
1057 | }
1058 | break;
1059 | case 2:
1060 | if (ftype == Thrift.Type.STRING) {
1061 | this.cipherText = input.readString();
1062 | } else {
1063 | input.skip(ftype);
1064 | }
1065 | break;
1066 | default:
1067 | input.skip(ftype);
1068 | }
1069 | input.readFieldEnd();
1070 | }
1071 | input.readStructEnd();
1072 | return;
1073 | };
1074 |
1075 | EncryptedPassword.prototype.write = function(output) {
1076 | output.writeStructBegin('EncryptedPassword');
1077 | if (this.encryptionKeyVersion !== null && this.encryptionKeyVersion !== undefined) {
1078 | output.writeFieldBegin('encryptionKeyVersion', Thrift.Type.I32, 1);
1079 | output.writeI32(this.encryptionKeyVersion);
1080 | output.writeFieldEnd();
1081 | }
1082 | if (this.cipherText !== null && this.cipherText !== undefined) {
1083 | output.writeFieldBegin('cipherText', Thrift.Type.STRING, 2);
1084 | output.writeString(this.cipherText);
1085 | output.writeFieldEnd();
1086 | }
1087 | output.writeFieldStop();
1088 | output.writeStructEnd();
1089 | return;
1090 | };
1091 |
1092 |
--------------------------------------------------------------------------------
/src/CONSENT/gen-nodejs/SecondaryQrCodeLoginPermitNoticeService.js:
--------------------------------------------------------------------------------
1 | //
2 | // Autogenerated by Thrift Compiler (0.14.1)
3 | //
4 | // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 | //
6 | "use strict";
7 |
8 | var thrift = require('thrift');
9 | var Thrift = thrift.Thrift;
10 | var Q = thrift.Q;
11 | var Int64 = require('node-int64');
12 |
13 | var SecondaryQrCodeLoginService_ttypes = require('./SecondaryQrCodeLoginService_types');
14 |
15 |
16 | var ttypes = require('./SecondaryQrCodeLoginPermitNoticeService_types');
17 | //HELPER FUNCTIONS AND STRUCTURES
18 |
19 | var SecondaryQrCodeLoginPermitNoticeService_checkQrCodeVerified_args = function(args) {
20 | this.request = null;
21 | if (args) {
22 | if (args.request !== undefined && args.request !== null) {
23 | this.request = new ttypes.CheckQrCodeVerifiedRequest(args.request);
24 | }
25 | }
26 | };
27 | SecondaryQrCodeLoginPermitNoticeService_checkQrCodeVerified_args.prototype = {};
28 | SecondaryQrCodeLoginPermitNoticeService_checkQrCodeVerified_args.prototype.read = function(input) {
29 | input.readStructBegin();
30 | while (true) {
31 | var ret = input.readFieldBegin();
32 | var ftype = ret.ftype;
33 | var fid = ret.fid;
34 | if (ftype == Thrift.Type.STOP) {
35 | break;
36 | }
37 | switch (fid) {
38 | case 1:
39 | if (ftype == Thrift.Type.STRUCT) {
40 | this.request = new ttypes.CheckQrCodeVerifiedRequest();
41 | this.request.read(input);
42 | } else {
43 | input.skip(ftype);
44 | }
45 | break;
46 | case 0:
47 | input.skip(ftype);
48 | break;
49 | default:
50 | input.skip(ftype);
51 | }
52 | input.readFieldEnd();
53 | }
54 | input.readStructEnd();
55 | return;
56 | };
57 |
58 | SecondaryQrCodeLoginPermitNoticeService_checkQrCodeVerified_args.prototype.write = function(output) {
59 | output.writeStructBegin('SecondaryQrCodeLoginPermitNoticeService_checkQrCodeVerified_args');
60 | if (this.request !== null && this.request !== undefined) {
61 | output.writeFieldBegin('request', Thrift.Type.STRUCT, 1);
62 | this.request.write(output);
63 | output.writeFieldEnd();
64 | }
65 | output.writeFieldStop();
66 | output.writeStructEnd();
67 | return;
68 | };
69 |
70 | var SecondaryQrCodeLoginPermitNoticeService_checkQrCodeVerified_result = function(args) {
71 | this.success = null;
72 | this.e = null;
73 | if (args instanceof SecondaryQrCodeLoginService_ttypes.SecondaryQrCodeException) {
74 | this.e = args;
75 | return;
76 | }
77 | if (args) {
78 | if (args.success !== undefined && args.success !== null) {
79 | this.success = new ttypes.CheckQrCodeVerifiedResponse(args.success);
80 | }
81 | if (args.e !== undefined && args.e !== null) {
82 | this.e = args.e;
83 | }
84 | }
85 | };
86 | SecondaryQrCodeLoginPermitNoticeService_checkQrCodeVerified_result.prototype = {};
87 | SecondaryQrCodeLoginPermitNoticeService_checkQrCodeVerified_result.prototype.read = function(input) {
88 | input.readStructBegin();
89 | while (true) {
90 | var ret = input.readFieldBegin();
91 | var ftype = ret.ftype;
92 | var fid = ret.fid;
93 | if (ftype == Thrift.Type.STOP) {
94 | break;
95 | }
96 | switch (fid) {
97 | case 0:
98 | if (ftype == Thrift.Type.STRUCT) {
99 | this.success = new ttypes.CheckQrCodeVerifiedResponse();
100 | this.success.read(input);
101 | } else {
102 | input.skip(ftype);
103 | }
104 | break;
105 | case 1:
106 | if (ftype == Thrift.Type.STRUCT) {
107 | this.e = new SecondaryQrCodeLoginService_ttypes.SecondaryQrCodeException();
108 | this.e.read(input);
109 | } else {
110 | input.skip(ftype);
111 | }
112 | break;
113 | default:
114 | input.skip(ftype);
115 | }
116 | input.readFieldEnd();
117 | }
118 | input.readStructEnd();
119 | return;
120 | };
121 |
122 | SecondaryQrCodeLoginPermitNoticeService_checkQrCodeVerified_result.prototype.write = function(output) {
123 | output.writeStructBegin('SecondaryQrCodeLoginPermitNoticeService_checkQrCodeVerified_result');
124 | if (this.success !== null && this.success !== undefined) {
125 | output.writeFieldBegin('success', Thrift.Type.STRUCT, 0);
126 | this.success.write(output);
127 | output.writeFieldEnd();
128 | }
129 | if (this.e !== null && this.e !== undefined) {
130 | output.writeFieldBegin('e', Thrift.Type.STRUCT, 1);
131 | this.e.write(output);
132 | output.writeFieldEnd();
133 | }
134 | output.writeFieldStop();
135 | output.writeStructEnd();
136 | return;
137 | };
138 |
139 | var SecondaryQrCodeLoginPermitNoticeService_checkPinCodeVerified_args = function(args) {
140 | this.request = null;
141 | if (args) {
142 | if (args.request !== undefined && args.request !== null) {
143 | this.request = new ttypes.CheckPinCodeVerifiedRequest(args.request);
144 | }
145 | }
146 | };
147 | SecondaryQrCodeLoginPermitNoticeService_checkPinCodeVerified_args.prototype = {};
148 | SecondaryQrCodeLoginPermitNoticeService_checkPinCodeVerified_args.prototype.read = function(input) {
149 | input.readStructBegin();
150 | while (true) {
151 | var ret = input.readFieldBegin();
152 | var ftype = ret.ftype;
153 | var fid = ret.fid;
154 | if (ftype == Thrift.Type.STOP) {
155 | break;
156 | }
157 | switch (fid) {
158 | case 1:
159 | if (ftype == Thrift.Type.STRUCT) {
160 | this.request = new ttypes.CheckPinCodeVerifiedRequest();
161 | this.request.read(input);
162 | } else {
163 | input.skip(ftype);
164 | }
165 | break;
166 | case 0:
167 | input.skip(ftype);
168 | break;
169 | default:
170 | input.skip(ftype);
171 | }
172 | input.readFieldEnd();
173 | }
174 | input.readStructEnd();
175 | return;
176 | };
177 |
178 | SecondaryQrCodeLoginPermitNoticeService_checkPinCodeVerified_args.prototype.write = function(output) {
179 | output.writeStructBegin('SecondaryQrCodeLoginPermitNoticeService_checkPinCodeVerified_args');
180 | if (this.request !== null && this.request !== undefined) {
181 | output.writeFieldBegin('request', Thrift.Type.STRUCT, 1);
182 | this.request.write(output);
183 | output.writeFieldEnd();
184 | }
185 | output.writeFieldStop();
186 | output.writeStructEnd();
187 | return;
188 | };
189 |
190 | var SecondaryQrCodeLoginPermitNoticeService_checkPinCodeVerified_result = function(args) {
191 | this.success = null;
192 | this.e = null;
193 | if (args instanceof SecondaryQrCodeLoginService_ttypes.SecondaryQrCodeException) {
194 | this.e = args;
195 | return;
196 | }
197 | if (args) {
198 | if (args.success !== undefined && args.success !== null) {
199 | this.success = new ttypes.CheckPinCodeVerifiedResponse(args.success);
200 | }
201 | if (args.e !== undefined && args.e !== null) {
202 | this.e = args.e;
203 | }
204 | }
205 | };
206 | SecondaryQrCodeLoginPermitNoticeService_checkPinCodeVerified_result.prototype = {};
207 | SecondaryQrCodeLoginPermitNoticeService_checkPinCodeVerified_result.prototype.read = function(input) {
208 | input.readStructBegin();
209 | while (true) {
210 | var ret = input.readFieldBegin();
211 | var ftype = ret.ftype;
212 | var fid = ret.fid;
213 | if (ftype == Thrift.Type.STOP) {
214 | break;
215 | }
216 | switch (fid) {
217 | case 0:
218 | if (ftype == Thrift.Type.STRUCT) {
219 | this.success = new ttypes.CheckPinCodeVerifiedResponse();
220 | this.success.read(input);
221 | } else {
222 | input.skip(ftype);
223 | }
224 | break;
225 | case 1:
226 | if (ftype == Thrift.Type.STRUCT) {
227 | this.e = new SecondaryQrCodeLoginService_ttypes.SecondaryQrCodeException();
228 | this.e.read(input);
229 | } else {
230 | input.skip(ftype);
231 | }
232 | break;
233 | default:
234 | input.skip(ftype);
235 | }
236 | input.readFieldEnd();
237 | }
238 | input.readStructEnd();
239 | return;
240 | };
241 |
242 | SecondaryQrCodeLoginPermitNoticeService_checkPinCodeVerified_result.prototype.write = function(output) {
243 | output.writeStructBegin('SecondaryQrCodeLoginPermitNoticeService_checkPinCodeVerified_result');
244 | if (this.success !== null && this.success !== undefined) {
245 | output.writeFieldBegin('success', Thrift.Type.STRUCT, 0);
246 | this.success.write(output);
247 | output.writeFieldEnd();
248 | }
249 | if (this.e !== null && this.e !== undefined) {
250 | output.writeFieldBegin('e', Thrift.Type.STRUCT, 1);
251 | this.e.write(output);
252 | output.writeFieldEnd();
253 | }
254 | output.writeFieldStop();
255 | output.writeStructEnd();
256 | return;
257 | };
258 |
259 | var SecondaryQrCodeLoginPermitNoticeServiceClient = exports.Client = function(output, pClass) {
260 | this.output = output;
261 | this.pClass = pClass;
262 | this._seqid = 0;
263 | this._reqs = {};
264 | };
265 | SecondaryQrCodeLoginPermitNoticeServiceClient.prototype = {};
266 | SecondaryQrCodeLoginPermitNoticeServiceClient.prototype.seqid = function() { return this._seqid; };
267 | SecondaryQrCodeLoginPermitNoticeServiceClient.prototype.new_seqid = function() { return this._seqid += 1; };
268 |
269 | SecondaryQrCodeLoginPermitNoticeServiceClient.prototype.checkQrCodeVerified = function(request, callback) {
270 | this._seqid = this.new_seqid();
271 | if (callback === undefined) {
272 | var _defer = Q.defer();
273 | this._reqs[this.seqid()] = function(error, result) {
274 | if (error) {
275 | _defer.reject(error);
276 | } else {
277 | _defer.resolve(result);
278 | }
279 | };
280 | this.send_checkQrCodeVerified(request);
281 | return _defer.promise;
282 | } else {
283 | this._reqs[this.seqid()] = callback;
284 | this.send_checkQrCodeVerified(request);
285 | }
286 | };
287 |
288 | SecondaryQrCodeLoginPermitNoticeServiceClient.prototype.send_checkQrCodeVerified = function(request) {
289 | var output = new this.pClass(this.output);
290 | var params = {
291 | request: request
292 | };
293 | var args = new SecondaryQrCodeLoginPermitNoticeService_checkQrCodeVerified_args(params);
294 | try {
295 | output.writeMessageBegin('checkQrCodeVerified', Thrift.MessageType.CALL, this.seqid());
296 | args.write(output);
297 | output.writeMessageEnd();
298 | return this.output.flush();
299 | }
300 | catch (e) {
301 | delete this._reqs[this.seqid()];
302 | if (typeof output.reset === 'function') {
303 | output.reset();
304 | }
305 | throw e;
306 | }
307 | };
308 |
309 | SecondaryQrCodeLoginPermitNoticeServiceClient.prototype.recv_checkQrCodeVerified = function(input,mtype,rseqid) {
310 | var callback = this._reqs[rseqid] || function() {};
311 | delete this._reqs[rseqid];
312 | if (mtype == Thrift.MessageType.EXCEPTION) {
313 | var x = new Thrift.TApplicationException();
314 | x.read(input);
315 | input.readMessageEnd();
316 | return callback(x);
317 | }
318 | var result = new SecondaryQrCodeLoginPermitNoticeService_checkQrCodeVerified_result();
319 | result.read(input);
320 | input.readMessageEnd();
321 |
322 | if (null !== result.e) {
323 | return callback(result.e);
324 | }
325 | if (null !== result.success) {
326 | return callback(null, result.success);
327 | }
328 | return callback('checkQrCodeVerified failed: unknown result');
329 | };
330 |
331 | SecondaryQrCodeLoginPermitNoticeServiceClient.prototype.checkPinCodeVerified = function(request, callback) {
332 | this._seqid = this.new_seqid();
333 | if (callback === undefined) {
334 | var _defer = Q.defer();
335 | this._reqs[this.seqid()] = function(error, result) {
336 | if (error) {
337 | _defer.reject(error);
338 | } else {
339 | _defer.resolve(result);
340 | }
341 | };
342 | this.send_checkPinCodeVerified(request);
343 | return _defer.promise;
344 | } else {
345 | this._reqs[this.seqid()] = callback;
346 | this.send_checkPinCodeVerified(request);
347 | }
348 | };
349 |
350 | SecondaryQrCodeLoginPermitNoticeServiceClient.prototype.send_checkPinCodeVerified = function(request) {
351 | var output = new this.pClass(this.output);
352 | var params = {
353 | request: request
354 | };
355 | var args = new SecondaryQrCodeLoginPermitNoticeService_checkPinCodeVerified_args(params);
356 | try {
357 | output.writeMessageBegin('checkPinCodeVerified', Thrift.MessageType.CALL, this.seqid());
358 | args.write(output);
359 | output.writeMessageEnd();
360 | return this.output.flush();
361 | }
362 | catch (e) {
363 | delete this._reqs[this.seqid()];
364 | if (typeof output.reset === 'function') {
365 | output.reset();
366 | }
367 | throw e;
368 | }
369 | };
370 |
371 | SecondaryQrCodeLoginPermitNoticeServiceClient.prototype.recv_checkPinCodeVerified = function(input,mtype,rseqid) {
372 | var callback = this._reqs[rseqid] || function() {};
373 | delete this._reqs[rseqid];
374 | if (mtype == Thrift.MessageType.EXCEPTION) {
375 | var x = new Thrift.TApplicationException();
376 | x.read(input);
377 | input.readMessageEnd();
378 | return callback(x);
379 | }
380 | var result = new SecondaryQrCodeLoginPermitNoticeService_checkPinCodeVerified_result();
381 | result.read(input);
382 | input.readMessageEnd();
383 |
384 | if (null !== result.e) {
385 | return callback(result.e);
386 | }
387 | if (null !== result.success) {
388 | return callback(null, result.success);
389 | }
390 | return callback('checkPinCodeVerified failed: unknown result');
391 | };
392 | var SecondaryQrCodeLoginPermitNoticeServiceProcessor = exports.Processor = function(handler) {
393 | this._handler = handler;
394 | };
395 | SecondaryQrCodeLoginPermitNoticeServiceProcessor.prototype.process = function(input, output) {
396 | var r = input.readMessageBegin();
397 | if (this['process_' + r.fname]) {
398 | return this['process_' + r.fname].call(this, r.rseqid, input, output);
399 | } else {
400 | input.skip(Thrift.Type.STRUCT);
401 | input.readMessageEnd();
402 | var x = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN_METHOD, 'Unknown function ' + r.fname);
403 | output.writeMessageBegin(r.fname, Thrift.MessageType.EXCEPTION, r.rseqid);
404 | x.write(output);
405 | output.writeMessageEnd();
406 | output.flush();
407 | }
408 | };
409 | SecondaryQrCodeLoginPermitNoticeServiceProcessor.prototype.process_checkQrCodeVerified = function(seqid, input, output) {
410 | var args = new SecondaryQrCodeLoginPermitNoticeService_checkQrCodeVerified_args();
411 | args.read(input);
412 | input.readMessageEnd();
413 | if (this._handler.checkQrCodeVerified.length === 1) {
414 | Q.fcall(this._handler.checkQrCodeVerified.bind(this._handler),
415 | args.request
416 | ).then(function(result) {
417 | var result_obj = new SecondaryQrCodeLoginPermitNoticeService_checkQrCodeVerified_result({success: result});
418 | output.writeMessageBegin("checkQrCodeVerified", Thrift.MessageType.REPLY, seqid);
419 | result_obj.write(output);
420 | output.writeMessageEnd();
421 | output.flush();
422 | }).catch(function (err) {
423 | var result;
424 | if (err instanceof SecondaryQrCodeLoginService_ttypes.SecondaryQrCodeException) {
425 | result = new SecondaryQrCodeLoginPermitNoticeService_checkQrCodeVerified_result(err);
426 | output.writeMessageBegin("checkQrCodeVerified", Thrift.MessageType.REPLY, seqid);
427 | } else {
428 | result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
429 | output.writeMessageBegin("checkQrCodeVerified", Thrift.MessageType.EXCEPTION, seqid);
430 | }
431 | result.write(output);
432 | output.writeMessageEnd();
433 | output.flush();
434 | });
435 | } else {
436 | this._handler.checkQrCodeVerified(args.request, function (err, result) {
437 | var result_obj;
438 | if ((err === null || typeof err === 'undefined') || err instanceof SecondaryQrCodeLoginService_ttypes.SecondaryQrCodeException) {
439 | result_obj = new SecondaryQrCodeLoginPermitNoticeService_checkQrCodeVerified_result((err !== null || typeof err === 'undefined') ? err : {success: result});
440 | output.writeMessageBegin("checkQrCodeVerified", Thrift.MessageType.REPLY, seqid);
441 | } else {
442 | result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
443 | output.writeMessageBegin("checkQrCodeVerified", Thrift.MessageType.EXCEPTION, seqid);
444 | }
445 | result_obj.write(output);
446 | output.writeMessageEnd();
447 | output.flush();
448 | });
449 | }
450 | };
451 | SecondaryQrCodeLoginPermitNoticeServiceProcessor.prototype.process_checkPinCodeVerified = function(seqid, input, output) {
452 | var args = new SecondaryQrCodeLoginPermitNoticeService_checkPinCodeVerified_args();
453 | args.read(input);
454 | input.readMessageEnd();
455 | if (this._handler.checkPinCodeVerified.length === 1) {
456 | Q.fcall(this._handler.checkPinCodeVerified.bind(this._handler),
457 | args.request
458 | ).then(function(result) {
459 | var result_obj = new SecondaryQrCodeLoginPermitNoticeService_checkPinCodeVerified_result({success: result});
460 | output.writeMessageBegin("checkPinCodeVerified", Thrift.MessageType.REPLY, seqid);
461 | result_obj.write(output);
462 | output.writeMessageEnd();
463 | output.flush();
464 | }).catch(function (err) {
465 | var result;
466 | if (err instanceof SecondaryQrCodeLoginService_ttypes.SecondaryQrCodeException) {
467 | result = new SecondaryQrCodeLoginPermitNoticeService_checkPinCodeVerified_result(err);
468 | output.writeMessageBegin("checkPinCodeVerified", Thrift.MessageType.REPLY, seqid);
469 | } else {
470 | result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
471 | output.writeMessageBegin("checkPinCodeVerified", Thrift.MessageType.EXCEPTION, seqid);
472 | }
473 | result.write(output);
474 | output.writeMessageEnd();
475 | output.flush();
476 | });
477 | } else {
478 | this._handler.checkPinCodeVerified(args.request, function (err, result) {
479 | var result_obj;
480 | if ((err === null || typeof err === 'undefined') || err instanceof SecondaryQrCodeLoginService_ttypes.SecondaryQrCodeException) {
481 | result_obj = new SecondaryQrCodeLoginPermitNoticeService_checkPinCodeVerified_result((err !== null || typeof err === 'undefined') ? err : {success: result});
482 | output.writeMessageBegin("checkPinCodeVerified", Thrift.MessageType.REPLY, seqid);
483 | } else {
484 | result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
485 | output.writeMessageBegin("checkPinCodeVerified", Thrift.MessageType.EXCEPTION, seqid);
486 | }
487 | result_obj.write(output);
488 | output.writeMessageEnd();
489 | output.flush();
490 | });
491 | }
492 | };
493 |
--------------------------------------------------------------------------------
/src/CONSENT/gen-nodejs/SecondaryQrCodeLoginPermitNoticeService_types.js:
--------------------------------------------------------------------------------
1 | //
2 | // Autogenerated by Thrift Compiler (0.14.1)
3 | //
4 | // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 | //
6 | "use strict";
7 |
8 | var thrift = require('thrift');
9 | var Thrift = thrift.Thrift;
10 | var Q = thrift.Q;
11 | var Int64 = require('node-int64');
12 |
13 | var SecondaryQrCodeLoginService_ttypes = require('./SecondaryQrCodeLoginService_types');
14 |
15 |
16 | var ttypes = module.exports = {};
17 | var CheckQrCodeVerifiedResponse = module.exports.CheckQrCodeVerifiedResponse = function(args) {
18 | };
19 | CheckQrCodeVerifiedResponse.prototype = {};
20 | CheckQrCodeVerifiedResponse.prototype.read = function(input) {
21 | input.readStructBegin();
22 | while (true) {
23 | var ret = input.readFieldBegin();
24 | var ftype = ret.ftype;
25 | if (ftype == Thrift.Type.STOP) {
26 | break;
27 | }
28 | input.skip(ftype);
29 | input.readFieldEnd();
30 | }
31 | input.readStructEnd();
32 | return;
33 | };
34 |
35 | CheckQrCodeVerifiedResponse.prototype.write = function(output) {
36 | output.writeStructBegin('CheckQrCodeVerifiedResponse');
37 | output.writeFieldStop();
38 | output.writeStructEnd();
39 | return;
40 | };
41 |
42 | var CheckQrCodeVerifiedRequest = module.exports.CheckQrCodeVerifiedRequest = function(args) {
43 | this.authSessionId = null;
44 | if (args) {
45 | if (args.authSessionId !== undefined && args.authSessionId !== null) {
46 | this.authSessionId = args.authSessionId;
47 | }
48 | }
49 | };
50 | CheckQrCodeVerifiedRequest.prototype = {};
51 | CheckQrCodeVerifiedRequest.prototype.read = function(input) {
52 | input.readStructBegin();
53 | while (true) {
54 | var ret = input.readFieldBegin();
55 | var ftype = ret.ftype;
56 | var fid = ret.fid;
57 | if (ftype == Thrift.Type.STOP) {
58 | break;
59 | }
60 | switch (fid) {
61 | case 1:
62 | if (ftype == Thrift.Type.STRING) {
63 | this.authSessionId = input.readString();
64 | } else {
65 | input.skip(ftype);
66 | }
67 | break;
68 | case 0:
69 | input.skip(ftype);
70 | break;
71 | default:
72 | input.skip(ftype);
73 | }
74 | input.readFieldEnd();
75 | }
76 | input.readStructEnd();
77 | return;
78 | };
79 |
80 | CheckQrCodeVerifiedRequest.prototype.write = function(output) {
81 | output.writeStructBegin('CheckQrCodeVerifiedRequest');
82 | if (this.authSessionId !== null && this.authSessionId !== undefined) {
83 | output.writeFieldBegin('authSessionId', Thrift.Type.STRING, 1);
84 | output.writeString(this.authSessionId);
85 | output.writeFieldEnd();
86 | }
87 | output.writeFieldStop();
88 | output.writeStructEnd();
89 | return;
90 | };
91 |
92 | var CheckPinCodeVerifiedResponse = module.exports.CheckPinCodeVerifiedResponse = function(args) {
93 | };
94 | CheckPinCodeVerifiedResponse.prototype = {};
95 | CheckPinCodeVerifiedResponse.prototype.read = function(input) {
96 | input.readStructBegin();
97 | while (true) {
98 | var ret = input.readFieldBegin();
99 | var ftype = ret.ftype;
100 | if (ftype == Thrift.Type.STOP) {
101 | break;
102 | }
103 | input.skip(ftype);
104 | input.readFieldEnd();
105 | }
106 | input.readStructEnd();
107 | return;
108 | };
109 |
110 | CheckPinCodeVerifiedResponse.prototype.write = function(output) {
111 | output.writeStructBegin('CheckPinCodeVerifiedResponse');
112 | output.writeFieldStop();
113 | output.writeStructEnd();
114 | return;
115 | };
116 |
117 | var CheckPinCodeVerifiedRequest = module.exports.CheckPinCodeVerifiedRequest = function(args) {
118 | this.authSessionId = null;
119 | if (args) {
120 | if (args.authSessionId !== undefined && args.authSessionId !== null) {
121 | this.authSessionId = args.authSessionId;
122 | }
123 | }
124 | };
125 | CheckPinCodeVerifiedRequest.prototype = {};
126 | CheckPinCodeVerifiedRequest.prototype.read = function(input) {
127 | input.readStructBegin();
128 | while (true) {
129 | var ret = input.readFieldBegin();
130 | var ftype = ret.ftype;
131 | var fid = ret.fid;
132 | if (ftype == Thrift.Type.STOP) {
133 | break;
134 | }
135 | switch (fid) {
136 | case 1:
137 | if (ftype == Thrift.Type.STRING) {
138 | this.authSessionId = input.readString();
139 | } else {
140 | input.skip(ftype);
141 | }
142 | break;
143 | case 0:
144 | input.skip(ftype);
145 | break;
146 | default:
147 | input.skip(ftype);
148 | }
149 | input.readFieldEnd();
150 | }
151 | input.readStructEnd();
152 | return;
153 | };
154 |
155 | CheckPinCodeVerifiedRequest.prototype.write = function(output) {
156 | output.writeStructBegin('CheckPinCodeVerifiedRequest');
157 | if (this.authSessionId !== null && this.authSessionId !== undefined) {
158 | output.writeFieldBegin('authSessionId', Thrift.Type.STRING, 1);
159 | output.writeString(this.authSessionId);
160 | output.writeFieldEnd();
161 | }
162 | output.writeFieldStop();
163 | output.writeStructEnd();
164 | return;
165 | };
166 |
167 |
--------------------------------------------------------------------------------
/src/CONSENT/gen-nodejs/SecondaryQrCodeLoginService_types.js:
--------------------------------------------------------------------------------
1 | //
2 | // Autogenerated by Thrift Compiler (0.14.1)
3 | //
4 | // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 | //
6 | "use strict";
7 |
8 | var thrift = require('thrift');
9 | var Thrift = thrift.Thrift;
10 | var Q = thrift.Q;
11 | var Int64 = require('node-int64');
12 |
13 |
14 | var ttypes = module.exports = {};
15 | ttypes.ErrorCode = {
16 | 'INTERNAL_ERROR' : 0,
17 | 'ILLEGAL_ARGUMENT' : 1,
18 | 'VERIFICATION_FAILED' : 2,
19 | 'NOT_ALLOWED_QR_CODE_LOGIN' : 3,
20 | 'VERIFICATION_NOTICE_FAILED' : 4,
21 | 'RETRY_LATER' : 5,
22 | 'INVALID_CONTEXT' : 100,
23 | 'APP_UPGRADE_REQUIRED' : 101
24 | };
25 | var SecondaryQrCodeException = module.exports.SecondaryQrCodeException = function(args) {
26 | Thrift.TException.call(this, "SecondaryQrCodeException");
27 | this.name = "SecondaryQrCodeException";
28 | this.code = null;
29 | this.alertMessage = null;
30 | if (args) {
31 | if (args.code !== undefined && args.code !== null) {
32 | this.code = args.code;
33 | }
34 | if (args.alertMessage !== undefined && args.alertMessage !== null) {
35 | this.alertMessage = args.alertMessage;
36 | }
37 | }
38 | };
39 | Thrift.inherits(SecondaryQrCodeException, Thrift.TException);
40 | SecondaryQrCodeException.prototype.name = 'SecondaryQrCodeException';
41 | SecondaryQrCodeException.prototype.read = function(input) {
42 | input.readStructBegin();
43 | while (true) {
44 | var ret = input.readFieldBegin();
45 | var ftype = ret.ftype;
46 | var fid = ret.fid;
47 | if (ftype == Thrift.Type.STOP) {
48 | break;
49 | }
50 | switch (fid) {
51 | case 1:
52 | if (ftype == Thrift.Type.I32) {
53 | this.code = input.readI32();
54 | } else {
55 | input.skip(ftype);
56 | }
57 | break;
58 | case 2:
59 | if (ftype == Thrift.Type.STRING) {
60 | this.alertMessage = input.readString();
61 | } else {
62 | input.skip(ftype);
63 | }
64 | break;
65 | default:
66 | input.skip(ftype);
67 | }
68 | input.readFieldEnd();
69 | }
70 | input.readStructEnd();
71 | return;
72 | };
73 |
74 | SecondaryQrCodeException.prototype.write = function(output) {
75 | output.writeStructBegin('SecondaryQrCodeException');
76 | if (this.code !== null && this.code !== undefined) {
77 | output.writeFieldBegin('code', Thrift.Type.I32, 1);
78 | output.writeI32(this.code);
79 | output.writeFieldEnd();
80 | }
81 | if (this.alertMessage !== null && this.alertMessage !== undefined) {
82 | output.writeFieldBegin('alertMessage', Thrift.Type.STRING, 2);
83 | output.writeString(this.alertMessage);
84 | output.writeFieldEnd();
85 | }
86 | output.writeFieldStop();
87 | output.writeStructEnd();
88 | return;
89 | };
90 |
91 | var CreateQrSessionResponse = module.exports.CreateQrSessionResponse = function(args) {
92 | this.authSessionId = null;
93 | if (args) {
94 | if (args.authSessionId !== undefined && args.authSessionId !== null) {
95 | this.authSessionId = args.authSessionId;
96 | }
97 | }
98 | };
99 | CreateQrSessionResponse.prototype = {};
100 | CreateQrSessionResponse.prototype.read = function(input) {
101 | input.readStructBegin();
102 | while (true) {
103 | var ret = input.readFieldBegin();
104 | var ftype = ret.ftype;
105 | var fid = ret.fid;
106 | if (ftype == Thrift.Type.STOP) {
107 | break;
108 | }
109 | switch (fid) {
110 | case 1:
111 | if (ftype == Thrift.Type.STRING) {
112 | this.authSessionId = input.readString();
113 | } else {
114 | input.skip(ftype);
115 | }
116 | break;
117 | case 0:
118 | input.skip(ftype);
119 | break;
120 | default:
121 | input.skip(ftype);
122 | }
123 | input.readFieldEnd();
124 | }
125 | input.readStructEnd();
126 | return;
127 | };
128 |
129 | CreateQrSessionResponse.prototype.write = function(output) {
130 | output.writeStructBegin('CreateQrSessionResponse');
131 | if (this.authSessionId !== null && this.authSessionId !== undefined) {
132 | output.writeFieldBegin('authSessionId', Thrift.Type.STRING, 1);
133 | output.writeString(this.authSessionId);
134 | output.writeFieldEnd();
135 | }
136 | output.writeFieldStop();
137 | output.writeStructEnd();
138 | return;
139 | };
140 |
141 | var CreateQrSessionRequest = module.exports.CreateQrSessionRequest = function(args) {
142 | };
143 | CreateQrSessionRequest.prototype = {};
144 | CreateQrSessionRequest.prototype.read = function(input) {
145 | input.readStructBegin();
146 | while (true) {
147 | var ret = input.readFieldBegin();
148 | var ftype = ret.ftype;
149 | if (ftype == Thrift.Type.STOP) {
150 | break;
151 | }
152 | input.skip(ftype);
153 | input.readFieldEnd();
154 | }
155 | input.readStructEnd();
156 | return;
157 | };
158 |
159 | CreateQrSessionRequest.prototype.write = function(output) {
160 | output.writeStructBegin('CreateQrSessionRequest');
161 | output.writeFieldStop();
162 | output.writeStructEnd();
163 | return;
164 | };
165 |
166 | var CreateQrCodeResponse = module.exports.CreateQrCodeResponse = function(args) {
167 | this.callbackUrl = null;
168 | if (args) {
169 | if (args.callbackUrl !== undefined && args.callbackUrl !== null) {
170 | this.callbackUrl = args.callbackUrl;
171 | }
172 | }
173 | };
174 | CreateQrCodeResponse.prototype = {};
175 | CreateQrCodeResponse.prototype.read = function(input) {
176 | input.readStructBegin();
177 | while (true) {
178 | var ret = input.readFieldBegin();
179 | var ftype = ret.ftype;
180 | var fid = ret.fid;
181 | if (ftype == Thrift.Type.STOP) {
182 | break;
183 | }
184 | switch (fid) {
185 | case 1:
186 | if (ftype == Thrift.Type.STRING) {
187 | this.callbackUrl = input.readString();
188 | } else {
189 | input.skip(ftype);
190 | }
191 | break;
192 | case 0:
193 | input.skip(ftype);
194 | break;
195 | default:
196 | input.skip(ftype);
197 | }
198 | input.readFieldEnd();
199 | }
200 | input.readStructEnd();
201 | return;
202 | };
203 |
204 | CreateQrCodeResponse.prototype.write = function(output) {
205 | output.writeStructBegin('CreateQrCodeResponse');
206 | if (this.callbackUrl !== null && this.callbackUrl !== undefined) {
207 | output.writeFieldBegin('callbackUrl', Thrift.Type.STRING, 1);
208 | output.writeString(this.callbackUrl);
209 | output.writeFieldEnd();
210 | }
211 | output.writeFieldStop();
212 | output.writeStructEnd();
213 | return;
214 | };
215 |
216 | var CreateQrCodeRequest = module.exports.CreateQrCodeRequest = function(args) {
217 | this.authSessionId = null;
218 | if (args) {
219 | if (args.authSessionId !== undefined && args.authSessionId !== null) {
220 | this.authSessionId = args.authSessionId;
221 | }
222 | }
223 | };
224 | CreateQrCodeRequest.prototype = {};
225 | CreateQrCodeRequest.prototype.read = function(input) {
226 | input.readStructBegin();
227 | while (true) {
228 | var ret = input.readFieldBegin();
229 | var ftype = ret.ftype;
230 | var fid = ret.fid;
231 | if (ftype == Thrift.Type.STOP) {
232 | break;
233 | }
234 | switch (fid) {
235 | case 1:
236 | if (ftype == Thrift.Type.STRING) {
237 | this.authSessionId = input.readString();
238 | } else {
239 | input.skip(ftype);
240 | }
241 | break;
242 | case 0:
243 | input.skip(ftype);
244 | break;
245 | default:
246 | input.skip(ftype);
247 | }
248 | input.readFieldEnd();
249 | }
250 | input.readStructEnd();
251 | return;
252 | };
253 |
254 | CreateQrCodeRequest.prototype.write = function(output) {
255 | output.writeStructBegin('CreateQrCodeRequest');
256 | if (this.authSessionId !== null && this.authSessionId !== undefined) {
257 | output.writeFieldBegin('authSessionId', Thrift.Type.STRING, 1);
258 | output.writeString(this.authSessionId);
259 | output.writeFieldEnd();
260 | }
261 | output.writeFieldStop();
262 | output.writeStructEnd();
263 | return;
264 | };
265 |
266 | var CreatePinCodeResponse = module.exports.CreatePinCodeResponse = function(args) {
267 | this.pinCode = null;
268 | if (args) {
269 | if (args.pinCode !== undefined && args.pinCode !== null) {
270 | this.pinCode = args.pinCode;
271 | }
272 | }
273 | };
274 | CreatePinCodeResponse.prototype = {};
275 | CreatePinCodeResponse.prototype.read = function(input) {
276 | input.readStructBegin();
277 | while (true) {
278 | var ret = input.readFieldBegin();
279 | var ftype = ret.ftype;
280 | var fid = ret.fid;
281 | if (ftype == Thrift.Type.STOP) {
282 | break;
283 | }
284 | switch (fid) {
285 | case 1:
286 | if (ftype == Thrift.Type.STRING) {
287 | this.pinCode = input.readString();
288 | } else {
289 | input.skip(ftype);
290 | }
291 | break;
292 | case 0:
293 | input.skip(ftype);
294 | break;
295 | default:
296 | input.skip(ftype);
297 | }
298 | input.readFieldEnd();
299 | }
300 | input.readStructEnd();
301 | return;
302 | };
303 |
304 | CreatePinCodeResponse.prototype.write = function(output) {
305 | output.writeStructBegin('CreatePinCodeResponse');
306 | if (this.pinCode !== null && this.pinCode !== undefined) {
307 | output.writeFieldBegin('pinCode', Thrift.Type.STRING, 1);
308 | output.writeString(this.pinCode);
309 | output.writeFieldEnd();
310 | }
311 | output.writeFieldStop();
312 | output.writeStructEnd();
313 | return;
314 | };
315 |
316 | var CreatePinCodeRequest = module.exports.CreatePinCodeRequest = function(args) {
317 | this.authSessionId = null;
318 | if (args) {
319 | if (args.authSessionId !== undefined && args.authSessionId !== null) {
320 | this.authSessionId = args.authSessionId;
321 | }
322 | }
323 | };
324 | CreatePinCodeRequest.prototype = {};
325 | CreatePinCodeRequest.prototype.read = function(input) {
326 | input.readStructBegin();
327 | while (true) {
328 | var ret = input.readFieldBegin();
329 | var ftype = ret.ftype;
330 | var fid = ret.fid;
331 | if (ftype == Thrift.Type.STOP) {
332 | break;
333 | }
334 | switch (fid) {
335 | case 1:
336 | if (ftype == Thrift.Type.STRING) {
337 | this.authSessionId = input.readString();
338 | } else {
339 | input.skip(ftype);
340 | }
341 | break;
342 | case 0:
343 | input.skip(ftype);
344 | break;
345 | default:
346 | input.skip(ftype);
347 | }
348 | input.readFieldEnd();
349 | }
350 | input.readStructEnd();
351 | return;
352 | };
353 |
354 | CreatePinCodeRequest.prototype.write = function(output) {
355 | output.writeStructBegin('CreatePinCodeRequest');
356 | if (this.authSessionId !== null && this.authSessionId !== undefined) {
357 | output.writeFieldBegin('authSessionId', Thrift.Type.STRING, 1);
358 | output.writeString(this.authSessionId);
359 | output.writeFieldEnd();
360 | }
361 | output.writeFieldStop();
362 | output.writeStructEnd();
363 | return;
364 | };
365 |
366 | var VerifyCertificateResponse = module.exports.VerifyCertificateResponse = function(args) {
367 | };
368 | VerifyCertificateResponse.prototype = {};
369 | VerifyCertificateResponse.prototype.read = function(input) {
370 | input.readStructBegin();
371 | while (true) {
372 | var ret = input.readFieldBegin();
373 | var ftype = ret.ftype;
374 | if (ftype == Thrift.Type.STOP) {
375 | break;
376 | }
377 | input.skip(ftype);
378 | input.readFieldEnd();
379 | }
380 | input.readStructEnd();
381 | return;
382 | };
383 |
384 | VerifyCertificateResponse.prototype.write = function(output) {
385 | output.writeStructBegin('VerifyCertificateResponse');
386 | output.writeFieldStop();
387 | output.writeStructEnd();
388 | return;
389 | };
390 |
391 | var VerifyCertificateRequest = module.exports.VerifyCertificateRequest = function(args) {
392 | this.authSessionId = null;
393 | this.certificate = null;
394 | if (args) {
395 | if (args.authSessionId !== undefined && args.authSessionId !== null) {
396 | this.authSessionId = args.authSessionId;
397 | }
398 | if (args.certificate !== undefined && args.certificate !== null) {
399 | this.certificate = args.certificate;
400 | }
401 | }
402 | };
403 | VerifyCertificateRequest.prototype = {};
404 | VerifyCertificateRequest.prototype.read = function(input) {
405 | input.readStructBegin();
406 | while (true) {
407 | var ret = input.readFieldBegin();
408 | var ftype = ret.ftype;
409 | var fid = ret.fid;
410 | if (ftype == Thrift.Type.STOP) {
411 | break;
412 | }
413 | switch (fid) {
414 | case 1:
415 | if (ftype == Thrift.Type.STRING) {
416 | this.authSessionId = input.readString();
417 | } else {
418 | input.skip(ftype);
419 | }
420 | break;
421 | case 2:
422 | if (ftype == Thrift.Type.STRING) {
423 | this.certificate = input.readString();
424 | } else {
425 | input.skip(ftype);
426 | }
427 | break;
428 | default:
429 | input.skip(ftype);
430 | }
431 | input.readFieldEnd();
432 | }
433 | input.readStructEnd();
434 | return;
435 | };
436 |
437 | VerifyCertificateRequest.prototype.write = function(output) {
438 | output.writeStructBegin('VerifyCertificateRequest');
439 | if (this.authSessionId !== null && this.authSessionId !== undefined) {
440 | output.writeFieldBegin('authSessionId', Thrift.Type.STRING, 1);
441 | output.writeString(this.authSessionId);
442 | output.writeFieldEnd();
443 | }
444 | if (this.certificate !== null && this.certificate !== undefined) {
445 | output.writeFieldBegin('certificate', Thrift.Type.STRING, 2);
446 | output.writeString(this.certificate);
447 | output.writeFieldEnd();
448 | }
449 | output.writeFieldStop();
450 | output.writeStructEnd();
451 | return;
452 | };
453 |
454 | var QrCodeLoginResponse = module.exports.QrCodeLoginResponse = function(args) {
455 | this.certificate = null;
456 | this.accessToken = null;
457 | this.lastBindTimestamp = null;
458 | this.metaData = null;
459 | if (args) {
460 | if (args.certificate !== undefined && args.certificate !== null) {
461 | this.certificate = args.certificate;
462 | }
463 | if (args.accessToken !== undefined && args.accessToken !== null) {
464 | this.accessToken = args.accessToken;
465 | }
466 | if (args.lastBindTimestamp !== undefined && args.lastBindTimestamp !== null) {
467 | this.lastBindTimestamp = args.lastBindTimestamp;
468 | }
469 | if (args.metaData !== undefined && args.metaData !== null) {
470 | this.metaData = Thrift.copyMap(args.metaData, [null]);
471 | }
472 | }
473 | };
474 | QrCodeLoginResponse.prototype = {};
475 | QrCodeLoginResponse.prototype.read = function(input) {
476 | input.readStructBegin();
477 | while (true) {
478 | var ret = input.readFieldBegin();
479 | var ftype = ret.ftype;
480 | var fid = ret.fid;
481 | if (ftype == Thrift.Type.STOP) {
482 | break;
483 | }
484 | switch (fid) {
485 | case 1:
486 | if (ftype == Thrift.Type.STRING) {
487 | this.certificate = input.readString();
488 | } else {
489 | input.skip(ftype);
490 | }
491 | break;
492 | case 2:
493 | if (ftype == Thrift.Type.STRING) {
494 | this.accessToken = input.readString();
495 | } else {
496 | input.skip(ftype);
497 | }
498 | break;
499 | case 3:
500 | if (ftype == Thrift.Type.I64) {
501 | this.lastBindTimestamp = input.readI64();
502 | } else {
503 | input.skip(ftype);
504 | }
505 | break;
506 | case 4:
507 | if (ftype == Thrift.Type.MAP) {
508 | this.metaData = {};
509 | var _rtmp31 = input.readMapBegin();
510 | var _size0 = _rtmp31.size || 0;
511 | for (var _i2 = 0; _i2 < _size0; ++_i2) {
512 | var key3 = null;
513 | var val4 = null;
514 | key3 = input.readString();
515 | val4 = input.readString();
516 | this.metaData[key3] = val4;
517 | }
518 | input.readMapEnd();
519 | } else {
520 | input.skip(ftype);
521 | }
522 | break;
523 | default:
524 | input.skip(ftype);
525 | }
526 | input.readFieldEnd();
527 | }
528 | input.readStructEnd();
529 | return;
530 | };
531 |
532 | QrCodeLoginResponse.prototype.write = function(output) {
533 | output.writeStructBegin('QrCodeLoginResponse');
534 | if (this.certificate !== null && this.certificate !== undefined) {
535 | output.writeFieldBegin('certificate', Thrift.Type.STRING, 1);
536 | output.writeString(this.certificate);
537 | output.writeFieldEnd();
538 | }
539 | if (this.accessToken !== null && this.accessToken !== undefined) {
540 | output.writeFieldBegin('accessToken', Thrift.Type.STRING, 2);
541 | output.writeString(this.accessToken);
542 | output.writeFieldEnd();
543 | }
544 | if (this.lastBindTimestamp !== null && this.lastBindTimestamp !== undefined) {
545 | output.writeFieldBegin('lastBindTimestamp', Thrift.Type.I64, 3);
546 | output.writeI64(this.lastBindTimestamp);
547 | output.writeFieldEnd();
548 | }
549 | if (this.metaData !== null && this.metaData !== undefined) {
550 | output.writeFieldBegin('metaData', Thrift.Type.MAP, 4);
551 | output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.STRING, Thrift.objectLength(this.metaData));
552 | for (var kiter5 in this.metaData) {
553 | if (this.metaData.hasOwnProperty(kiter5)) {
554 | var viter6 = this.metaData[kiter5];
555 | output.writeString(kiter5);
556 | output.writeString(viter6);
557 | }
558 | }
559 | output.writeMapEnd();
560 | output.writeFieldEnd();
561 | }
562 | output.writeFieldStop();
563 | output.writeStructEnd();
564 | return;
565 | };
566 |
567 | var QrCodeLoginRequest = module.exports.QrCodeLoginRequest = function(args) {
568 | this.authSessionId = null;
569 | this.systemName = null;
570 | this.autoLoginIsRequired = null;
571 | if (args) {
572 | if (args.authSessionId !== undefined && args.authSessionId !== null) {
573 | this.authSessionId = args.authSessionId;
574 | }
575 | if (args.systemName !== undefined && args.systemName !== null) {
576 | this.systemName = args.systemName;
577 | }
578 | if (args.autoLoginIsRequired !== undefined && args.autoLoginIsRequired !== null) {
579 | this.autoLoginIsRequired = args.autoLoginIsRequired;
580 | }
581 | }
582 | };
583 | QrCodeLoginRequest.prototype = {};
584 | QrCodeLoginRequest.prototype.read = function(input) {
585 | input.readStructBegin();
586 | while (true) {
587 | var ret = input.readFieldBegin();
588 | var ftype = ret.ftype;
589 | var fid = ret.fid;
590 | if (ftype == Thrift.Type.STOP) {
591 | break;
592 | }
593 | switch (fid) {
594 | case 1:
595 | if (ftype == Thrift.Type.STRING) {
596 | this.authSessionId = input.readString();
597 | } else {
598 | input.skip(ftype);
599 | }
600 | break;
601 | case 2:
602 | if (ftype == Thrift.Type.STRING) {
603 | this.systemName = input.readString();
604 | } else {
605 | input.skip(ftype);
606 | }
607 | break;
608 | case 3:
609 | if (ftype == Thrift.Type.BOOL) {
610 | this.autoLoginIsRequired = input.readBool();
611 | } else {
612 | input.skip(ftype);
613 | }
614 | break;
615 | default:
616 | input.skip(ftype);
617 | }
618 | input.readFieldEnd();
619 | }
620 | input.readStructEnd();
621 | return;
622 | };
623 |
624 | QrCodeLoginRequest.prototype.write = function(output) {
625 | output.writeStructBegin('QrCodeLoginRequest');
626 | if (this.authSessionId !== null && this.authSessionId !== undefined) {
627 | output.writeFieldBegin('authSessionId', Thrift.Type.STRING, 1);
628 | output.writeString(this.authSessionId);
629 | output.writeFieldEnd();
630 | }
631 | if (this.systemName !== null && this.systemName !== undefined) {
632 | output.writeFieldBegin('systemName', Thrift.Type.STRING, 2);
633 | output.writeString(this.systemName);
634 | output.writeFieldEnd();
635 | }
636 | if (this.autoLoginIsRequired !== null && this.autoLoginIsRequired !== undefined) {
637 | output.writeFieldBegin('autoLoginIsRequired', Thrift.Type.BOOL, 3);
638 | output.writeBool(this.autoLoginIsRequired);
639 | output.writeFieldEnd();
640 | }
641 | output.writeFieldStop();
642 | output.writeStructEnd();
643 | return;
644 | };
645 |
646 |
--------------------------------------------------------------------------------
/src/CONSENT/index.js:
--------------------------------------------------------------------------------
1 |
2 | const TalkService_types = require("./gen-nodejs/TalkService_types")
3 |
4 |
5 | module.exports = {
6 | line_server: {
7 | HOST:"ga2.line.naver.jp",
8 | CDN_PATH: "https://obs-sg.line-apps.com",
9 | SEND_PATH: "/S4",
10 | RECEIVE_PATH: "/P4"
11 | },
12 | thrift: {
13 | TalkService: require("./gen-nodejs/TalkService"),
14 | TalkService_types: TalkService_types,
15 |
16 | AuthService: require("./gen-nodejs/AuthService"),
17 | AuthService_types: require("./gen-nodejs/AuthService_types"),
18 |
19 | SecondaryQrCodeLogin: require("./gen-nodejs/SecondaryQrCodeLoginService"),
20 | SecondaryQrCodeLogin_types: require("./gen-nodejs/SecondaryQrCodeLoginService_types"),
21 |
22 | SecondaryQrCodeLoginPermitNoticeService: require("./gen-nodejs/SecondaryQrCodeLoginPermitNoticeService"),
23 | SecondaryQrCodeLoginPermitNoticeService_types: require("./gen-nodejs/SecondaryQrCodeLoginPermitNoticeService_types")
24 | },
25 | message: {
26 | mention: {
27 | regex: /<@[a-z0-9]+>/,
28 | offset_start: 2,
29 | offset_end: 1,
30 |
31 | toString: (id) => `<@${id}>`,
32 | replace: () => `@chelos`
33 | }
34 | },
35 | headers: {
36 | "android_lite": {
37 | "user-agent": "LLA/2.12.0 SKR-H0 9",
38 | "x-line-application": "ANDROIDLITE\t2.12.0\tAndroid OS\t9;SECONDARY"
39 | },
40 | "android": {
41 | "user-agent": "Line/10.6.2",
42 | "x-line-application": "ANDROID\t10.6.2\tAndroid OS\t10"
43 | },
44 | "ios_ipad": {
45 | "user-Agent": "Line/10.1.1",
46 | "x-line-application": "IOSIPAD\t10.1.1\tiPhone 8\t11.2.5"
47 | },
48 | "ios": {
49 | "user-agent": "Line/10.1.1",
50 | "x-line-application": "IOS\t10.1.1\tiPhone 8\t11.2.5"
51 | },
52 | "chrome": {
53 | "user-agent": "MozilX-Line-Application/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36",
54 | "x-line-application": "CHROMEOS\t2.3.2\tChrome OS\t1"
55 | },
56 | "desktopwin": {
57 | "user-agent": "Line/6.7.3",
58 | "x-line-application": "DESKTOPWIN\t6.7.3\tWindows\t10"
59 | },
60 | "desktopmac": {
61 | "user-agent": "Line/6.7.3",
62 | "x-line-application": "DESKTOPMAC\t6.7.3\tMAC\t10.15"
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/src/Client/Client.js:
--------------------------------------------------------------------------------
1 | const events = require("events")
2 |
3 | const { OpType } = require("../CONSENT/gen-nodejs/TalkService_types");
4 | const login_user_pass = require("./auth/login_user_pass");
5 | const CONSENT = require("../CONSENT");
6 | const login_qr = require("./auth/login_qr");
7 |
8 | const Client_User = require("../structures/User/Client_User");
9 |
10 | const ChannelManager = require("../Managers/ChannelManager");
11 | const UserManager = require("../Managers/UserManager");
12 | const GroupChannelManager = require("../Managers/GroupChannelManager");
13 |
14 | const Thrift_Manager = require("./thrift/Thrift_Manager");
15 | const { string_of_enum } = require("../util/Util");
16 |
17 | class Client extends events {
18 | constructor(options={}){
19 | super()
20 | if(!options.keepalive) options.keepalive = 1000*100
21 | if(!options.debug) options.debug = false
22 | this.options = options
23 |
24 | this.debug = options.debug
25 | this.token = null;
26 | this.transport = new Thrift_Manager(this);
27 | this.users = new UserManager(this)
28 | this.channels = new ChannelManager(this)
29 | this.groups = new GroupChannelManager(this)
30 | this.intervals = [];
31 |
32 | this._destroy = false
33 | this.localRev = -1
34 | this.globalRev = 0
35 | this.individualRev = 0
36 | }
37 | get api(){
38 | return this.transport.api
39 | }
40 | async login_qr(){
41 | return (await login_qr()).accessToken
42 | }
43 | async login(username,password){
44 | if (!username && !password) {
45 | try {
46 | return this.login(await this.login_qr())
47 | } catch (error) {
48 | throw new Error("LOGIN_QR_FAIL")
49 | }
50 | } else if(username&&!password){//maybe token?
51 | this.token = username
52 |
53 | await this.init_session()
54 |
55 | return this
56 | } else if(username&&password){
57 | let token = await this.login_user_pass(username,password)
58 | if(!token) throw new Error("EMAIL_OR_PASSWORD_INVALID")
59 | this.token = token
60 | await this.init_session()
61 |
62 | return this
63 | }
64 | return this;
65 | }
66 | async login_user_pass(username,password){
67 | return login_user_pass(username,password)
68 | }
69 | async init_session(){
70 | await this.transport.connect({
71 | host: CONSENT.line_server.HOST,
72 | headers: CONSENT.headers["desktopwin"],
73 | SEND_PATH: CONSENT.line_server.SEND_PATH,
74 | RECEIVE_PATH: CONSENT.line_server.RECEIVE_PATH,
75 | service: CONSENT.thrift.TalkService
76 | });
77 | this.user = await new Client_User(this).fetch()
78 | await Promise.all([this.users.fetch(),this.groups.fetch()])
79 | this.intervals.push(setInterval(() => {
80 | this.api.sendMessage(0,{
81 | _from: this.user.id,
82 | to: this.user.id,
83 | text: 'node-linejs(chanios) keepalive'
84 | })
85 | }, this.options.keepalive))
86 | this.polling()
87 | this.emit("ready")
88 | }
89 | async polling(){
90 | while (true) {
91 | if(this._destroy) break;
92 | await this.poll()
93 | }
94 | }
95 | async poll(){
96 | let ops = await this.transport._receive._client.fetchOps(this.localRev,10,this.globalRev,this.individualRev)
97 | for (let i = 0; i < ops.length; i++) {
98 | let op = ops[i]
99 | if(op.revision == -1 && op.param2){
100 | this.globalRev = parseInt(op.param2.split("\x1e")[0])
101 | }
102 | if(op.revision == -1 && op.param1){
103 | this.individualRev = parseInt(op.param1.split("\x1e")[0])
104 | }
105 | if(this.localRev>=op.revision) return
106 | this.localRev = Math.max(op.revision, this.localRev)
107 | let optype = string_of_enum(OpType,op.type)
108 | try {
109 | this.emit('raw',optype,op)
110 | require("./actions/"+optype)(this, op);
111 | } catch (error) {
112 | if(this.debug) console.log(`OP ${optype} Not Found`,error,op)
113 | }
114 | }
115 | }
116 | async destroy(){
117 | //TODO: Close this.transpot
118 | this._destroy = true
119 | this.transpot.destroy()
120 | this.intervals.forEach(_=>clearInterval(_))
121 | }
122 | }
123 | module.exports = Client
--------------------------------------------------------------------------------
/src/Client/actions/-INVITE_INTO_CHAT.js:
--------------------------------------------------------------------------------
1 | const Client = require("../Client")
2 |
3 | /**
4 | *
5 | * @param {Client} client
6 | * @param {any} op
7 | */
8 | module.exports = async(client, op) =>{
9 | /*
10 | let where = op.param1;
11 | let executer = op.param2;
12 |
13 | let invite = client.invites.add({
14 | id: where,
15 | createdTime: op.createdTime
16 | },true,{
17 | id: where
18 | })*/
19 | client.emit("invite_other",op)
20 | }
--------------------------------------------------------------------------------
/src/Client/actions/-SEND_MESSAGE.js:
--------------------------------------------------------------------------------
1 | const Client = require("../Client")
2 |
3 | /**
4 | *
5 | * @param {Client} client
6 | * @param {any} op
7 | */
8 | module.exports = async(client, op) =>{
9 | let channel = client.channels.cache.get(op.message.to)
10 | if (channel && channel.messages) {
11 | client.emit("message",channel.messages.add(op.message,true,{
12 | id: op.message.id
13 | }))
14 | }
15 | }
--------------------------------------------------------------------------------
/src/Client/actions/ACCEPT_CHAT_INVITATION.js:
--------------------------------------------------------------------------------
1 | const Client = require("../Client")
2 |
3 | /**
4 | *
5 | * @param {Client} client
6 | * @param {any} op
7 | */
8 | module.exports = async(client, op) =>{
9 | let where = op.param1;
10 | let group = await client.groups.cache.get(where)
11 |
12 | if(group) {
13 | let invite_member = group.invites.cache.get(client.user.id)
14 | if(invite_member) {
15 | group.members.add(invite_member,true,{
16 | id: client.user.id
17 | })
18 | group.invites.cache.delete(client.user.id)
19 | }
20 | client.emit("chat_join",group)
21 | }
22 | }
--------------------------------------------------------------------------------
/src/Client/actions/CREATE_CHAT.js:
--------------------------------------------------------------------------------
1 | module.exports = ()=>{
2 | //do noting
3 | }
--------------------------------------------------------------------------------
/src/Client/actions/DELETE_OTHER_FROM_CHAT.js:
--------------------------------------------------------------------------------
1 | const Client = require("../Client")
2 |
3 | /**
4 | *
5 | * @param {Client} client
6 | * @param {any} op
7 | */
8 | module.exports = async(client, op) =>{
9 | let where = op.param1;
10 | let deleter = op.param2;
11 | let target = op.param3;
12 | let group = client.groups.cache.get(where)
13 | if(group) {
14 | let member = group.members.cache.get(target)
15 | if(member) {
16 | group.members.cache.delete(target)
17 | client.emit("chat_member_remove",member,group.members.cache.get(deleter))
18 | }
19 | }
20 |
21 | }
--------------------------------------------------------------------------------
/src/Client/actions/DELETE_SELF_FROM_CHAT.js:
--------------------------------------------------------------------------------
1 | const Client = require("../Client")
2 |
3 | /**
4 | *
5 | * @param {Client} client
6 | * @param {any} op
7 | */
8 | module.exports = async(client, op) =>{
9 | let where = op.param1;
10 | let channel = client.groups.cache.get(where)
11 |
12 | if(channel) {
13 | client.groups.cache.delete(where)
14 | client.emit("chat_leave",channel)
15 | }
16 | }
--------------------------------------------------------------------------------
/src/Client/actions/DESTROY_MESSAGE.js:
--------------------------------------------------------------------------------
1 | const Client = require("../Client")
2 |
3 | /**
4 | *
5 | * @param {Client} client
6 | * @param {any} op
7 | */
8 | module.exports = async(client, op) =>{
9 | let channel = client.channels.cache.get(op.param1)
10 | let message_id = op.param2
11 | if (channel && channel.messages) {
12 | let message = channel.messages.cache.get(message_id)
13 | if(message) {
14 | channel.messages.cache.delete(message_id)
15 | client.emit('message_unsend',message)
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/Client/actions/DUMMY.js:
--------------------------------------------------------------------------------
1 | module.exports = (client, op) =>{
2 | //do noting
3 | }
--------------------------------------------------------------------------------
/src/Client/actions/END_OF_OPERATION.js:
--------------------------------------------------------------------------------
1 | module.exports = (client, op) =>{
2 | //do noting
3 | }
--------------------------------------------------------------------------------
/src/Client/actions/INVITE_INTO_CHAT.js:
--------------------------------------------------------------------------------
1 | const Client = require("../Client")
2 | /**
3 | *
4 | * @param {Client} client
5 | * @param {any} op
6 | */
7 | module.exports = async(client, op) =>{
8 | let where = op.param1;
9 | let executer = op.param2;
10 | let target = op.param3;
11 |
12 | if(target == client.user.id) {
13 | let group = await client.groups.cache.get(where)
14 | if(group) {
15 | let group = await client.groups.cache.get(where)
16 | let member = group.invites.add({
17 | id: executer
18 | },true,{
19 | id: executer
20 | })
21 | await member.fetch()
22 | client.emit("chat_invite_other",member,group.me)
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/src/Client/actions/NOTIFIED_ACCEPT_CHAT_INVITATION.js:
--------------------------------------------------------------------------------
1 | const Client = require("../Client")
2 |
3 | /**
4 | *
5 | * @param {Client} client
6 | * @param {any} op
7 | */
8 | module.exports = async(client, op) =>{
9 | let where = op.param1;
10 | let executer = op.param2;
11 |
12 | let group = client.groups.cache.get(where)
13 | if(group) {
14 | group.invites.cache.delete(executer)
15 | client.emit("chat_invite_accept",group,client.users.cache.get(executer))
16 | }
17 | }
--------------------------------------------------------------------------------
/src/Client/actions/NOTIFIED_CANCEL_CHAT_INVITATION.js:
--------------------------------------------------------------------------------
1 | const Client = require("../Client")
2 |
3 | /**
4 | *
5 | * @param {Client} client
6 | * @param {any} op
7 | */
8 | module.exports = async(client, op) =>{
9 | let where = op.param1;
10 | let executer = op.param2;
11 |
12 | let invite = client.invites.cache.get(where)
13 | if(invite) {
14 | client.emit("chat_invite_cancel",invite,client.users.cache.get(executer))
15 | client.invites.cache.delete(where)
16 | }
17 | }
--------------------------------------------------------------------------------
/src/Client/actions/NOTIFIED_DELETE_SELF_FROM_CHAT.js:
--------------------------------------------------------------------------------
1 | const Client = require("../Client")
2 |
3 | /**
4 | *
5 | * @param {Client} client
6 | * @param {any} op
7 | */
8 | module.exports = async(client, op) =>{
9 | let where = op.param1;
10 | let group = await client.groups.cache.get(where)
11 |
12 | if(group) {
13 | let member = group.members.cache.get(op.param2)
14 | if(member) {
15 | group.members.cache.delete(op.param2)
16 | client.emit("chat_member_remove",member)
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/src/Client/actions/NOTIFIED_INVITE_INTO_CHAT.js:
--------------------------------------------------------------------------------
1 | const Client = require("../Client")
2 | /**
3 | *
4 | * @param {Client} client
5 | * @param {any} op
6 | */
7 | module.exports = async(client, op) =>{
8 | let where = op.param1;
9 | let executer = op.param2;
10 | let target = op.param3;
11 |
12 | if(target == client.user.id) {
13 | let group = await client.groups.fetch(where)
14 | if(group) {
15 | let inviter = client.users.cache.get(executer)
16 | client.emit("chat_invite",group,inviter)
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/src/Client/actions/NOTIFIED_JOIN_CHAT.js:
--------------------------------------------------------------------------------
1 | const Client = require("../Client")
2 |
3 | /**
4 | *
5 | * @param {Client} client
6 | * @param {any} op
7 | */
8 | module.exports = async(client, op) =>{
9 | let where = op.param1;
10 | let group = await client.groups.cache.get(where)
11 |
12 | if(group) {
13 | let member = group.members.add({
14 | id: op.param2
15 | },true,{
16 | id: op.param2
17 | })
18 | await member.fetch()
19 | client.emit("chat_member_add",member)
20 | }
21 | }
--------------------------------------------------------------------------------
/src/Client/actions/NOTIFIED_LEAVE_CHAT.js:
--------------------------------------------------------------------------------
1 | const Client = require("../Client")
2 |
3 | /**
4 | *
5 | * @param {Client} client
6 | * @param {any} op
7 | */
8 | module.exports = async(client, op) =>{
9 | let where = op.param1;
10 | let group = await client.groups.cache.get(where)
11 |
12 | if(group) {
13 | let member = group.members.cache.get(op.param2)
14 | if(member) {
15 | group.members.cache.delete(op.param2)
16 | client.emit("chat_member_remove",member)
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Client/actions/NOTIFIED_READ_MESSAGE.js:
--------------------------------------------------------------------------------
1 | const Client = require("../Client")
2 | const { string_of_enum } = require("../../util/Util")
3 |
4 | /**
5 | *
6 | * @param {Client} client
7 | * @param {any} op
8 | */
9 |
10 | module.exports = async(client, op) =>{
11 | let where = op.param1
12 |
13 | let channel = client.channels.cache.get(where) || client.groups.cache.get(where)
14 | if (channel && channel.messages) {
15 | let message = channel.messages.add({
16 | to: where,
17 | id: op.param3
18 | },true,{
19 | id: op.param3
20 | })
21 | if(message) {
22 | let user = client.users.cache.get(op.param2)
23 | client.emit("message_read",message, user)
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/src/Client/actions/NOTIFIED_RECEIVED_CALL.js:
--------------------------------------------------------------------------------
1 | const Client = require("../Client")
2 |
3 | /**
4 | *
5 | * @param {Client} client
6 | * @param {any} op
7 | */
8 | module.exports = async(client, op) =>{
9 | let channel = client.channels.cache.get(op.param1)
10 | if (channel) {
11 | client.emit('call_receive',channel)
12 | }
13 | }
--------------------------------------------------------------------------------
/src/Client/actions/NOTIFIED_UPDATE_PROFILE.js:
--------------------------------------------------------------------------------
1 | const Client = require("../Client")
2 | /**
3 | *
4 | * @param {Client} client
5 | * @param {any} op
6 | */
7 | module.exports = (client, op) =>{
8 | let raw_updated = JSON.parse(op.param3)
9 |
10 | let updated = {}
11 | for (const key in raw_updated) {
12 | if(key.startsWith('OLD_')) {
13 | let real_key = key.replace(/OLD_/,'')
14 | if(raw_updated[real_key]){
15 | if(real_key == "DISPLAY_NAME") updated['displayName'] = raw_updated[real_key]
16 | else client.debug && console.trace("UNKNOW UPDATE TYPE", real_key)
17 | }
18 | }
19 | }
20 |
21 | if (Object.keys(updated).length !== 0) { // Check For Empty(No Update)
22 | let old_user = client.users.cache.get(op.param1)
23 | let new_user = client.users.add({
24 | id: op.param1,
25 | ...updated
26 | },true,{
27 | id: op.param1
28 | })
29 | client.emit('UserUpdate',old_user,new_user)
30 | }
31 | }
--------------------------------------------------------------------------------
/src/Client/actions/RECEIVE_MESSAGE.js:
--------------------------------------------------------------------------------
1 | const CONSENT = require("../../CONSENT")
2 | const { string_of_enum } = require("../../util/Util")
3 |
4 | /*
5 | 'USER' : 0,
6 | 'ROOM' : 1,
7 | 'GROUP' : 2,
8 | 'SQUARE' : 3,
9 | 'SQUARE_CHAT' : 4,
10 | 'SQUARE_MEMBER' : 5,
11 | 'BOT' : 6
12 | */
13 | module.exports = async(client, op) =>{
14 | let channel;
15 | let mid_type = string_of_enum(CONSENT.thrift.TalkService_types.MIDType,op.message.toType)
16 |
17 | if(mid_type == 'USER') channel = client.channels.cache.get(op.message._from)
18 | else if(mid_type == 'GROUP') channel = client.groups.cache.get(op.message.to)
19 | else client.debug && console.trace('unknow type ',mid_type, op)
20 | let content_type = string_of_enum(CONSENT.thrift.TalkService_types.ContentType,op.message.contentType)
21 | if(content_type == "CALL") {
22 | client.emit('call_receive',channel)
23 | }
24 | else if (channel && channel.messages) {
25 | client.emit("message",channel.messages.add(op.message,true,{
26 | id: op.message.id
27 | }))
28 | }
29 | }
--------------------------------------------------------------------------------
/src/Client/actions/REJECT_CHAT_INVITATION.js:
--------------------------------------------------------------------------------
1 | const Client = require("../Client")
2 | /**
3 | *
4 | * @param {Client} client
5 | * @param {any} op
6 | */
7 | module.exports = async(client, op) =>{
8 | let where = op.param1;
9 |
10 | let group = client.groups.cache.get(where)
11 | if(group) {
12 | client.groups.cache.delete(where)
13 | client.emit("chat_invite_reject",group)
14 | }
15 | }
--------------------------------------------------------------------------------
/src/Client/actions/SEND_CHAT_REMOVED.js:
--------------------------------------------------------------------------------
1 | const Client = require("../Client")
2 |
3 | /**
4 | *
5 | * @param {Client} client
6 | * @param {any} op
7 | */
8 | module.exports = async(client, op) =>{
9 | let channel = client.channels.cache.get(op.param1)
10 | let message_id = op.param2
11 | if (channel && channel.messages) {
12 | let message = channel.messages.cache.get(message_id)
13 | if(message) {
14 | channel.messages.cache.delete(message_id)
15 | client.emit('message_unsend',message)
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/Client/auth/login_qr.js:
--------------------------------------------------------------------------------
1 | const CONSENT = require("../../CONSENT")
2 | const { generateKeyPair } = require("curve25519-js")
3 | const { nanoid } = require('nanoid')
4 | const Thrift_Client = require("../thrift/Thrift_Client")
5 | const { CreateQrSessionRequest,CreateQrCodeRequest,CreatePinCodeRequest,QrCodeLoginRequest,VerifyCertificateRequest } =CONSENT.thrift.SecondaryQrCodeLogin_types
6 | const { CheckQrCodeVerifiedRequest,CheckPinCodeVerifiedRequest } = CONSENT.thrift.SecondaryQrCodeLoginPermitNoticeService_types
7 | const QRCode = require('qrcode')
8 | const gen_qr = require('util').promisify(QRCode.toString)
9 | /**
10 | *
11 | * @return {Promise<{
12 | * certificate: String,
13 | * accessToken: String,
14 | * lastBindTimestamp: Buffer,
15 | * metaData: {
16 | * encryptedKeyChain: String,
17 | * hashKeyChain: String,
18 | * errorCode: String,
19 | * keyId: String,
20 | * publicKey: String,
21 | * e2eeVersion: String
22 | * }
23 | * }>}
24 | **/
25 | module.exports = async()=>{
26 | let line_sev = await new Thrift_Client().connect({
27 | host: 'gxx.line.naver.jp',
28 | path: '/acct/lgn/sq/v1',
29 | headers: {
30 | 'User-Agent': 'Line/6.7.3',
31 | 'X-Line-Application': 'DESKTOPWIN\t6.7.3\tALFINO-PCV3\t10.0;SECONDARY',
32 | 'x-lal': 'en_id',
33 | 'server': 'pool-3'
34 | },
35 | service: CONSENT.thrift.SecondaryQrCodeLogin
36 | })
37 | const session = await line_sev._client.createSession(CreateQrSessionRequest())
38 | const qrCode_URL = (await line_sev._client.createQrCode(new CreateQrCodeRequest(session))).callbackUrl
39 | const { public } = await generateKeyPair(new Buffer.from(nanoid(32)))
40 |
41 | const secret = Buffer.from(public).toString('base64')
42 | let url = `${qrCode_URL}?secret=${encodeURIComponent(secret)}&e2eeVersion=1`
43 |
44 | console.log(await gen_qr(url,{type:'terminal'}))
45 | console.log('Now Scan With Your Phone')
46 |
47 | let client_verif = await new Thrift_Client().connect({
48 | host: 'gxx.line.naver.jp',
49 | path: '/acct/lp/lgn/sq/v1',
50 | headers: {
51 | 'User-Agent': 'Line/6.7.3',
52 | 'X-Line-Application': 'DESKTOPWIN\t6.7.3\tALFINO-PCV3\t10.0;SECONDARY',
53 | 'X-Line-Access': session.authSessionId,
54 | 'x-lal': 'en_id',
55 | 'server': 'pool-3'
56 | },
57 | service: CONSENT.thrift.SecondaryQrCodeLoginPermitNoticeService
58 | })
59 |
60 | await client_verif._client.checkQrCodeVerified(new CheckQrCodeVerifiedRequest(session))
61 | await line_sev._client.verifyCertificate(new VerifyCertificateRequest(session)).catch(()=>{})
62 | const pincode = (await line_sev._client.createPinCode(new CreatePinCodeRequest(session))).pinCode
63 | console.clear()
64 | console.log('Pin Code :', pincode)
65 | await client_verif._client.checkPinCodeVerified(new CheckPinCodeVerifiedRequest(session))
66 | const qrcodelogin = await line_sev._client.qrCodeLogin(new QrCodeLoginRequest({
67 | authSessionId: session.authSessionId,
68 | systemName: 'ALFINO-PCV3',
69 | autoLoginIsRequired: true
70 | }))
71 | return qrcodelogin
72 | }
--------------------------------------------------------------------------------
/src/Client/auth/login_user_pass.js:
--------------------------------------------------------------------------------
1 | module.exports = () => {
2 | // nothing here dude!
3 | }
--------------------------------------------------------------------------------
/src/Client/thrift/Thrift_Client.js:
--------------------------------------------------------------------------------
1 | const thrift = require('thrift');
2 |
3 | class Thrift_Client {
4 | /**
5 | *
6 | * @param {import("./Thrift_Manager")} Manager
7 | */
8 | constructor(Manager){
9 | if(Manager) this.manager = Manager;
10 | this._connection = null;
11 | this._client = null;
12 | }
13 | connect(options = {}){
14 | if(!options.headers) options.headers = {}
15 |
16 | if(!options.https) options.https = true
17 | if(!options.transport) options.transport = thrift.TBufferedTransport
18 | if(!options.protocol) options.protocol = thrift.TCompactProtocol
19 |
20 | if(this.manager) options.headers["x-line-access"] = this.manager.token
21 | if(!this._connection) this._connection = thrift.createHttpConnection(options.host, 443, options);
22 | this._client = thrift.createHttpClient(options.service,this._connection)
23 | return this;
24 | }
25 | }
26 |
27 | module.exports = Thrift_Client
--------------------------------------------------------------------------------
/src/Client/thrift/Thrift_Manager.js:
--------------------------------------------------------------------------------
1 | const Thrift_Client = require("./Thrift_Client")
2 |
3 | module.exports = class Thrift_Manager {
4 |
5 | /**
6 | *
7 | * @param {import("./Client")} client
8 | */
9 | constructor(client){
10 | this.client = client
11 | this._send = new Thrift_Client(this.client)
12 | this._receive = new Thrift_Client(this.client)
13 |
14 | this.key = null;
15 | }
16 | get token(){
17 | return this.client.token;
18 | }
19 | get api(){
20 | return this._send._client;
21 | }
22 | connect(options={
23 | host: "",
24 | headers: {},
25 | SEND_PATH: "",
26 | RECEIVE_PATH: "",
27 | service: null
28 | }){
29 | if(options.SEND_PATH) this._send.connect({
30 | ...options,path:options.SEND_PATH
31 | })
32 | if(options.RECEIVE_PATH) this._receive.connect({
33 | ...options,path:options.RECEIVE_PATH
34 | })
35 | return this;
36 | }
37 | destroy(){
38 | //todo: close connection
39 | return null
40 | }
41 | }
--------------------------------------------------------------------------------
/src/Managers/BaseManager.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const Collection = require('../util/Collection');
4 |
5 | /**
6 | * Manages the API methods of a data model and holds its cache.
7 | * @abstract
8 | */
9 | class BaseManager {
10 | constructor(client, iterable, Structure, cacheType = Collection, ...cacheOptions) {
11 | /**
12 | * The data structure belonging to this manager
13 | * @name BaseManager#holds
14 | * @type {Function}
15 | * @private
16 | * @readonly
17 | */
18 | Object.defineProperty(this, 'holds', { value: Structure });
19 |
20 | /**
21 | * The client that instantiated this Manager
22 | * @name BaseManager#client
23 | * @type {import("../Client/Client")}
24 | * @readonly
25 | */
26 | Object.defineProperty(this, 'client', { value: client });
27 |
28 | /**
29 | * The type of Collection of the Manager
30 | * @type {Collection}
31 | */
32 | this.cacheType = cacheType;
33 |
34 | /**
35 | * Holds the cache for the data model
36 | * @type {Collection}
37 | * @private
38 | */
39 | this.cache = new cacheType(...cacheOptions);
40 | if (iterable) for (const i of iterable) this.add(i);
41 | }
42 |
43 | add(data, cache = true, { id, extras = [] } = {}) {
44 | const existing = this.cache.get(id || data.id);
45 | if (existing && existing._patch && cache) existing._patch(data);
46 | if (existing) return existing;
47 |
48 | const entry = this.holds ? new this.holds(this.client, data, ...extras) : data;
49 | if (cache) this.cache.set(id || entry.id, entry);
50 | return entry;
51 | }
52 |
53 | /**
54 | * Resolves a data entry to a data Object.
55 | * @param {string|Object} idOrInstance The id or instance of something in this Manager
56 | * @returns {?Object} An instance from this Manager
57 | */
58 | resolve(idOrInstance) {
59 | if (idOrInstance instanceof this.holds) return idOrInstance;
60 | if (typeof idOrInstance === 'string') return this.cache.get(idOrInstance) || null;
61 | return null;
62 | }
63 |
64 | /**
65 | * Resolves a data entry to an instance ID.
66 | * @param {string|Object} idOrInstance The id or instance of something in this Manager
67 | * @returns {?Snowflake}
68 | */
69 | resolveID(idOrInstance) {
70 | if (idOrInstance instanceof this.holds) return idOrInstance.id;
71 | if (typeof idOrInstance === 'object' && idOrInstance.id) return idOrInstance.id;
72 | if (typeof idOrInstance === 'string') return idOrInstance;
73 | return null;
74 | }
75 |
76 | valueOf() {
77 | return this.cache;
78 | }
79 | }
80 |
81 | module.exports = BaseManager;
--------------------------------------------------------------------------------
/src/Managers/ChannelManager.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | const { GetChatsRequest } = require("../CONSENT/gen-nodejs/TalkService_types");
3 | const TextBaseChannel = require("../structures/Channel/TextBaseChannel");
4 | const BaseManager = require("./BaseManager");
5 | /**
6 | * Manages API methods for users and stores their cache.
7 | * @extends {BaseManager}
8 | */
9 | class ChannelManager extends BaseManager {
10 | /**
11 | *
12 | * @param {import("./Client")} client
13 | */
14 | constructor(client,iterable){
15 | super(client,iterable,TextBaseChannel)
16 |
17 |
18 | /**
19 | * The cache of this manager
20 | * @type {import("@discordjs/collection").Collection}
21 | * @name UserManager#cache
22 | */
23 | this.cache
24 | }
25 |
26 |
27 | /**
28 | *
29 | * @param {String} id
30 | * @returns {Promise}
31 | */
32 | async fetch(id){
33 | if(!id){
34 | let all_contacts = await this.client.api.getChats(all)
35 | return await Promise.all(all_contacts.map(id => this.fetch(id)));
36 | }else{
37 | let _ = await this.client.api.getChats(
38 | new GetChatsRequest({
39 | chatMids: [id]
40 | }))
41 | for (let i = 0; i < _.length; i++) {
42 | await this.add(_,true,{id:_[i].chatMid})
43 | }
44 | return this.cache.get(id)
45 | }
46 | }
47 | }
48 | module.exports = ChannelManager
--------------------------------------------------------------------------------
/src/Managers/GroupChannelManager.js:
--------------------------------------------------------------------------------
1 | const CONSENT = require("../CONSENT");
2 | const GroupChannel = require("../structures/Channel/GroupChannel");
3 | const BaseManager = require("./BaseManager");
4 | const { ChatType } = CONSENT.thrift.TalkService_types
5 | /**
6 | * Manages API methods for groups and stores their cache.
7 | * @extends {BaseManager}
8 | */
9 | class GroupChannelManager extends BaseManager {
10 | /**
11 | *
12 | * @param {import("../Client/Client")} client
13 | */
14 | constructor(client,iterable){
15 | super(client,iterable,GroupChannel)
16 |
17 |
18 | /**
19 | * The cache of this manager
20 | * @type {import("@discordjs/collection").Collection}
21 | * @name GroupChannelManager#cache
22 | */
23 | this.cache
24 | }
25 |
26 | /**
27 | * Create new Group
28 | */
29 | async create(name,options={}){
30 | options.type = ChatType['GROUP']
31 | if(options.targetUserMids) {
32 | if(!Array.isArray(options.targetUserMids)) options.targetUserMids = [options.targetUserMids];
33 | options.targetUserMids = options.targetUserMids.map(u=>this.client.users.resolveID(u))
34 | }
35 | let raw = (await this.client.api.createChat({
36 | reqSeq: 0,
37 | name: name,
38 | ...options
39 | })).chat
40 | return this.add(raw,true,{
41 | id: raw.chatMid
42 | })
43 | }
44 | /**
45 | *
46 | * @param {String|Array} chatMids
47 | * @returns {Promise}
48 | */
49 | async fetch(chatMids){
50 | if(typeof chatMids == "string") chatMids = [chatMids];
51 | if(!chatMids) {
52 | let allmids = await this.client.api.getAllChatMids({
53 | withInvitedChats: true,
54 | withMemberChats: true
55 | },0)
56 | chatMids = [].concat.apply(allmids.memberChatMids, allmids.invitedChatMids)
57 | }
58 | if (!chatMids.length) return;
59 | let chats = (await this.client.api.getChats({
60 | chatMids,
61 | withMembers: true,
62 | withInvitees: true
63 | })).chats
64 | chats = chats.map(c=>this.add(c,true,{
65 | id: c.chatMid
66 | }))
67 | if(chats.length == 1) return chats[0]
68 | else return chats
69 | }
70 | }
71 | module.exports = GroupChannelManager
--------------------------------------------------------------------------------
/src/Managers/GroupMemberManager.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | const GroupMember = require("../structures/User/Group_Member");
3 | const BaseManager = require("./BaseManager");
4 | /**
5 | * Manages API methods for users and stores their cache.
6 | * @extends {BaseManager}
7 | */
8 | class GroupMemberManager extends BaseManager {
9 | /**
10 | *
11 | * @param {import("../structures/Channel/GroupChannel")} group
12 | */
13 | constructor(group,iterable){
14 | super(group.client,iterable,GroupMember)
15 | this.group = group
16 |
17 | /**
18 | * The cache of this manager
19 | * @type {import("@discordjs/collection").Collection}
20 | * @name UserManager#cache
21 | */
22 | this.cache
23 | }
24 |
25 | add(data, cache = true, options = {}) {
26 | return super.add(data, cache, { extras: [this.group],...options });
27 | }
28 |
29 | /**
30 | *
31 | * @param {String[] | String} ids
32 | * @returns {Promise}
33 | */
34 | async fetch(ids){
35 | if(!ids){
36 | return await this.fetch(this.cache.keyArray())
37 | }else{
38 | if(!Array.isArray(ids)) ids = [ids]
39 | let users = (await this.client.users.fetch(ids)).map(user=>
40 | this.add({
41 | id: user.id
42 | },true,{
43 | id: user.id
44 | })
45 | )
46 | return users
47 | }
48 | }
49 | }
50 | module.exports = GroupMemberManager
--------------------------------------------------------------------------------
/src/Managers/MessageManager.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | const Message = require("../structures/Message/Message");
3 | const BaseManager = require("./BaseManager");
4 | /**
5 | * Manages API methods for users and stores their cache.
6 | * @extends {BaseManager}
7 | */
8 | class MessageMananger extends BaseManager {
9 | /**
10 | *
11 | * @param {import("./Client")} client
12 | */
13 | constructor(channel,iterable){
14 | super(channel.client,iterable,Message)
15 |
16 | this.channel = channel
17 | /**
18 | * The cache of this manager
19 | * @type {import("@discordjs/collection").Collection}
20 | * @name MessageMananger#cache
21 | */
22 | this.cache
23 | }
24 |
25 | add(data, cache = true, options = {}) {
26 | return super.add(data, cache, { extras: [this.channel],...options });
27 | }
28 |
29 | }
30 | module.exports = MessageMananger
--------------------------------------------------------------------------------
/src/Managers/UserManager.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | const Message = require("../structures/Message/Message");
3 | const Client_User = require("../structures/User/Client_User");
4 | const Group_Member = require("../structures/User/Group_Member");
5 | const User = require("../structures/User/User");
6 | const BaseManager = require("./BaseManager");
7 | /**
8 | * Manages API methods for users and stores their cache.
9 | * @extends {BaseManager}
10 | */
11 | class UserManager extends BaseManager {
12 | /**
13 | *
14 | * @param {import("./Client")} client
15 | */
16 | constructor(client,iterable){
17 | super(client,iterable,User)
18 |
19 |
20 | /**
21 | * The cache of this manager
22 | * @type {import("@discordjs/collection").Collection}
23 | * @name UserManager#cache
24 | */
25 | this.cache
26 | }
27 |
28 |
29 | resolveID(user){
30 | if(user instanceof Group_Member) return user.id;
31 | if(user instanceof Client_User) return user.id;
32 | if(user instanceof Message) return user.user.id;
33 | return super.resolveID(user)
34 | }
35 | /**
36 | *
37 | * @param {String[] | String} ids
38 | * @returns {Promise}
39 | */
40 | async fetch(ids){
41 | if(!ids){
42 | let all_contacts = await this.client.api.getAllContactIds(0)
43 | return await this.fetch(all_contacts)
44 | }else{
45 | if(!Array.isArray(ids)) ids = [ids]
46 | let _ = (await this.client.api.getContacts(ids)).map(contact=>this.add(contact,true,{id:contact.mid}))
47 | if(_.length <= 1) return _[0];
48 | else return _
49 | }
50 | }
51 | }
52 | module.exports = UserManager
--------------------------------------------------------------------------------
/src/structures/Base.js:
--------------------------------------------------------------------------------
1 | module.exports = class Base {
2 |
3 | /**
4 | * @param {import("../Client/Client")} client
5 | */
6 | constructor(client) {
7 | this.client = client
8 | }
9 | /** @private */
10 | _clone() {
11 | return Object.assign(Object.create(this), this);
12 | }
13 |
14 | /** @private */
15 | _patch(data) {
16 | return data;
17 | }
18 |
19 | /** @private */
20 | _update(data) {
21 | const clone = this._clone();
22 | this._patch(data);
23 | return clone;
24 | }
25 |
26 | /** @private */
27 | valueOf() {
28 | return this.id;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/structures/Channel/Channel.js:
--------------------------------------------------------------------------------
1 | const Base = require("../Base");
2 | const { ChatType,Extra } = require("../../CONSENT").thrift.TalkService_types
3 | const { string_of_enum } = require("../../util/Util")
4 | module.exports = class Channel extends Base {
5 | /**
6 | *
7 | * @param {import("../Client")} client
8 | * @param {*} data
9 | */
10 | constructor(client,data){
11 | super(client)
12 |
13 | if (data) this._patch(data);
14 | }
15 |
16 | async _patch(data){
17 | super._patch(data)
18 | /**
19 | * The ID of the channel
20 | * @type {String}
21 | */
22 | this.id = data.chatMid||data.mid||data.id;
23 |
24 |
25 | if('notificationDisabled' in data) {
26 | /**
27 | * @type {?Boolean}
28 | */
29 | this.notificationDisabled = data.notificationDisabled;
30 | }
31 | if('type' in data) {
32 | /**
33 | * @type {?String}
34 | */
35 | this.type = string_of_enum(ChatType,data.type) || this.type;
36 | }
37 |
38 | if('createdTime' in data) {
39 | /**
40 | * @type {?Date}
41 | */
42 | this.createdTime = new Date(parseInt(data.createdTime));
43 | }
44 |
45 | if('favoriteTimestamp' in data) {
46 | /**
47 | * @type {?Date}
48 | */
49 | this.favoriteTimestamp = new Date(parseInt(data.favoriteTimestamp));
50 | }
51 |
52 | if('name' in data) {
53 | /**
54 | * @type {?String}
55 | */
56 | this.name = data.name;
57 | }
58 |
59 | if('chatName' in data) {
60 | /**
61 | * @type {?String}
62 | */
63 | this.name = data.chatName;
64 | }
65 |
66 | if('picturePath' in data) {
67 | /**
68 | * @type {?String}
69 | */
70 | this.picturePath = data.picturePath;
71 | }
72 | if('extra' in data) {
73 | /**
74 | * @type {?Extra}
75 | */
76 | this.extra = data.extra;
77 | }
78 | }
79 | }
--------------------------------------------------------------------------------
/src/structures/Channel/GroupChannel.js:
--------------------------------------------------------------------------------
1 | const CONSENT = require('../../CONSENT')
2 | const GroupMemberManager = require("../../Managers/GroupMemberManager");
3 | const TextBaseChannel = require('./TextBaseChannel');
4 |
5 | module.exports = class GroupChannel extends TextBaseChannel {
6 | /**
7 | *
8 | * @param {import("../Client")} client
9 | * @param {*} data
10 | */
11 | constructor(client,data){
12 | super(client,data)
13 |
14 |
15 | this.members = new GroupMemberManager(this)
16 | this.invites = new GroupMemberManager(this)
17 |
18 | if (data) this._patch(data);
19 | }
20 |
21 | get me(){
22 | return this.members.cache.get(this.client.user.id)
23 | }
24 |
25 | get owner(){
26 | let member = this.members.cache.get(this.extra.groupExtra.creator)
27 | if(!member) return this.client.users.add({id:this.extra.groupExtra.creator},false,{id: this.extra.groupExtra.creator})
28 | else return member
29 | }
30 |
31 | get joined(){
32 | return this.members.cache.has(this.client.user.id)
33 | }
34 |
35 | _patch(data){
36 | super._patch(data)
37 | if('picturePath' in data) {
38 | /**
39 | * @type {String}
40 | */
41 | this.picturePath = data.picturePath;
42 | }
43 |
44 | if ('extra' in data) {
45 | /**
46 | * @type {Object}
47 | */
48 | this.extra = data.extra;
49 | if('groupExtra' in data.extra) {
50 | if('memberMids' in data.extra.groupExtra) {
51 | for (const id in data.extra.groupExtra.memberMids) {
52 | this.members && this.members.add({
53 | id: id,
54 | timestamp: data.extra.groupExtra.memberMids[id]
55 | })
56 | }
57 | }
58 | if('inviteeMids' in data.extra.groupExtra) {
59 | for (const id in data.extra.groupExtra.inviteeMids) {
60 | this.invites && this.invites.add({
61 | id: id,
62 | timestamp: data.extra.groupExtra.inviteeMids[id]
63 | })
64 | }
65 | }
66 | }
67 | }
68 |
69 | }
70 | iconURL(){
71 | return CONSENT.line_server.CDN_PATH + this.picturePath
72 | }
73 | async fetch(){
74 | return this.client.groups.fetch(this.id)
75 | }
76 | /*
77 | * leave this group
78 | */
79 | leave(){
80 | return this.client.api.deleteSelfFromChat({
81 | reqSeq: 0,
82 | chatMid: this.id
83 | })
84 | }
85 | /**
86 | * invite user
87 | */
88 | invite(users){
89 | if(!Array.isArray(users)) users = [users]
90 | users = users.map(user=>this.client.users.resolveID(user)).filter(id => !this.members.cache.has(id) && !this.invites.cache.has(id))
91 | if(users.length >= 1) {
92 | return this.client.api.inviteIntoChat({
93 | reqSeq: 0,
94 | id: this.id,
95 | targetUserMids: users
96 | })
97 | } else return false
98 | }
99 |
100 | kick(users = []){
101 | if(!Array.isArray(users)) users = [users];
102 | users = users.map(user=>this.client.users.resolveID(user)).filter(id => id != this.client.user.id && id != this.owner.id)
103 | if(users.length >= 1) {
104 | return this.client.api.deleteOtherFromChat({
105 | reqSeq: 0,
106 | chatMid: this.id,
107 | targetUserMids: users
108 | })
109 | } else return false
110 | }
111 |
112 | /**
113 | * Reject This Group Invite If not Joined
114 | * @return {Promise