mirror of
https://github.com/element-hq/element-web.git
synced 2025-12-11 01:40:42 +00:00
Compare commits
5 Commits
v1.11.112
...
renovate/t
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e670bfe41 | ||
|
|
cb7382f235 | ||
|
|
f796dce34b | ||
|
|
523783706f | ||
|
|
0f530f6c01 |
@@ -307,7 +307,7 @@
|
||||
"terser-webpack-plugin": "^5.3.9",
|
||||
"testcontainers": "^11.0.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "5.8.3",
|
||||
"typescript": "5.9.2",
|
||||
"util": "^0.12.5",
|
||||
"vite": "^7.0.1",
|
||||
"vite-plugin-node-polyfills": "^0.24.0",
|
||||
|
||||
@@ -11,3 +11,50 @@ index 917a7fc..a2710c6 100644
|
||||
didOkOrSubmit: boolean;
|
||||
model: M;
|
||||
}>;
|
||||
diff --git a/node_modules/@matrix-org/react-sdk-module-api/lib/lifecycles/CryptoSetupExtensions.d.ts b/node_modules/@matrix-org/react-sdk-module-api/lib/lifecycles/CryptoSetupExtensions.d.ts
|
||||
index cb5f2e5..51daa51 100644
|
||||
--- a/node_modules/@matrix-org/react-sdk-module-api/lib/lifecycles/CryptoSetupExtensions.d.ts
|
||||
+++ b/node_modules/@matrix-org/react-sdk-module-api/lib/lifecycles/CryptoSetupExtensions.d.ts
|
||||
@@ -66,23 +66,23 @@ export interface SetupEncryptionStoreProjection {
|
||||
export interface ProvideCryptoSetupExtensions {
|
||||
examineLoginResponse(response: any, credentials: ExtendedMatrixClientCreds): void;
|
||||
persistCredentials(credentials: ExtendedMatrixClientCreds): void;
|
||||
- getSecretStorageKey(): Uint8Array | null;
|
||||
- createSecretStorageKey(): Uint8Array | null;
|
||||
+ getSecretStorageKey(): Uint8Array<ArrayBuffer> | null;
|
||||
+ createSecretStorageKey(): Uint8Array<ArrayBuffer> | null;
|
||||
catchAccessSecretStorageError(e: Error): void;
|
||||
setupEncryptionNeeded: (args: CryptoSetupArgs) => boolean;
|
||||
/** @deprecated This callback is no longer used by matrix-react-sdk */
|
||||
- getDehydrationKeyCallback(): ((keyInfo: SecretStorageKeyDescription, checkFunc: (key: Uint8Array) => void) => Promise<Uint8Array>) | null;
|
||||
+ getDehydrationKeyCallback(): ((keyInfo: SecretStorageKeyDescription, checkFunc: (key: Uint8Array<ArrayBuffer>) => void) => Promise<Uint8Array<ArrayBuffer>>) | null;
|
||||
SHOW_ENCRYPTION_SETUP_UI: boolean;
|
||||
}
|
||||
export declare abstract class CryptoSetupExtensionsBase implements ProvideCryptoSetupExtensions {
|
||||
abstract examineLoginResponse(response: any, credentials: ExtendedMatrixClientCreds): void;
|
||||
abstract persistCredentials(credentials: ExtendedMatrixClientCreds): void;
|
||||
- abstract getSecretStorageKey(): Uint8Array | null;
|
||||
- abstract createSecretStorageKey(): Uint8Array | null;
|
||||
+ abstract getSecretStorageKey(): Uint8Array<ArrayBuffer> | null;
|
||||
+ abstract createSecretStorageKey(): Uint8Array<ArrayBuffer> | null;
|
||||
abstract catchAccessSecretStorageError(e: Error): void;
|
||||
abstract setupEncryptionNeeded(args: CryptoSetupArgs): boolean;
|
||||
/** `getDehydrationKeyCallback` is no longer used; we provide an empty impl for type compatibility. */
|
||||
- getDehydrationKeyCallback(): ((keyInfo: SecretStorageKeyDescription, checkFunc: (key: Uint8Array) => void) => Promise<Uint8Array>) | null;
|
||||
+ getDehydrationKeyCallback(): ((keyInfo: SecretStorageKeyDescription, checkFunc: (key: Uint8Array<ArrayBuffer>) => void) => Promise<Uint8Array<ArrayBuffer>>) | null;
|
||||
abstract SHOW_ENCRYPTION_SETUP_UI: boolean;
|
||||
}
|
||||
export interface CryptoSetupArgs {
|
||||
@@ -98,9 +98,9 @@ export declare class DefaultCryptoSetupExtensions extends CryptoSetupExtensionsB
|
||||
SHOW_ENCRYPTION_SETUP_UI: boolean;
|
||||
examineLoginResponse(response: any, credentials: ExtendedMatrixClientCreds): void;
|
||||
persistCredentials(credentials: ExtendedMatrixClientCreds): void;
|
||||
- getSecretStorageKey(): Uint8Array | null;
|
||||
- createSecretStorageKey(): Uint8Array | null;
|
||||
+ getSecretStorageKey(): Uint8Array<ArrayBuffer> | null;
|
||||
+ createSecretStorageKey(): Uint8Array<ArrayBuffer> | null;
|
||||
catchAccessSecretStorageError(e: Error): void;
|
||||
setupEncryptionNeeded(args: CryptoSetupArgs): boolean;
|
||||
- getDehydrationKeyCallback(): ((keyInfo: SecretStorageKeyDescription, checkFunc: (key: Uint8Array) => void) => Promise<Uint8Array>) | null;
|
||||
+ getDehydrationKeyCallback(): ((keyInfo: SecretStorageKeyDescription, checkFunc: (key: Uint8Array<ArrayBuffer>) => void) => Promise<Uint8Array<ArrayBuffer>>) | null;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import InteractiveAuthDialog from "./components/views/dialogs/InteractiveAuthDia
|
||||
// during the same single operation. Use `accessSecretStorage` below to scope a
|
||||
// single secret storage operation, as it will clear the cached keys once the
|
||||
// operation ends.
|
||||
let secretStorageKeys: Record<string, Uint8Array> = {};
|
||||
let secretStorageKeys: Record<string, Uint8Array<ArrayBuffer>> = {};
|
||||
let secretStorageKeyInfo: Record<string, SecretStorage.SecretStorageKeyDescription> = {};
|
||||
let secretStorageBeingAccessed = false;
|
||||
|
||||
@@ -51,8 +51,8 @@ export class AccessCancelledError extends Error {
|
||||
|
||||
function makeInputToKey(
|
||||
keyInfo: SecretStorage.SecretStorageKeyDescription,
|
||||
): (keyParams: KeyParams) => Promise<Uint8Array> {
|
||||
return async ({ passphrase, recoveryKey }): Promise<Uint8Array> => {
|
||||
): (keyParams: KeyParams) => Promise<Uint8Array<ArrayBuffer>> {
|
||||
return async ({ passphrase, recoveryKey }): Promise<Uint8Array<ArrayBuffer>> => {
|
||||
if (passphrase) {
|
||||
return deriveRecoveryKeyFromPassphrase(passphrase, keyInfo.passphrase.salt, keyInfo.passphrase.iterations);
|
||||
} else if (recoveryKey) {
|
||||
@@ -69,7 +69,7 @@ async function getSecretStorageKey(
|
||||
keys: Record<string, SecretStorage.SecretStorageKeyDescription>;
|
||||
},
|
||||
secretName: string,
|
||||
): Promise<[string, Uint8Array]> {
|
||||
): Promise<[string, Uint8Array<ArrayBuffer>]> {
|
||||
const cli = MatrixClientPeg.safeGet();
|
||||
const defaultKeyId = await cli.secretStorage.getDefaultKeyId();
|
||||
|
||||
@@ -139,7 +139,7 @@ async function getSecretStorageKey(
|
||||
function cacheSecretStorageKey(
|
||||
keyId: string,
|
||||
keyInfo: SecretStorage.SecretStorageKeyDescription,
|
||||
key: Uint8Array,
|
||||
key: Uint8Array<ArrayBuffer>,
|
||||
): void {
|
||||
if (secretStorageBeingAccessed) {
|
||||
logger.debug(`Caching 4S key ${keyId}`);
|
||||
|
||||
@@ -124,7 +124,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent<IProp
|
||||
if (keyFromCustomisations) this.initExtension(keyFromCustomisations);
|
||||
}
|
||||
|
||||
private initExtension(keyFromCustomisations: Uint8Array): void {
|
||||
private initExtension(keyFromCustomisations: Uint8Array<ArrayBuffer>): void {
|
||||
logger.log("CryptoSetupExtension: Created key via extension, jumping to bootstrap step");
|
||||
this.recoveryKey = {
|
||||
privateKey: keyFromCustomisations,
|
||||
|
||||
@@ -142,7 +142,7 @@ export class VoiceMessageRecording implements IDestroyable {
|
||||
this.buffer = concat(this.buffer, buf);
|
||||
};
|
||||
|
||||
private get audioBuffer(): Uint8Array {
|
||||
private get audioBuffer(): Uint8Array<ArrayBuffer> {
|
||||
// We need a clone of the buffer to avoid accidentally changing the position
|
||||
// on the real thing.
|
||||
return this.buffer.slice(0);
|
||||
|
||||
@@ -58,14 +58,14 @@ export async function decryptMegolmKeyFile(data: ArrayBuffer, password: string):
|
||||
throw friendlyError("Invalid file: too short", _t("encryption|import_invalid_keyfile", { brand }));
|
||||
}
|
||||
|
||||
const salt = body.subarray(1, 1 + 16);
|
||||
const iv = body.subarray(17, 17 + 16);
|
||||
const salt = body.subarray(1, 1 + 16).slice();
|
||||
const iv = body.subarray(17, 17 + 16).slice();
|
||||
const iterations = (body[33] << 24) | (body[34] << 16) | (body[35] << 8) | body[36];
|
||||
const ciphertext = body.subarray(37, 37 + ciphertextLength);
|
||||
const hmac = body.subarray(-32);
|
||||
const ciphertext = body.subarray(37, 37 + ciphertextLength).slice();
|
||||
const hmac = body.subarray(-32).slice();
|
||||
|
||||
const [aesKey, hmacKey] = await deriveKeys(salt, iterations, password);
|
||||
const toVerify = body.subarray(0, -32);
|
||||
const toVerify = body.subarray(0, -32).slice();
|
||||
|
||||
let isValid;
|
||||
try {
|
||||
@@ -180,7 +180,11 @@ export async function encryptMegolmKeyFile(
|
||||
* @param {String} password password
|
||||
* @return {Promise<[CryptoKey, CryptoKey]>} promise for [aes key, hmac key]
|
||||
*/
|
||||
async function deriveKeys(salt: Uint8Array, iterations: number, password: string): Promise<[CryptoKey, CryptoKey]> {
|
||||
async function deriveKeys(
|
||||
salt: Uint8Array<ArrayBuffer>,
|
||||
iterations: number,
|
||||
password: string,
|
||||
): Promise<[CryptoKey, CryptoKey]> {
|
||||
const start = new Date();
|
||||
|
||||
let key;
|
||||
|
||||
@@ -297,8 +297,8 @@ export class GroupedArray<K, T> {
|
||||
}
|
||||
}
|
||||
|
||||
export const concat = (...arrays: Uint8Array[]): Uint8Array => {
|
||||
return arrays.reduce((concatenatedSoFar: Uint8Array, toBeConcatenated: Uint8Array) => {
|
||||
export const concat = (...arrays: Uint8Array<ArrayBuffer>[]): Uint8Array<ArrayBuffer> => {
|
||||
return arrays.reduce((concatenatedSoFar: Uint8Array<ArrayBuffer>, toBeConcatenated: Uint8Array<ArrayBuffer>) => {
|
||||
const concatenated = new Uint8Array(concatenatedSoFar.length + toBeConcatenated.length);
|
||||
concatenated.set(concatenatedSoFar, 0);
|
||||
concatenated.set(toBeConcatenated, concatenatedSoFar.length);
|
||||
|
||||
@@ -48,7 +48,7 @@ export interface EncryptedPickleKey {
|
||||
* @param {string} deviceId The device ID which owns the pickle key.
|
||||
* @return {Uint8Array} The additional data as a Uint8Array.
|
||||
*/
|
||||
export function getPickleAdditionalData(userId: string, deviceId: string): Uint8Array {
|
||||
export function getPickleAdditionalData(userId: string, deviceId: string): Uint8Array<ArrayBuffer> {
|
||||
const additionalData = new Uint8Array(userId.length + deviceId.length + 1);
|
||||
for (let i = 0; i < userId.length; i++) {
|
||||
additionalData[i] = userId.charCodeAt(i);
|
||||
@@ -70,7 +70,7 @@ export function getPickleAdditionalData(userId: string, deviceId: string): Uint8
|
||||
* @returns Data object ready for storing in indexeddb.
|
||||
*/
|
||||
export async function encryptPickleKey(
|
||||
pickleKey: Uint8Array,
|
||||
pickleKey: Uint8Array<ArrayBuffer>,
|
||||
userId: string,
|
||||
deviceId: string,
|
||||
): Promise<EncryptedPickleKey | undefined> {
|
||||
|
||||
@@ -39,7 +39,7 @@ export const HAS_REFRESH_TOKEN_STORAGE_KEY = "mx_has_refresh_token";
|
||||
* @param pickleKey
|
||||
* @returns AES key
|
||||
*/
|
||||
async function pickleKeyToAesKey(pickleKey: string): Promise<Uint8Array> {
|
||||
async function pickleKeyToAesKey(pickleKey: string): Promise<Uint8Array<ArrayBuffer>> {
|
||||
const pickleKeyBuffer = new Uint8Array(pickleKey.length);
|
||||
for (let i = 0; i < pickleKey.length; i++) {
|
||||
pickleKeyBuffer[i] = pickleKey.charCodeAt(i);
|
||||
|
||||
@@ -64,7 +64,8 @@ global.URL.revokeObjectURL = jest.fn();
|
||||
|
||||
// polyfilling TextEncoder as it is not available on JSDOM
|
||||
// view https://github.com/facebook/jest/issues/9983
|
||||
global.TextEncoder = TextEncoder;
|
||||
// XXX: Node's implementation has marginally different types, so we fudge it
|
||||
(globalThis as any).TextEncoder = TextEncoder;
|
||||
// @ts-ignore
|
||||
global.TextDecoder = TextDecoder;
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ describe("VoiceMessageRecording", () => {
|
||||
const encryptedFile = {} as unknown as EncryptedFile;
|
||||
|
||||
beforeEach(() => {
|
||||
voiceRecording.onDataAvailable!(testBuf);
|
||||
voiceRecording.onDataAvailable!(testBuf.buffer);
|
||||
});
|
||||
|
||||
it("contentLength should return the buffer length", () => {
|
||||
|
||||
@@ -59,8 +59,8 @@ const TEST_VECTORS = [
|
||||
],
|
||||
];
|
||||
|
||||
function stringToArray(s: string): ArrayBufferLike {
|
||||
return new TextEncoder().encode(s).buffer;
|
||||
function stringToArray(s: string): ArrayBuffer {
|
||||
return new TextEncoder().encode(s).buffer as ArrayBuffer;
|
||||
}
|
||||
|
||||
describe("MegolmExportEncryption", function () {
|
||||
|
||||
12
yarn.lock
12
yarn.lock
@@ -4712,7 +4712,7 @@
|
||||
classnames "^2.5.1"
|
||||
vaul "^1.0.0"
|
||||
|
||||
"@vector-im/matrix-wysiwyg-wasm@link:../../../.cache/yarn/v6/npm-@vector-im-matrix-wysiwyg-2.39.0-a6238e517f23a2f3025d9c65445914771c63b163-integrity/node_modules/bindings/wysiwyg-wasm":
|
||||
"@vector-im/matrix-wysiwyg-wasm@link:../../../Library/Caches/Yarn/v6/npm-@vector-im-matrix-wysiwyg-2.39.0-a6238e517f23a2f3025d9c65445914771c63b163-integrity/node_modules/bindings/wysiwyg-wasm":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
@@ -4721,7 +4721,7 @@
|
||||
resolved "https://registry.yarnpkg.com/@vector-im/matrix-wysiwyg/-/matrix-wysiwyg-2.39.0.tgz#a6238e517f23a2f3025d9c65445914771c63b163"
|
||||
integrity sha512-OROXnzPcQWrCMoUpIrCKEC4FYU+9SsRomUgu+VbJwWtBDkCbfvLD4z6w/mgiADw3iTUpBPgmcWJoGxesFuB20Q==
|
||||
dependencies:
|
||||
"@vector-im/matrix-wysiwyg-wasm" "link:../../../Library/Caches/Yarn/v6/npm-@vector-im-matrix-wysiwyg-2.39.0-a6238e517f23a2f3025d9c65445914771c63b163-integrity/node_modules/bindings/wysiwyg-wasm"
|
||||
"@vector-im/matrix-wysiwyg-wasm" "link:../../Library/Caches/Yarn/v6/npm-@vector-im-matrix-wysiwyg-2.39.0-a6238e517f23a2f3025d9c65445914771c63b163-integrity/node_modules/bindings/wysiwyg-wasm"
|
||||
|
||||
"@vitest/expect@3.2.4":
|
||||
version "3.2.4"
|
||||
@@ -15163,10 +15163,10 @@ typedarray-to-buffer@^3.1.5:
|
||||
dependencies:
|
||||
is-typedarray "^1.0.0"
|
||||
|
||||
typescript@5.8.3:
|
||||
version "5.8.3"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.8.3.tgz#92f8a3e5e3cf497356f4178c34cd65a7f5e8440e"
|
||||
integrity sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==
|
||||
typescript@5.9.2:
|
||||
version "5.9.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.2.tgz#d93450cddec5154a2d5cabe3b8102b83316fb2a6"
|
||||
integrity sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==
|
||||
|
||||
ua-parser-js@^1.0.2:
|
||||
version "1.0.40"
|
||||
|
||||
Reference in New Issue
Block a user