mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-02 08:13:37 +01:00
Replace typescript compiler with native tsgo compiler
This commit is contained in:
@@ -301,7 +301,7 @@ function specToBytes<Input, Output>(
|
||||
spec: ObjectMappingSpecType,
|
||||
data: Input
|
||||
): Output {
|
||||
return mapObjectWithSpec<string, Uint8Array>(spec, data, x =>
|
||||
return mapObjectWithSpec<string, Uint8Array<ArrayBuffer>>(spec, data, x =>
|
||||
Bytes.fromBase64(x)
|
||||
);
|
||||
}
|
||||
@@ -310,7 +310,7 @@ function specFromBytes<Input, Output>(
|
||||
spec: ObjectMappingSpecType,
|
||||
data: Input
|
||||
): Output {
|
||||
return mapObjectWithSpec<Uint8Array, string>(spec, data, x =>
|
||||
return mapObjectWithSpec<Uint8Array<ArrayBuffer>, string>(spec, data, x =>
|
||||
Bytes.toBase64(x)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ export type IdentityKeyType = {
|
||||
firstUse: boolean;
|
||||
id: ServiceIdString | `conversation:${string}`;
|
||||
nonblockingApproval: boolean;
|
||||
publicKey: Uint8Array;
|
||||
publicKey: Uint8Array<ArrayBuffer>;
|
||||
timestamp: number;
|
||||
verified: number;
|
||||
};
|
||||
@@ -239,7 +239,7 @@ export type KyberPreKeyType = {
|
||||
id: PreKeyIdType;
|
||||
|
||||
createdAt: number;
|
||||
data: Uint8Array;
|
||||
data: Uint8Array<ArrayBuffer>;
|
||||
isConfirmed: boolean;
|
||||
isLastResort: boolean;
|
||||
keyId: number;
|
||||
@@ -254,8 +254,8 @@ export type PreKeyType = {
|
||||
createdAt: number;
|
||||
keyId: number;
|
||||
ourServiceId: ServiceIdString;
|
||||
privateKey: Uint8Array;
|
||||
publicKey: Uint8Array;
|
||||
privateKey: Uint8Array<ArrayBuffer>;
|
||||
publicKey: Uint8Array<ArrayBuffer>;
|
||||
};
|
||||
|
||||
export type StoredPreKeyType = PreKeyType & {
|
||||
@@ -281,14 +281,14 @@ export type ClientSearchResultMessageType = MessageType & {
|
||||
|
||||
export type SentProtoType = {
|
||||
contentHint: number;
|
||||
proto: Uint8Array;
|
||||
proto: Uint8Array<ArrayBuffer>;
|
||||
timestamp: number;
|
||||
urgent: boolean;
|
||||
hasPniSignatureMessage: boolean;
|
||||
};
|
||||
export type SentProtoDBType = {
|
||||
contentHint: number;
|
||||
proto: Uint8Array;
|
||||
proto: Uint8Array<ArrayBuffer>;
|
||||
timestamp: number;
|
||||
urgent: number;
|
||||
hasPniSignatureMessage: number;
|
||||
@@ -317,7 +317,7 @@ export type SenderKeyType = {
|
||||
senderId: string;
|
||||
distributionId: string;
|
||||
// Raw data to serialize/deserialize into signal-client SenderKeyRecord
|
||||
data: Uint8Array;
|
||||
data: Uint8Array<ArrayBuffer>;
|
||||
lastUpdatedDate: number;
|
||||
};
|
||||
export type SenderKeyIdType = SenderKeyType['id'];
|
||||
@@ -327,7 +327,7 @@ export type SessionType = {
|
||||
serviceId: ServiceIdString;
|
||||
conversationId: string;
|
||||
deviceId: number;
|
||||
record: Uint8Array;
|
||||
record: Uint8Array<ArrayBuffer>;
|
||||
};
|
||||
export type SessionIdType = SessionType['id'];
|
||||
export type SignedPreKeyType = {
|
||||
@@ -336,8 +336,8 @@ export type SignedPreKeyType = {
|
||||
ourServiceId: ServiceIdString;
|
||||
id: `${ServiceIdString}:${number}`;
|
||||
keyId: number;
|
||||
privateKey: Uint8Array;
|
||||
publicKey: Uint8Array;
|
||||
privateKey: Uint8Array<ArrayBuffer>;
|
||||
publicKey: Uint8Array<ArrayBuffer>;
|
||||
};
|
||||
export type StoredSignedPreKeyType = {
|
||||
confirmed: boolean;
|
||||
@@ -381,7 +381,7 @@ export type StickerPackStatusType = (typeof StickerPackStatuses)[number];
|
||||
export type StorageServiceFieldsType = Readonly<{
|
||||
storageID?: string | null;
|
||||
storageVersion?: number | null;
|
||||
storageUnknownFields?: Uint8Array | null;
|
||||
storageUnknownFields?: Uint8Array<ArrayBuffer> | null;
|
||||
storageNeedsSync: boolean;
|
||||
}>;
|
||||
|
||||
@@ -441,7 +441,7 @@ export type UnprocessedType = {
|
||||
attempts: number;
|
||||
type: number;
|
||||
isEncrypted: boolean;
|
||||
content: Uint8Array;
|
||||
content: Uint8Array<ArrayBuffer>;
|
||||
|
||||
messageAgeSec: number;
|
||||
source: string | undefined;
|
||||
@@ -453,7 +453,7 @@ export type UnprocessedType = {
|
||||
serverTimestamp: number;
|
||||
urgent: boolean;
|
||||
story: boolean;
|
||||
reportingToken: Uint8Array | undefined;
|
||||
reportingToken: Uint8Array<ArrayBuffer> | undefined;
|
||||
groupId: string | undefined;
|
||||
};
|
||||
|
||||
@@ -675,7 +675,7 @@ export type NonAttachmentMediaItemDBType =
|
||||
export type KyberPreKeyTripleType = Readonly<{
|
||||
id: PreKeyIdType;
|
||||
signedPreKeyId: number;
|
||||
baseKey: Uint8Array;
|
||||
baseKey: Uint8Array<ArrayBuffer>;
|
||||
}>;
|
||||
|
||||
export type GetMessagesBetweenOptions = Readonly<{
|
||||
@@ -1074,7 +1074,7 @@ type ReadableInterface = {
|
||||
hasMegaphone: (megaphoneId: RemoteMegaphoneId) => boolean;
|
||||
|
||||
getAllKTAcis: () => ReadonlyArray<AciString>;
|
||||
getKTAccountData: (aci: AciString) => Uint8Array | undefined;
|
||||
getKTAccountData: (aci: AciString) => Uint8Array<ArrayBuffer> | undefined;
|
||||
|
||||
getAllPinnedMessages: () => ReadonlyArray<PinnedMessage>;
|
||||
getPinnedMessagesPreloadDataForConversation: (
|
||||
@@ -1450,7 +1450,7 @@ type WritableInterface = {
|
||||
internalDeleteAllMegaphones: () => number;
|
||||
|
||||
removeAllKTAccountData: () => void;
|
||||
setKTAccountData: (aci: AciString, data: Uint8Array) => void;
|
||||
setKTAccountData: (aci: AciString, data: Uint8Array<ArrayBuffer>) => void;
|
||||
|
||||
appendPinnedMessage: (
|
||||
pinnedMessagesLimit: number,
|
||||
|
||||
@@ -346,7 +346,7 @@ type StickerRow = Readonly<{
|
||||
type StorageServiceRowFields = Readonly<{
|
||||
storageID?: string;
|
||||
storageVersion?: number;
|
||||
storageUnknownFields?: Uint8Array | null;
|
||||
storageUnknownFields?: Uint8Array<ArrayBuffer> | null;
|
||||
storageNeedsSync: number;
|
||||
}>;
|
||||
type InstalledStickerPackRow = Readonly<{
|
||||
@@ -2978,9 +2978,9 @@ function getAndProtectExistingAttachmentPath(
|
||||
screenshotVersion,
|
||||
screenshotContentType,
|
||||
screenshotSize
|
||||
FROM message_attachments
|
||||
WHERE
|
||||
plaintextHash = ${plaintextHash} AND
|
||||
FROM message_attachments
|
||||
WHERE
|
||||
plaintextHash = ${plaintextHash} AND
|
||||
path IS NOT NULL AND
|
||||
version = ${version} AND
|
||||
contentType = ${contentType}
|
||||
@@ -3017,7 +3017,7 @@ function _protectAttachmentPathFromDeletion(
|
||||
const [protectQuery, protectParams] = sql`
|
||||
INSERT OR REPLACE INTO attachments_protected_from_deletion
|
||||
(path, messageId)
|
||||
VALUES
|
||||
VALUES
|
||||
(${path}, ${messageId});
|
||||
`;
|
||||
db.prepare(protectQuery).run(protectParams);
|
||||
@@ -3038,11 +3038,11 @@ function getAllProtectedAttachmentPaths(db: ReadableDB): Array<string> {
|
||||
function isAttachmentSafeToDelete(db: ReadableDB, path: string): boolean {
|
||||
const [query, params] = sql`
|
||||
SELECT EXISTS (
|
||||
SELECT 1 FROM attachments_protected_from_deletion
|
||||
SELECT 1 FROM attachments_protected_from_deletion
|
||||
WHERE path = ${path}
|
||||
UNION ALL
|
||||
SELECT 1 FROM message_attachments
|
||||
WHERE
|
||||
SELECT 1 FROM message_attachments
|
||||
WHERE
|
||||
path = ${path} OR
|
||||
thumbnailPath = ${path} OR
|
||||
screenshotPath = ${path} OR
|
||||
@@ -3058,7 +3058,7 @@ function getMostRecentAttachmentUploadData(
|
||||
plaintextHash: string
|
||||
): ExistingAttachmentUploadData | undefined {
|
||||
const [query, params] = sql`
|
||||
SELECT
|
||||
SELECT
|
||||
key,
|
||||
digest,
|
||||
transitCdnKey AS cdnKey,
|
||||
@@ -3068,7 +3068,7 @@ function getMostRecentAttachmentUploadData(
|
||||
incrementalMacChunkSize as chunkSize
|
||||
FROM message_attachments
|
||||
INDEXED BY message_attachments_plaintextHash
|
||||
WHERE
|
||||
WHERE
|
||||
plaintextHash = ${plaintextHash} AND
|
||||
key IS NOT NULL AND
|
||||
digest IS NOT NULL AND
|
||||
|
||||
@@ -7,6 +7,7 @@ import { createLogger } from '../logging/log.std.js';
|
||||
import { isIterable } from '../util/iterables.std.js';
|
||||
|
||||
import { toNumber } from '../util/toNumber.std.js';
|
||||
import { isNonSharedUint8Array } from '../Bytes.std.js';
|
||||
|
||||
const { isPlainObject } = lodash;
|
||||
|
||||
@@ -42,7 +43,7 @@ type CleanedDataValue =
|
||||
| boolean
|
||||
| null
|
||||
| undefined
|
||||
| Uint8Array
|
||||
| Uint8Array<ArrayBuffer>
|
||||
| CleanedObject
|
||||
| CleanedArray;
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
@@ -129,7 +130,7 @@ function cleanDataInner(
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (data instanceof Uint8Array) {
|
||||
if (isNonSharedUint8Array(data)) {
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ type NextSessionRowType = Readonly<{
|
||||
ourServiceId: string;
|
||||
serviceId: string;
|
||||
deviceId: number;
|
||||
record: Buffer;
|
||||
record: Buffer<ArrayBuffer>;
|
||||
}>;
|
||||
|
||||
function migrateSession(
|
||||
|
||||
@@ -224,9 +224,10 @@ export function updateCallLinkAdminKeyByRoomId(
|
||||
}
|
||||
|
||||
function assertRoomIdMatchesRootKey(roomId: string, rootKey: string): void {
|
||||
const derivedRoomId = Bytes.toHex(
|
||||
CallLinkRootKey.parse(rootKey).deriveRoomId()
|
||||
);
|
||||
const parsedRoomId = CallLinkRootKey.parse(rootKey).deriveRoomId();
|
||||
// @ts-expect-error needs ringrtc update
|
||||
const derivedRoomIdBytes: Uint8Array<ArrayBuffer> = parsedRoomId;
|
||||
const derivedRoomId = Bytes.toHex(derivedRoomIdBytes);
|
||||
strictAssert(
|
||||
roomId === derivedRoomId,
|
||||
'passed roomId must match roomId derived from root key'
|
||||
|
||||
@@ -15,19 +15,21 @@ export function getAllKTAcis(db: ReadableDB): Array<AciString> {
|
||||
export function getKTAccountData(
|
||||
db: ReadableDB,
|
||||
aci: AciString
|
||||
): Uint8Array | undefined {
|
||||
): Uint8Array<ArrayBuffer> | undefined {
|
||||
const [query, params] = sql`
|
||||
SELECT data
|
||||
FROM key_transparency_account_data
|
||||
WHERE aci IS ${aci}
|
||||
`;
|
||||
return db.prepare(query, { pluck: true }).get<Uint8Array>(params);
|
||||
return db
|
||||
.prepare(query, { pluck: true })
|
||||
.get<Uint8Array<ArrayBuffer>>(params);
|
||||
}
|
||||
|
||||
export function setKTAccountData(
|
||||
db: WritableDB,
|
||||
aci: AciString,
|
||||
data: Uint8Array
|
||||
data: Uint8Array<ArrayBuffer>
|
||||
): void {
|
||||
const [query, params] = sql`
|
||||
INSERT OR REPLACE INTO key_transparency_account_data
|
||||
|
||||
@@ -38,7 +38,11 @@ export function jsonToObject<T>(json: string): T {
|
||||
return JSON.parse(json);
|
||||
}
|
||||
|
||||
export type QueryTemplateParam = Uint8Array | string | number | null;
|
||||
export type QueryTemplateParam =
|
||||
| Uint8Array<ArrayBuffer>
|
||||
| string
|
||||
| number
|
||||
| null;
|
||||
export type QueryFragmentValue = QueryFragment | QueryTemplateParam;
|
||||
|
||||
export class QueryFragment {
|
||||
|
||||
Reference in New Issue
Block a user