Sender Key: Prepare for production

This commit is contained in:
Scott Nonnenberg 2021-06-08 14:51:58 -07:00 committed by GitHub
parent f226822dff
commit bff3f0c74a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 334 additions and 183 deletions

View file

@ -16,6 +16,7 @@ import {
padMessage,
SenderCertificateMode,
} from '../textsecure/OutgoingMessage';
import { isEnabled } from '../RemoteConfig';
import { isOlderThan } from './timestamp';
import {
@ -116,6 +117,7 @@ export async function sendContentMessageToGroup({
const ourConversation = window.ConversationController.get(ourConversationId);
if (
isEnabled('desktop.sendSenderKey') &&
ourConversation?.get('capabilities')?.senderKey &&
isGroupV2(conversation.attributes)
) {
@ -199,8 +201,9 @@ export async function sendToGroupViaSenderKey(options: {
}
if (
contentHint !== ContentHint.DEFAULT &&
contentHint !== ContentHint.RESENDABLE &&
contentHint !== ContentHint.SUPPLEMENTARY
contentHint !== ContentHint.IMPLICIT
) {
throw new Error(
`sendToGroupViaSenderKey/${logId}: Invalid contentHint ${contentHint}`
@ -326,7 +329,7 @@ export async function sendToGroupViaSenderKey(options: {
);
await window.textsecure.messaging.sendSenderKeyDistributionMessage(
{
contentHint: ContentHint.SUPPLEMENTARY,
contentHint: ContentHint.DEFAULT,
distributionId,
groupId,
identifiers: newToMemberUuids,