diff --git a/package.json b/package.json index cdfeced02a..5accbafd8f 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ }, "dependencies": { "@popperjs/core": "2.9.2", - "@signalapp/signal-client": "0.8.4", + "@signalapp/signal-client": "0.9.0", "@sindresorhus/is": "0.8.0", "@types/pino": "6.3.6", "@types/pino-multi-stream": "5.1.0", diff --git a/ts/util/sendToGroup.ts b/ts/util/sendToGroup.ts index 5a4efecc53..a744ec7828 100644 --- a/ts/util/sendToGroup.ts +++ b/ts/util/sendToGroup.ts @@ -5,6 +5,7 @@ import { differenceWith, omit, partition } from 'lodash'; import PQueue from 'p-queue'; import { + ErrorCode, groupEncrypt, ProtocolAddress, sealedSenderMultiRecipientEncrypt, @@ -513,6 +514,25 @@ export async function sendToGroupViaSenderKey(options: { recursionCount: recursionCount + 1, }); } + if (error.code === ErrorCode.InvalidRegistrationId && error.addr) { + const address = error.addr as ProtocolAddress; + const name = address.name(); + + const brokenAccount = window.ConversationController.get(name); + if (brokenAccount) { + window.log.warn( + `sendToGroupViaSenderKey/${logId}: Disabling sealed sender for ${brokenAccount.idForLogging()}` + ); + brokenAccount.set({ sealedSender: SEALED_SENDER.DISABLED }); + window.Signal.Data.updateConversation(brokenAccount.attributes); + + // Now that we've eliminate this problematic account, we can try the send again. + return sendToGroupViaSenderKey({ + ...options, + recursionCount: recursionCount + 1, + }); + } + } throw new Error( `sendToGroupViaSenderKey/${logId}: Returned unexpected error ${ diff --git a/yarn.lock b/yarn.lock index c99167163a..30af384e05 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1651,10 +1651,10 @@ react-lifecycles-compat "^3.0.4" warning "^3.0.0" -"@signalapp/signal-client@0.8.4": - version "0.8.4" - resolved "https://registry.yarnpkg.com/@signalapp/signal-client/-/signal-client-0.8.4.tgz#fd633af5f821f06bb29c205bdcf660cd2bfbecd8" - integrity sha512-ae2ohILHNs+F1eDBoCeger2/iffMNDR8uIzp5hAa6szI3WZrf544M1d3jz8XDNejrXarSUmJ74jlsVeDMg12Ng== +"@signalapp/signal-client@0.9.0": + version "0.9.0" + resolved "https://registry.yarnpkg.com/@signalapp/signal-client/-/signal-client-0.9.0.tgz#af7e984b51131b5bb984661494cde0f9ebfd4a61" + integrity sha512-tT3sOUCUW0uD6Z2eCHrO2dtmhgkc9JH3NZFIanbuAM1bqyXeZoaqAZauRbTSI0p51RGmqHrT7wg/Nvh8bi9UeA== dependencies: node-gyp-build "^4.2.3" uuid "^8.3.0"