@wireapp/core 39.1.6 → 39.2.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.
@@ -88,6 +88,11 @@ export type SendResult = {
88
88
  /** The sending state of the payload (has the payload been succesfully sent or canceled) */
89
89
  state: MessageSendingState;
90
90
  /** In case the message was sent to some federated backend, if the backend was down at the moment of sending the `failedToSend` property will contain all the users/devices that couldn't get the message */
91
- failedToSend?: QualifiedUserClients;
91
+ failedToSend?: {
92
+ /** the message was encrypted for those recipients but will reach them later (a session existed but their backend is offline) */
93
+ queued?: QualifiedUserClients;
94
+ /** the message could not be encrypted for those recipients and thus will never reach them (a session did not exist and their backend if offline) */
95
+ failed?: QualifiedId[];
96
+ };
92
97
  };
93
98
  //# sourceMappingURL=ConversationService.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConversationService.types.d.ts","sourceRoot":"","sources":["../../../src/conversation/ConversationService/ConversationService.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACb,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAC,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAC,mBAAmB,EAAC,MAAM,IAAI,CAAC;AAEvC,oBAAY,iBAAiB;IAC3B,IAAI,IAAA;IACJ,KAAK,IAAA;IACL,aAAa,IAAA;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,WAAW,EAAE,GAAG,oBAAoB,CAAC;IAE/C,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,gBAAgB,CAAC,EAAE,uBAAuB,CAAC,kBAAkB,CAAC,CAAC;IAE/D;;;;;OAKG;IACH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B,CAAC;IAC3B,4MAA4M;IAC5M,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACrC,CAAC"}
1
+ {"version":3,"file":"ConversationService.types.d.ts","sourceRoot":"","sources":["../../../src/conversation/ConversationService/ConversationService.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACb,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAC,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAC,mBAAmB,EAAC,MAAM,IAAI,CAAC;AAEvC,oBAAY,iBAAiB;IAC3B,IAAI,IAAA;IACJ,KAAK,IAAA;IACL,aAAa,IAAA;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,WAAW,EAAE,GAAG,oBAAoB,CAAC;IAE/C,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,gBAAgB,CAAC,EAAE,uBAAuB,CAAC,kBAAkB,CAAC,CAAC;IAE/D;;;;;OAKG;IACH,UAAU,CAAC,EAAE,iBAAiB,CAAC;CAChC;AAED,MAAM,WAAW,uBAAuB;IACtC;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1G;AAED;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,oBAAoB,CAAC;CAChC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,OAAO,EAAE,cAAc,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG;IACpD;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,oBAAoB,CAAC,GAAG,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAC,CAAC;AAE9D,MAAM,MAAM,cAAc,GAAG;IAC3B,cAAc,EAAE,WAAW,CAAC;IAC5B,gBAAgB,EAAE,WAAW,EAAE,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,cAAc,EAAE,WAAW,CAAC;IAC5B,gBAAgB,EAAE,WAAW,EAAE,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAAC,YAAY,EAAE,YAAY,CAAA;CAAC,CAAC;AAEtF,MAAM,MAAM,UAAU,GAAG;IACvB,iCAAiC;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,8EAA8E;IAC9E,MAAM,EAAE,MAAM,CAAC;IACf,2FAA2F;IAC3F,KAAK,EAAE,mBAAmB,CAAC;IAC3B,4MAA4M;IAC5M,YAAY,CAAC,EAAE;QACb,gIAAgI;QAChI,MAAM,CAAC,EAAE,oBAAoB,CAAC;QAC9B,oJAAoJ;QACpJ,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;KACxB,CAAC;CACH,CAAC"}
@@ -26,6 +26,7 @@ export declare class MessageService {
26
26
  onClientMismatch?: (mismatch: MessageSendingStatus) => void | boolean | Promise<boolean>;
27
27
  }): Promise<MessageSendingStatus & {
28
28
  canceled?: boolean;
29
+ failed?: QualifiedId[];
29
30
  }>;
30
31
  private sendOtrMessage;
31
32
  private isClientMismatchError;
@@ -1 +1 @@
1
- {"version":3,"file":"MessageService.d.ts","sourceRoot":"","sources":["../../../src/conversation/message/MessageService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,oBAAoB,EAA0B,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AACxH,OAAO,EAAC,WAAW,EAAE,4BAA4B,EAAC,MAAM,8BAA8B,CAAC;AAOvF,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAI9C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,kCAAkC,CAAC;AAKrE,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAa,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAArD,SAAS,EAAE,SAAS,EAAmB,cAAc,EAAE,cAAc;IAElG;;;;;;;;;;;OAWG;IACU,WAAW,CACtB,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,oBAAoB,GAAG,4BAA4B,EAC/D,SAAS,EAAE,UAAU,EACrB,OAAO,GAAE;QACP,SAAS,CAAC,EAAE,UAAU,CAAC;QACvB,cAAc,CAAC,EAAE,WAAW,CAAC;QAC7B,aAAa,CAAC,EAAE,OAAO,GAAG,WAAW,EAAE,CAAC;QACxC,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,oBAAoB,KAAK,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;KACrF,GACL,OAAO,CAAC,oBAAoB,GAAG;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC;YAwBzC,cAAc;IAiE5B,OAAO,CAAC,qBAAqB;IAI7B;;;;;;;OAOG;YACW,sBAAsB;CAsBrC"}
1
+ {"version":3,"file":"MessageService.d.ts","sourceRoot":"","sources":["../../../src/conversation/message/MessageService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,oBAAoB,EAA0B,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AACxH,OAAO,EAAC,WAAW,EAAE,4BAA4B,EAAC,MAAM,8BAA8B,CAAC;AAQvF,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAI9C,OAAO,KAAK,EAAmB,cAAc,EAAC,MAAM,kCAAkC,CAAC;AAKvF,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAa,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAArD,SAAS,EAAE,SAAS,EAAmB,cAAc,EAAE,cAAc;IAElG;;;;;;;;;;;OAWG;IACU,WAAW,CACtB,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,oBAAoB,GAAG,4BAA4B,EAC/D,SAAS,EAAE,UAAU,EACrB,OAAO,GAAE;QACP,SAAS,CAAC,EAAE,UAAU,CAAC;QACvB,cAAc,CAAC,EAAE,WAAW,CAAC;QAC7B,aAAa,CAAC,EAAE,OAAO,GAAG,WAAW,EAAE,CAAC;QACxC,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,oBAAoB,KAAK,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;KACrF,GACL,OAAO,CAAC,oBAAoB,GAAG;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,EAAE,CAAA;KAAC,CAAC;YAyBjE,cAAc;IAiE5B,OAAO,CAAC,qBAAqB;IAI7B;;;;;;;OAOG;YACW,sBAAsB;CAiBrC"}
@@ -24,6 +24,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.MessageService = void 0;
25
25
  const StringUtil_1 = require("@wireapp/commons/lib/util/StringUtil");
26
26
  const otr_1 = require("@wireapp/protocol-messaging/web/otr");
27
+ const deepmerge_ts_1 = require("deepmerge-ts");
27
28
  const http_status_codes_1 = require("http-status-codes");
28
29
  const long_1 = __importDefault(require("long"));
29
30
  const UserClientsUtil_1 = require("./UserClientsUtil");
@@ -46,13 +47,14 @@ class MessageService {
46
47
  * @return the MessageSendingStatus returned by the backend
47
48
  */
48
49
  async sendMessage(sendingClientId, recipients, plainText, options = {}) {
49
- const { payloads: encryptedPayload, unknowns: unknows } = await this.proteusService.encrypt(plainText, recipients);
50
- const send = async (payload) => {
51
- const result = await this.sendOtrMessage(sendingClientId, payload, options);
52
- return unknows ? Object.assign(Object.assign({}, result), { deleted: Object.assign(Object.assign({}, result.deleted), unknows) }) : result;
50
+ const encryptionResults = await this.proteusService.encrypt(plainText, recipients);
51
+ const send = async ({ payloads, unknowns, failed }) => {
52
+ const result = await this.sendOtrMessage(sendingClientId, payloads, options);
53
+ const extras = { failed, deleted: unknowns !== null && unknowns !== void 0 ? unknowns : {} };
54
+ return (0, deepmerge_ts_1.deepmerge)(result, extras);
53
55
  };
54
56
  try {
55
- return await send(encryptedPayload);
57
+ return await send(encryptionResults);
56
58
  }
57
59
  catch (error) {
58
60
  if (!this.isClientMismatchError(error)) {
@@ -63,7 +65,7 @@ class MessageService {
63
65
  if (shouldStopSending) {
64
66
  return Object.assign(Object.assign({}, mismatch), { canceled: true });
65
67
  }
66
- const reEncryptedPayload = await this.reencryptAfterMismatch(mismatch, encryptedPayload, plainText);
68
+ const reEncryptedPayload = await this.reencryptAfterMismatch(mismatch, encryptionResults, plainText);
67
69
  return send(reEncryptedPayload);
68
70
  }
69
71
  }
@@ -126,21 +128,15 @@ class MessageService {
126
128
  * @param {Uint8Array} plainText The text that should be encrypted for the missing clients
127
129
  * @return resolves with a new message payload that can be sent
128
130
  */
129
- async reencryptAfterMismatch(mismatch, recipients, plainText) {
131
+ async reencryptAfterMismatch(mismatch, initialPayloads, plainText) {
130
132
  const deleted = (0, UserClientsUtil_1.flattenUserMap)(mismatch.deleted);
131
133
  // remove deleted clients to the recipients
132
- deleted.forEach(({ userId, data }) => data.forEach(clientId => delete recipients[userId.domain][userId.id][clientId]));
133
- if (Object.keys(mismatch.missing).length) {
134
- const { payloads } = await this.proteusService.encrypt(plainText, mismatch.missing);
135
- const reEncryptedPayloads = (0, UserClientsUtil_1.flattenUserMap)(payloads);
136
- reEncryptedPayloads.forEach(({ data, userId }) => {
137
- var _a;
138
- const domainRecipients = (_a = recipients[userId.domain]) !== null && _a !== void 0 ? _a : {};
139
- domainRecipients[userId.id] = Object.assign(Object.assign({}, domainRecipients[userId.id]), data);
140
- recipients[userId.domain] = domainRecipients;
141
- });
134
+ deleted.forEach(({ userId, data }) => data.forEach(clientId => delete initialPayloads.payloads[userId.domain][userId.id][clientId]));
135
+ if (Object.keys(mismatch.missing).length === 0) {
136
+ return initialPayloads;
142
137
  }
143
- return recipients;
138
+ const reencryptedResults = await this.proteusService.encrypt(plainText, mismatch.missing);
139
+ return (0, deepmerge_ts_1.deepmerge)(initialPayloads, reencryptedResults);
144
140
  }
145
141
  }
146
142
  exports.MessageService = MessageService;
@@ -104,7 +104,7 @@ describe('MessageService', () => {
104
104
  conversationId: { id: 'convid', domain: 'domain' },
105
105
  });
106
106
  expect(apiClient.api.conversation.postOTRMessage).toHaveBeenCalled();
107
- expect(result).toEqual(baseMessageSendingStatus);
107
+ expect(result).toEqual(Object.assign(Object.assign({}, baseMessageSendingStatus), { failed: undefined }));
108
108
  });
109
109
  it('should send regular to conversation', async () => {
110
110
  const [messageService, { apiClient }] = await buildMessageService();
@@ -8,7 +8,7 @@ import type { AddUsersToProteusConversationParams, CreateProteusConversationPara
8
8
  import { SendResult } from '../../../conversation';
9
9
  import type { EventHandlerResult } from '../../common.types';
10
10
  import { EventHandlerParams } from '../EventHandler';
11
- type EncryptionResult = {
11
+ export type EncryptionResult = {
12
12
  /** the encrypted payloads for the clients that have a valid sessions */
13
13
  payloads: QualifiedOTRRecipients;
14
14
  /** user-client that do not have prekeys on backend (deleted clients) */
@@ -47,5 +47,4 @@ export declare class ProteusService {
47
47
  encrypt(plainText: Uint8Array, recipients: QualifiedUserPreKeyBundleMap | QualifiedUserClients): Promise<EncryptionResult>;
48
48
  wipe(storeEngine?: CRUDEngine): Promise<void>;
49
49
  }
50
- export {};
51
50
  //# sourceMappingURL=ProteusService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProteusService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/ProteusService.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,EAAC,MAAM,EAAE,OAAO,EAAC,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EACV,YAAY,EAEZ,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAC,WAAW,EAAE,4BAA4B,EAAC,MAAM,8BAA8B,CAAC;AAI5F,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAI5C,OAAO,KAAK,EACV,mCAAmC,EACnC,+BAA+B,EAC/B,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAA0C,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAE1F,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAC,kBAAkB,EAAqB,MAAM,iBAAiB,CAAC;AAWvE,KAAK,gBAAgB,GAAG;IACtB,wEAAwE;IACxE,QAAQ,EAAE,sBAAsB,CAAC;IACjC,wEAAwE;IACxE,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,sGAAsG;IACtG,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC;AACF,qBAAa,cAAc;IAKvB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM;IANzB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2C;gBAG/C,SAAS,EAAE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E,OAAO,EAAE,OAAO;IAyB1D,YAAY,CAAC,OAAO,CAAC,EAAE,UAAU;IAIxC;;OAEG;IACI,mBAAmB;IAInB,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAIxE;;;;;;OAMG;IACU,oBAAoB,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAQ3E,kBAAkB,CAAC,EAC9B,gBAAgB,EAChB,YAAY,GACb,EAAE,+BAA+B,GAAG,OAAO,CAAC,YAAY,CAAC;IAiB7C,sBAAsB,CAAC,EAAC,cAAc,EAAE,gBAAgB,EAAC,EAAE,mCAAmC;IAI9F,WAAW,CAAC,EACvB,OAAO,EACP,cAAc,EACd,UAAU,EACV,UAAU,EACV,OAAO,EACP,gBAAgB,GACjB,EAAE,wBAAwB,GAAG,OAAO,CAAC,UAAU,CAAC;YA6CnC,OAAO;IAuBd,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM;IAQ7C,OAAO,CAClB,SAAS,EAAE,UAAU,EACrB,UAAU,EAAE,4BAA4B,GAAG,oBAAoB,GAC9D,OAAO,CAAC,gBAAgB,CAAC;IAiBtB,IAAI,CAAC,WAAW,CAAC,EAAE,UAAU;CAMpC"}
@@ -120,6 +120,7 @@ class ProteusService {
120
120
  return this.apiClient.api.conversation.postMembers(conversationId, qualifiedUserIds);
121
121
  }
122
122
  async sendMessage({ userIds, conversationId, nativePush, targetMode, payload, onClientMismatch, }) {
123
+ var _a;
123
124
  const messageParams = await (0, getGenericMessageParams_1.getGenericMessageParams)({
124
125
  apiClient: this.apiClient,
125
126
  sendingClientId: this.apiClient.validatedClientId,
@@ -141,8 +142,11 @@ class ProteusService {
141
142
  this.logger.log(`Successfully sent Proteus message to conversation '${conversationId.id}'`);
142
143
  }
143
144
  const sendingState = response.canceled ? conversation_1.MessageSendingState.CANCELED : conversation_1.MessageSendingState.OUTGOING_SENT;
144
- const failedToSend = 'failed_to_send' in response && Object.keys(response.failed_to_send).length > 0
145
- ? response.failed_to_send
145
+ const failedToSend = response.failed || Object.keys((_a = response.failed_to_send) !== null && _a !== void 0 ? _a : {}).length > 0
146
+ ? {
147
+ queued: response.failed_to_send,
148
+ failed: response.failed,
149
+ }
146
150
  : undefined;
147
151
  return {
148
152
  id: payload.messageId,
@@ -447,7 +447,8 @@ describe('ProteusService', () => {
447
447
  }));
448
448
  });
449
449
  });
450
- it(`returns the recipients that could not receive the message`, async () => {
450
+ it(`returns the recipients that will receive the message later`, async () => {
451
+ var _a;
451
452
  const [proteusService] = await (0, ProteusService_mocks_1.buildProteusService)();
452
453
  const recipients = {
453
454
  domain1: { user1: ['client1'], user2: ['client11', 'client12'] },
@@ -469,7 +470,7 @@ describe('ProteusService', () => {
469
470
  userIds: recipients,
470
471
  });
471
472
  expect(result.state).toBe(conversation_2.MessageSendingState.OUTGOING_SENT);
472
- expect(result.failedToSend).toEqual({ domain2: recipients.domain2 });
473
+ expect((_a = result.failedToSend) === null || _a === void 0 ? void 0 : _a.queued).toEqual({ domain2: recipients.domain2 });
473
474
  });
474
475
  });
475
476
  });
@@ -68,7 +68,7 @@ const createSessions = async ({ recipients, apiClient, cryptoClient }) => {
68
68
  recipients: prekeysBundle,
69
69
  cryptoClient,
70
70
  });
71
- return Object.assign(Object.assign({}, result), { failed });
71
+ return Object.assign(Object.assign({}, result), { failed: (failed === null || failed === void 0 ? void 0 : failed.length) ? failed : undefined });
72
72
  };
73
73
  /**
74
74
  * Will make sure all the sessions need to encrypt for those user/clients pair are set
package/package.json CHANGED
@@ -21,6 +21,7 @@
21
21
  "@wireapp/store-engine-dexie": "^2.0.5",
22
22
  "axios": "1.3.4",
23
23
  "bazinga64": "6.0.4",
24
+ "deepmerge-ts": "4.3.0",
24
25
  "hash.js": "1.1.7",
25
26
  "http-status-codes": "2.2.0",
26
27
  "idb": "7.1.1",
@@ -59,6 +60,6 @@
59
60
  "test:coverage": "jest --coverage",
60
61
  "watch": "tsc --watch"
61
62
  },
62
- "version": "39.1.6",
63
- "gitHead": "6696ac6e997832446324e5804fd3c690082b399a"
63
+ "version": "39.2.0",
64
+ "gitHead": "17a045a62b7f0b5628d3ab21fc58b720c9edf27e"
64
65
  }