@wireapp/core 46.30.1 → 46.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Account.d.ts CHANGED
@@ -27,13 +27,13 @@ import { UserService } from './user/';
27
27
  import { RecurringTaskScheduler } from './util/RecurringTaskScheduler';
28
28
  export type ProcessedEventPayload = HandledEventPayload;
29
29
  export declare enum ConnectionState {
30
- /** The websocket is closed and notifications stream is not being processed */
30
+ /** The WebSocket is closed and no notifications are being processed */
31
31
  CLOSED = "closed",
32
- /** The websocket is being opened */
32
+ /** The WebSocket is being opened or reconnected */
33
33
  CONNECTING = "connecting",
34
34
  /** The websocket is open but locked and notifications stream is being processed */
35
35
  PROCESSING_NOTIFICATIONS = "processing_notifications",
36
- /** The websocket is open and message will go through and notifications stream is fully processed */
36
+ /** The WebSocket is open and new messages are processed live in real time */
37
37
  LIVE = "live"
38
38
  }
39
39
  export type CreateStoreFn = (storeName: string, key: Uint8Array) => undefined | Promise<CRUDEngine | undefined>;
@@ -83,9 +83,8 @@ export declare class Account extends TypedEventEmitter<Events> {
83
83
  private db?;
84
84
  private encryptedDb?;
85
85
  private coreCallbacks?;
86
- private totalPendingNotifications;
87
- private remainingNotifications;
88
86
  private connectionState;
87
+ private notificationProcessingQueue;
89
88
  service?: {
90
89
  mls?: MLSService;
91
90
  e2eIdentity?: E2EIServiceExternal;
@@ -225,10 +224,7 @@ export declare class Account extends TypedEventEmitter<Events> {
225
224
  /**
226
225
  * During the notification stream processing, this function will be called whenever a new notification has been processed
227
226
  */
228
- onNotificationStreamProgress?: ({ done, total }: {
229
- done: number;
230
- total: number;
231
- }) => void;
227
+ onNotificationStreamProgress?: (currentProcessingNotificationTimestamp: string) => void;
232
228
  /**
233
229
  * called when the connection state with the backend has changed
234
230
  */
@@ -253,12 +249,26 @@ export declare class Account extends TypedEventEmitter<Events> {
253
249
  * forwarding the event to the consumer via the `onEvent` callback.
254
250
  */
255
251
  private createEventHandler;
252
+ /**
253
+ * @deprecated This method is used to handle legacy notifications from the backend.
254
+ * It processes notifications from the legacy system, decrypts them, and emits events.
255
+ * It can be replaced with the new notification handling system using `ConsumableNotification`
256
+ * when all clients are capable of handling consumable notifications.
257
+ */
256
258
  private createLegacyNotificationHandler;
257
259
  private createNotificationHandler;
260
+ private acknowledgeSynchronizationNotification;
261
+ private handleSynchronizationNotification;
262
+ private decryptAckEmitNotification;
263
+ getNotificationEventTime(backendEvent: Events.BackendEvent): string | null;
258
264
  /**
259
265
  * Returns a function to handle missed notifications — i.e., when the backend indicates
260
266
  * that some notifications were lost due to age (typically >28 days).
261
267
  * Also handles MLS-specific epoch mismatch recovery by triggering a conversation rejoin.
268
+ *
269
+ * @deprecated This is used to handle legacy missed notifications.
270
+ * It should be replaced with the new notification handling system using `ConsumableNotification`.
271
+ * when all clients are capable of handling consumable notifications.
262
272
  */
263
273
  private createLegacyMissedNotificationsHandler;
264
274
  /**
@@ -266,6 +276,10 @@ export declare class Account extends TypedEventEmitter<Events> {
266
276
  * It pauses message sending and MLS rejoining during stream handling to prevent race conditions,
267
277
  * then resumes normal operations after sync is complete.
268
278
  *
279
+ * @deprecated This is used to do a final sync of the legacy notification stream
280
+ * before switching to the new notification handling system using `ConsumableNotification`.
281
+ * It should be replaced with the new notification handling system when all clients are capable of handling consumable notifications.
282
+ *
269
283
  * @param handlers Various logic handlers wired to notification callbacks
270
284
  */
271
285
  private createLegacyNotificationStreamProcessor;
@@ -1 +1 @@
1
- {"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../src/Account.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EAGZ,OAAO,EACP,MAAM,EAEN,SAAS,EAEV,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAC,gBAAgB,EAAwB,UAAU,EAAE,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AAErH,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAC;AAExD,OAAO,EAAC,YAAY,EAAC,MAAM,u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IAmC/B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,CAAC,yBAAyB;IAe1B,qBAAqB;IAIrB,iBAAiB,CACtB,YAAY,EAAE,YAAY,GAAG,sBAAsB,GAClD,YAAY,IAAI,sBAAsB;IAIzC,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,uBAAuB;YAIjB,UAAU;IAuBxB,OAAO,CAAC,yBAAyB,CAS/B;IAEW,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC;CAetD"}
package/lib/Account.js CHANGED
@@ -52,6 +52,7 @@ const team_1 = require("@wireapp/api-client/lib/team");
52
52
  const TimeUtil_1 = require("@wireapp/commons/lib/util/TimeUtil");
53
53
  const api_client_1 = require("@wireapp/api-client");
54
54
  const commons_1 = require("@wireapp/commons");
55
+ const promise_queue_1 = require("@wireapp/promise-queue");
55
56
  const store_engine_1 = require("@wireapp/store-engine");
56
57
  const account_1 = require("./account/");
57
58
  const auth_2 = require("./auth/");
@@ -81,13 +82,13 @@ const LocalStorageStore_1 = require("./util/LocalStorageStore");
81
82
  const RecurringTaskScheduler_1 = require("./util/RecurringTaskScheduler");
82
83
  var ConnectionState;
83
84
  (function (ConnectionState) {
84
- /** The websocket is closed and notifications stream is not being processed */
85
+ /** The WebSocket is closed and no notifications are being processed */
85
86
  ConnectionState["CLOSED"] = "closed";
86
- /** The websocket is being opened */
87
+ /** The WebSocket is being opened or reconnected */
87
88
  ConnectionState["CONNECTING"] = "connecting";
88
89
  /** The websocket is open but locked and notifications stream is being processed */
89
90
  ConnectionState["PROCESSING_NOTIFICATIONS"] = "processing_notifications";
90
- /** The websocket is open and message will go through and notifications stream is fully processed */
91
+ /** The WebSocket is open and new messages are processed live in real time */
91
92
  ConnectionState["LIVE"] = "live";
92
93
  })(ConnectionState || (exports.ConnectionState = ConnectionState = {}));
93
94
  const coreDefaultClient = {
@@ -114,9 +115,8 @@ class Account extends commons_1.TypedEventEmitter {
114
115
  db;
115
116
  encryptedDb;
116
117
  coreCallbacks;
117
- totalPendingNotifications = 0;
118
- remainingNotifications = 0;
119
118
  connectionState = ConnectionState.CLOSED;
119
+ notificationProcessingQueue = new promise_queue_1.PromiseQueue({ name: 'notification-processing-queue', paused: true });
120
120
  service;
121
121
  backendFeatures;
122
122
  recurringTaskScheduler;
@@ -453,6 +453,8 @@ class Account extends commons_1.TypedEventEmitter {
453
453
  *
454
454
  * These two systems are separate, and the transition timing
455
455
  * is important to avoid missing any messages during the switch.
456
+ *
457
+ * @todo This can be removed when all clients are capable of consumable notifications.
456
458
  */
457
459
  if (!isClientCapableOfConsumableNotifications) {
458
460
  // let the backend now client is capable of consumable notifications
@@ -462,7 +464,17 @@ class Account extends commons_1.TypedEventEmitter {
462
464
  // do a quick legacy sync without connecting to any websockets
463
465
  await processNotificationStream();
464
466
  }
465
- this.apiClient.connect();
467
+ this.apiClient.connect(() => {
468
+ (0, messageSender_1.pauseMessageSending)(); // pause message sending while processing notifications, it will be resumed once the processing is done and we have the marker token
469
+ /**
470
+ * unpause the notification processing queue
471
+ * it will start processing notifications immediately and pause if web socket connection drops
472
+ * we should start decryption and therefore acknowledging the notifications in order for the backend to
473
+ * send us the next batch of notifications, currently total size of notifications coming from web socket is limited to 500
474
+ * so we need to acknowledge the notifications to let the backend know we are ready for the next batch
475
+ */
476
+ this.notificationProcessingQueue.pause(false);
477
+ });
466
478
  return () => {
467
479
  this.apiClient.disconnect();
468
480
  onConnectionStateChanged(ConnectionState.CLOSED);
@@ -471,6 +483,7 @@ class Account extends commons_1.TypedEventEmitter {
471
483
  }
472
484
  createConnectionStateChangedHandler(onConnectionStateChanged) {
473
485
  return (state) => {
486
+ console.info(`Connection state changed to: ${state}`);
474
487
  this.connectionState = state;
475
488
  onConnectionStateChanged(state);
476
489
  this.logger.info(`Connection state changed to: ${state}`);
@@ -496,6 +509,12 @@ class Account extends commons_1.TypedEventEmitter {
496
509
  onEvent(payload, source);
497
510
  };
498
511
  }
512
+ /**
513
+ * @deprecated This method is used to handle legacy notifications from the backend.
514
+ * It processes notifications from the legacy system, decrypts them, and emits events.
515
+ * It can be replaced with the new notification handling system using `ConsumableNotification`
516
+ * when all clients are capable of handling consumable notifications.
517
+ */
499
518
  createLegacyNotificationHandler(handleEvent, dryRun) {
500
519
  return async (notification, source) => {
501
520
  try {
@@ -516,50 +535,67 @@ class Account extends commons_1.TypedEventEmitter {
516
535
  this.reactToMissedNotification();
517
536
  return;
518
537
  }
519
- if (notification.type === ConsumableNotification_1.ConsumableEvent.MESSAGE_COUNT) {
520
- const { data: { count }, } = notification;
521
- this.totalPendingNotifications = count;
522
- this.remainingNotifications = 0;
523
- this.apiClient.transport.ws.acknowledgeMessageCountNotification();
524
- (0, messageSender_1.pauseMessageSending)();
525
- onConnectionStateChanged(ConnectionState.PROCESSING_NOTIFICATIONS);
526
- if (count === 0) {
527
- (0, messageSender_1.resumeMessageSending)();
528
- onConnectionStateChanged(ConnectionState.LIVE);
529
- }
530
- else {
531
- onNotificationStreamProgress({ total: count, done: 0 });
532
- }
538
+ if (notification.type === ConsumableNotification_1.ConsumableEvent.SYNCHRONIZATION) {
539
+ void this.notificationProcessingQueue.push(() => this.handleSynchronizationNotification(notification, onConnectionStateChanged));
533
540
  return;
534
541
  }
535
- const event = notification.data.event;
536
- const messages = this.service.notification.handleNotification(event, source, dryRun);
537
- if (this.connectionState !== ConnectionState.LIVE) {
538
- this.remainingNotifications++;
539
- onNotificationStreamProgress({
540
- done: this.remainingNotifications,
541
- total: this.totalPendingNotifications,
542
- });
543
- }
544
- this.apiClient.transport.ws.acknowledgeNotification(notification);
545
- for await (const message of messages) {
546
- await handleEvent(message, source);
547
- }
548
- if (this.totalPendingNotifications >= this.remainingNotifications &&
549
- this.connectionState !== ConnectionState.LIVE) {
550
- (0, messageSender_1.resumeMessageSending)();
551
- onConnectionStateChanged(ConnectionState.LIVE);
552
- }
542
+ void this.notificationProcessingQueue.push(() => this.decryptAckEmitNotification(notification, handleEvent, source, onNotificationStreamProgress, dryRun));
553
543
  }
554
544
  catch (error) {
555
- this.logger.error(`Failed to handle consumable notification "${notification.type}": ${error.message}`, error);
545
+ this.logger.error(`Failed to handle notification "${notification.type}": ${error.message}`, error);
556
546
  }
557
547
  };
558
548
  }
549
+ acknowledgeSynchronizationNotification(notification) {
550
+ this.apiClient.transport.ws.acknowledgeConsumableNotificationSynchronization(notification);
551
+ }
552
+ async handleSynchronizationNotification(notification, onConnectionStateChanged) {
553
+ this.acknowledgeSynchronizationNotification(notification);
554
+ const markerId = notification.data.marker_id;
555
+ const currentMarkerId = this.apiClient.transport.http.accessTokenStore.markerToken;
556
+ /**
557
+ * There is a chance that there might be multiple synchronization notifications (markers)
558
+ * in the queue in case websocket connection drops a few times
559
+ * Hence we only want to resume message sending and set the connection state to LIVE
560
+ * if the marker ID matches the current marker ID.
561
+ */
562
+ if (markerId === currentMarkerId) {
563
+ (0, messageSender_1.resumeMessageSending)();
564
+ onConnectionStateChanged(ConnectionState.LIVE);
565
+ }
566
+ }
567
+ async decryptAckEmitNotification(notification, handleEvent, source, onNotificationStreamProgress, dryRun) {
568
+ try {
569
+ const payloads = this.service.notification.handleNotification(notification.data.event, source, dryRun);
570
+ const notificationTime = this.getNotificationEventTime(notification.data.event.payload[0]);
571
+ if (this.connectionState !== ConnectionState.LIVE && notificationTime) {
572
+ onNotificationStreamProgress(notificationTime);
573
+ }
574
+ if (!dryRun) {
575
+ this.apiClient.transport.ws.acknowledgeNotification(notification);
576
+ }
577
+ for await (const payload of payloads ?? []) {
578
+ await handleEvent(payload, source);
579
+ }
580
+ }
581
+ catch (err) {
582
+ this.logger.error(`Failed to process notification ${notification.data.delivery_tag}`, err);
583
+ }
584
+ }
585
+ getNotificationEventTime(backendEvent) {
586
+ if ('time' in backendEvent && typeof backendEvent.time === 'string') {
587
+ return backendEvent.time;
588
+ }
589
+ return null;
590
+ }
559
591
  /**
560
592
  * Returns a function to handle missed notifications — i.e., when the backend indicates
561
593
  * that some notifications were lost due to age (typically >28 days).
562
594
  * Also handles MLS-specific epoch mismatch recovery by triggering a conversation rejoin.
595
+ *
596
+ * @deprecated This is used to handle legacy missed notifications.
597
+ * It should be replaced with the new notification handling system using `ConsumableNotification`.
598
+ * when all clients are capable of handling consumable notifications.
563
599
  */
564
600
  createLegacyMissedNotificationsHandler(onMissedNotifications) {
565
601
  return async (notificationId) => {
@@ -574,6 +610,10 @@ class Account extends commons_1.TypedEventEmitter {
574
610
  * It pauses message sending and MLS rejoining during stream handling to prevent race conditions,
575
611
  * then resumes normal operations after sync is complete.
576
612
  *
613
+ * @deprecated This is used to do a final sync of the legacy notification stream
614
+ * before switching to the new notification handling system using `ConsumableNotification`.
615
+ * It should be replaced with the new notification handling system when all clients are capable of handling consumable notifications.
616
+ *
577
617
  * @param handlers Various logic handlers wired to notification callbacks
578
618
  */
579
619
  createLegacyNotificationStreamProcessor({ handleLegacyNotification, handleMissedNotifications, onNotificationStreamProgress, onConnectionStateChanged, }) {
@@ -582,9 +622,12 @@ class Account extends commons_1.TypedEventEmitter {
582
622
  // We want to avoid triggering rejoins of out-of-sync MLS conversations while we are processing the notification stream
583
623
  (0, conversationRejoinQueue_1.pauseRejoiningMLSConversations)();
584
624
  onConnectionStateChanged(ConnectionState.PROCESSING_NOTIFICATIONS);
585
- const results = await this.service.notification.processNotificationStream(async (notification, source, progress) => {
625
+ const results = await this.service.notification.legacyProcessNotificationStream(async (notification, source) => {
586
626
  await handleLegacyNotification(notification, source);
587
- onNotificationStreamProgress(progress);
627
+ const notificationTime = this.getNotificationEventTime(notification.payload[0]);
628
+ if (notificationTime) {
629
+ onNotificationStreamProgress(notificationTime);
630
+ }
588
631
  }, handleMissedNotifications);
589
632
  this.logger.info('Finished processing notifications from the legacy endpoint', results);
590
633
  // We need to wait for the notification stream to be fully handled before releasing the message sending queue.
@@ -611,6 +654,16 @@ class Account extends commons_1.TypedEventEmitter {
611
654
  [ReconnectingWebsocket_1.WEBSOCKET_STATE.CONNECTING]: ConnectionState.CONNECTING,
612
655
  };
613
656
  const connectionState = mapping[wsState];
657
+ if (connectionState === ConnectionState.CLOSED) {
658
+ this.notificationProcessingQueue.pause();
659
+ /**
660
+ * In case of a closed connection, we flush the notification processing queue.
661
+ * As we are not acknowledging them before decryption is done
662
+ * they will be resent next time the connection is opened
663
+ * this is to avoid duplicate decryption of notifications
664
+ */
665
+ this.notificationProcessingQueue.flush();
666
+ }
614
667
  if (connectionState) {
615
668
  onConnectionStateChanged(connectionState);
616
669
  }
@@ -43,6 +43,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
43
43
  Object.defineProperty(exports, "__esModule", { value: true });
44
44
  const auth_1 = require("@wireapp/api-client/lib/auth");
45
45
  const client_1 = require("@wireapp/api-client/lib/client");
46
+ const Config_1 = require("@wireapp/api-client/lib/Config");
46
47
  const conversation_1 = require("@wireapp/api-client/lib/conversation");
47
48
  const http_1 = require("@wireapp/api-client/lib/http");
48
49
  const notification_1 = require("@wireapp/api-client/lib/notification");
@@ -104,8 +105,8 @@ describe('Account', () => {
104
105
  token_type: 'Bearer',
105
106
  user: 'aaf9a833-ef30-4c22-86a0-9adc8a15b3b4',
106
107
  };
107
- const BACKEND_VERSION = 8;
108
- const websocketServerAddress = `${MOCK_BACKEND.ws}/v${BACKEND_VERSION}/events?access_token=${accessTokenData.access_token}`;
108
+ const markerId = '90da5591-0a26-45f8-bbb2-6c0fc4a2df19';
109
+ const websocketServerAddress = `${MOCK_BACKEND.ws}/v${Config_1.MINIMUM_API_VERSION}/events?access_token=${accessTokenData.access_token}&marker=${markerId}`;
109
110
  beforeEach(() => {
110
111
  (0, nock_1.default)(MOCK_BACKEND.rest)
111
112
  .post(auth_1.AuthAPI.URL.LOGIN, body => body.email && body.password)
@@ -138,9 +139,9 @@ describe('Account', () => {
138
139
  (0, nock_1.default)(MOCK_BACKEND.rest)
139
140
  .get(`/api-version`)
140
141
  .reply(http_status_codes_1.StatusCodes.OK, {
141
- supported: [BACKEND_VERSION],
142
+ supported: [Config_1.MINIMUM_API_VERSION],
142
143
  federation: false,
143
- development: [BACKEND_VERSION + 1],
144
+ development: [Config_1.MINIMUM_API_VERSION + 1],
144
145
  domain: 'zinfra.io',
145
146
  });
146
147
  (0, nock_1.default)(MOCK_BACKEND.rest)
@@ -276,7 +277,11 @@ describe('Account', () => {
276
277
  jest
277
278
  .spyOn(dependencies.account.service.notification['database'], 'getLastNotificationId')
278
279
  .mockResolvedValue('0');
279
- await account.useAPIVersion(BACKEND_VERSION, BACKEND_VERSION);
280
+ await account.useAPIVersion(Config_1.MINIMUM_API_VERSION, Config_1.MINIMUM_API_VERSION);
281
+ jest
282
+ .spyOn(dependencies.apiClient.transport.ws, 'buildWebSocketUrl')
283
+ .mockResolvedValue(websocketServerAddress);
284
+ jest.spyOn(dependencies.account, 'getNotificationEventTime').mockReturnValue('2025-10-01T00:00:00Z');
280
285
  });
281
286
  afterEach(() => {
282
287
  server.close(); // ensure server shutdown
@@ -55,7 +55,17 @@ export declare class NotificationService extends TypedEventEmitter<Events> {
55
55
  getNotificationEventList(): Promise<BackendEvent[]>;
56
56
  setLastEventDate(eventDate: Date): Promise<Date>;
57
57
  private setLastNotificationId;
58
- processNotificationStream(notificationHandler: NotificationHandler, onMissedNotifications: (notificationId: string) => void): Promise<{
58
+ /**
59
+ * Processes the notification stream and calls the provided handler for each notification.
60
+ * If there are missed notifications, it will call the onMissedNotifications callback with the missed notification ID.
61
+ *
62
+ * @param notificationHandler - The handler to process each notification.
63
+ * @param onMissedNotifications - Callback to handle missed notifications.
64
+ * @returns An object containing the total number of notifications processed, number of errors, and successes.
65
+ *
66
+ * @deprecated When all client are migrated to the consumable/async notification stream, this method must be removed.
67
+ */
68
+ legacyProcessNotificationStream(notificationHandler: NotificationHandler, onMissedNotifications: (notificationId: string) => void): Promise<{
59
69
  total: number;
60
70
  error: number;
61
71
  success: number;
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationService.d.ts","sourceRoot":"","sources":["../../src/notification/NotificationService.ts"],"names":[],"mappings":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astNotificationId(lastNotification) {
81
81
  return this.database.updateLastNotificationId(lastNotification);
82
82
  }
83
- async processNotificationStream(notificationHandler, onMissedNotifications) {
83
+ /**
84
+ * Processes the notification stream and calls the provided handler for each notification.
85
+ * If there are missed notifications, it will call the onMissedNotifications callback with the missed notification ID.
86
+ *
87
+ * @param notificationHandler - The handler to process each notification.
88
+ * @param onMissedNotifications - Callback to handle missed notifications.
89
+ * @returns An object containing the total number of notifications processed, number of errors, and successes.
90
+ *
91
+ * @deprecated When all client are migrated to the consumable/async notification stream, this method must be removed.
92
+ */
93
+ async legacyProcessNotificationStream(notificationHandler, onMissedNotifications) {
84
94
  const lastNotificationId = await this.database.getLastNotificationId();
85
95
  const { notifications, missedNotification } = await this.getAllNotifications(lastNotificationId);
86
96
  if (missedNotification) {
package/package.json CHANGED
@@ -11,12 +11,12 @@
11
11
  "./lib/cryptography/AssetCryptography/crypto.node": "./lib/cryptography/AssetCryptography/crypto.browser.js"
12
12
  },
13
13
  "dependencies": {
14
- "@wireapp/api-client": "^27.67.0",
14
+ "@wireapp/api-client": "^27.68.0",
15
15
  "@wireapp/commons": "^5.4.2",
16
16
  "@wireapp/core-crypto": "7.0.1",
17
17
  "@wireapp/cryptobox": "12.8.0",
18
18
  "@wireapp/priority-queue": "^2.1.11",
19
- "@wireapp/promise-queue": "^2.3.12",
19
+ "@wireapp/promise-queue": "^2.4.0",
20
20
  "@wireapp/protocol-messaging": "1.52.0",
21
21
  "@wireapp/store-engine": "^5.1.11",
22
22
  "axios": "1.7.9",
@@ -61,6 +61,6 @@
61
61
  "test:coverage": "jest --coverage",
62
62
  "watch": "tsc --watch"
63
63
  },
64
- "version": "46.30.1",
65
- "gitHead": "347e5b1d3162f629f4fa44fd0e3c4451835e5cb7"
64
+ "version": "46.31.0",
65
+ "gitHead": "e924b1027a151d63f23b7d4f463832eae04b901e"
66
66
  }