Uint8Array migration
This commit is contained in:
parent
daf75190b8
commit
4ef0bf96cc
137 changed files with 2202 additions and 3170 deletions
|
@ -9,7 +9,7 @@ import { normalizeNumber } from '../util/normalizeNumber';
|
|||
import { SignalService as Proto } from '../protobuf';
|
||||
import { deriveGroupFields } from '../groups';
|
||||
import * as Bytes from '../Bytes';
|
||||
import { deriveMasterKeyFromGroupV1, typedArrayToArrayBuffer } from '../Crypto';
|
||||
import { deriveMasterKeyFromGroupV1 } from '../Crypto';
|
||||
|
||||
import {
|
||||
ProcessedAttachment,
|
||||
|
@ -25,9 +25,6 @@ import {
|
|||
} from './Types.d';
|
||||
import { WarnOnlyError } from './Errors';
|
||||
|
||||
// TODO: remove once we move away from ArrayBuffers
|
||||
const FIXMEU8 = Uint8Array;
|
||||
|
||||
const FLAGS = Proto.DataMessage.Flags;
|
||||
export const ATTACHMENT_MAX = 32;
|
||||
|
||||
|
@ -57,9 +54,9 @@ export function processAttachment(
|
|||
};
|
||||
}
|
||||
|
||||
async function processGroupContext(
|
||||
function processGroupContext(
|
||||
group?: Proto.IGroupContext | null
|
||||
): Promise<ProcessedGroupContext | undefined> {
|
||||
): ProcessedGroupContext | undefined {
|
||||
if (!group) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -70,10 +67,8 @@ async function processGroupContext(
|
|||
'group context without type'
|
||||
);
|
||||
|
||||
const masterKey = await deriveMasterKeyFromGroupV1(
|
||||
typedArrayToArrayBuffer(group.id)
|
||||
);
|
||||
const data = deriveGroupFields(new FIXMEU8(masterKey));
|
||||
const masterKey = deriveMasterKeyFromGroupV1(group.id);
|
||||
const data = deriveGroupFields(masterKey);
|
||||
|
||||
const derivedGroupV2Id = Bytes.toBase64(data.id);
|
||||
|
||||
|
@ -266,7 +261,7 @@ export async function processDataMessage(
|
|||
).map((attachment: Proto.IAttachmentPointer) =>
|
||||
processAttachment(attachment)
|
||||
),
|
||||
group: await processGroupContext(message.group),
|
||||
group: processGroupContext(message.group),
|
||||
groupV2: processGroupV2Context(message.groupV2),
|
||||
flags: message.flags ?? 0,
|
||||
expireTimer: message.expireTimer ?? 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue