Edit distribution lists via story settings menu
This commit is contained in:
parent
9986d10947
commit
e321e1fea8
42 changed files with 2403 additions and 102 deletions
19
ts/Crypto.ts
19
ts/Crypto.ts
|
@ -1,9 +1,8 @@
|
|||
// Copyright 2020-2021 Signal Messenger, LLC
|
||||
// Copyright 2020-2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { Buffer } from 'buffer';
|
||||
import pProps from 'p-props';
|
||||
import { chunk } from 'lodash';
|
||||
import Long from 'long';
|
||||
import { HKDF } from '@signalapp/libsignal-client';
|
||||
|
||||
|
@ -15,6 +14,8 @@ import { ProfileDecryptError } from './types/errors';
|
|||
import { UUID, UUID_BYTE_SIZE } from './types/UUID';
|
||||
import type { UUIDStringType } from './types/UUID';
|
||||
|
||||
export { uuidToBytes } from './util/uuidToBytes';
|
||||
|
||||
export { HashType, CipherType };
|
||||
|
||||
const PROFILE_IV_LENGTH = 12; // bytes
|
||||
|
@ -448,20 +449,6 @@ export async function encryptCdsDiscoveryRequest(
|
|||
};
|
||||
}
|
||||
|
||||
export function uuidToBytes(uuid: string): Uint8Array {
|
||||
if (uuid.length !== 36) {
|
||||
log.warn(
|
||||
'uuidToBytes: received a string of invalid length. ' +
|
||||
'Returning an empty Uint8Array'
|
||||
);
|
||||
return new Uint8Array(0);
|
||||
}
|
||||
|
||||
return Uint8Array.from(
|
||||
chunk(uuid.replace(/-/g, ''), 2).map(pair => parseInt(pair.join(''), 16))
|
||||
);
|
||||
}
|
||||
|
||||
export function bytesToUuid(bytes: Uint8Array): undefined | UUIDStringType {
|
||||
if (bytes.byteLength !== UUID_BYTE_SIZE) {
|
||||
log.warn(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue