Skip to content

Commit

Permalink
Update to libsignal-client@0.9.0, handle new invalid registration error
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal committed Sep 2, 2021
1 parent 9ca9f74 commit 5bf3720
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
20 changes: 20 additions & 0 deletions ts/util/sendToGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { differenceWith, omit, partition } from 'lodash';
import PQueue from 'p-queue';

import {
ErrorCode,
groupEncrypt,
ProtocolAddress,
sealedSenderMultiRecipientEncrypt,
Expand Down Expand Up @@ -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 ${
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 5bf3720

Please sign in to comment.