Update all Uint8Array/Buffer to use ArrayBuffer

Co-authored-by: Jordan Rose <jrose@signal.org>
This commit is contained in:
Jamie
2026-03-16 18:55:17 -07:00
committed by GitHub
parent 863219012f
commit 8bfbd12323
110 changed files with 838 additions and 762 deletions

View File

@@ -9,11 +9,13 @@ import * as Native from '../../Native.js';
export const UNCHECKED_AND_UNCLONED: unique symbol = Symbol();
export default class ByteArray {
contents: Uint8Array;
contents: Uint8Array<ArrayBuffer>;
protected constructor(
contents: Uint8Array,
checkValid: ((contents: Uint8Array) => void) | typeof UNCHECKED_AND_UNCLONED
contents: Uint8Array<ArrayBuffer>,
checkValid:
| ((contents: Uint8Array<ArrayBuffer>) => void)
| typeof UNCHECKED_AND_UNCLONED
) {
if (checkValid === UNCHECKED_AND_UNCLONED) {
this.contents = contents;
@@ -25,7 +27,7 @@ export default class ByteArray {
protected static checkLength(
expectedLength: number
): (contents: Uint8Array) => void {
): (contents: Uint8Array<ArrayBuffer>) => void {
return (contents) => {
if (contents.length !== expectedLength) {
throw new LibSignalErrorBase(
@@ -37,11 +39,11 @@ export default class ByteArray {
};
}
public getContents(): Uint8Array {
public getContents(): Uint8Array<ArrayBuffer> {
return this.contents;
}
public serialize(): Uint8Array {
public serialize(): Uint8Array<ArrayBuffer> {
return Uint8Array.from(this.contents);
}
}