mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-14 11:10:29 +03:00
upgrade to matrix-js-sdk v37.5.0 (#2327)
* upgrade to js-sdk 37 * fix server crypto wasm locally
This commit is contained in:
parent
6ddcf2cb02
commit
387ce9c462
8 changed files with 96 additions and 51 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import React, { FormEventHandler, useCallback } from 'react';
|
||||
import { Box, Text, Button, Spinner, color } from 'folds';
|
||||
import { decodeRecoveryKey } from 'matrix-js-sdk/lib/crypto-api';
|
||||
import { deriveKey } from 'matrix-js-sdk/lib/crypto/key_passphrase';
|
||||
import { decodeRecoveryKey, deriveRecoveryKeyFromPassphrase } from 'matrix-js-sdk/lib/crypto-api';
|
||||
import { PasswordInput } from './password-input';
|
||||
import {
|
||||
SecretStorageKeyContent,
|
||||
|
|
@ -29,11 +28,16 @@ export function SecretStorageRecoveryPassphrase({
|
|||
const [driveKeyState, submitPassphrase] = useAsyncCallback<
|
||||
Uint8Array,
|
||||
Error,
|
||||
Parameters<typeof deriveKey>
|
||||
Parameters<typeof deriveRecoveryKeyFromPassphrase>
|
||||
>(
|
||||
useCallback(
|
||||
async (passphrase, salt, iterations, bits) => {
|
||||
const decodedRecoveryKey = await deriveKey(passphrase, salt, iterations, bits);
|
||||
const decodedRecoveryKey = await deriveRecoveryKeyFromPassphrase(
|
||||
passphrase,
|
||||
salt,
|
||||
iterations,
|
||||
bits
|
||||
);
|
||||
|
||||
const match = await mx.secretStorage.checkKey(decodedRecoveryKey, keyContent as any);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { useEffect, useCallback, useMemo } from 'react';
|
||||
import { IMyDevice } from 'matrix-js-sdk';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { CryptoEvent, CryptoEventHandlerMap } from 'matrix-js-sdk/lib/crypto';
|
||||
import { CryptoEvent, CryptoEventHandlerMap } from 'matrix-js-sdk/lib/crypto-api';
|
||||
import { useMatrixClient } from './useMatrixClient';
|
||||
|
||||
export const useDeviceListChange = (
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ export const login = async (
|
|||
}
|
||||
|
||||
const mx = createClient({ baseUrl: url });
|
||||
const [err, res] = await to<LoginResponse, MatrixError>(mx.login(data.type, data));
|
||||
const [err, res] = await to<LoginResponse, MatrixError>(mx.loginRequest(data));
|
||||
|
||||
if (err) {
|
||||
if (err.httpStatus === 400) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { atom } from 'jotai';
|
||||
import { ImportRoomKeyProgressData } from 'matrix-js-sdk/lib/crypto-api';
|
||||
import { ImportRoomKeyProgressData, ImportRoomKeyStage } from 'matrix-js-sdk/lib/crypto-api';
|
||||
|
||||
export enum BackupProgressStatus {
|
||||
Idle,
|
||||
|
|
@ -39,22 +39,16 @@ export const backupRestoreProgressAtom = atom<
|
|||
>(
|
||||
(get) => get(baseBackupRestoreProgressAtom),
|
||||
(get, set, progress) => {
|
||||
if (progress.stage === 'fetch') {
|
||||
if (progress.stage === ImportRoomKeyStage.Fetch) {
|
||||
set(baseBackupRestoreProgressAtom, {
|
||||
status: BackupProgressStatus.Fetching,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (progress.stage === 'load_keys') {
|
||||
if (progress.stage === ImportRoomKeyStage.LoadKeys) {
|
||||
const { total, successes, failures } = progress;
|
||||
if (total === undefined || successes === undefined || failures === undefined) {
|
||||
// Setting to idle as https://github.com/matrix-org/matrix-js-sdk/issues/4703
|
||||
set(baseBackupRestoreProgressAtom, {
|
||||
status: BackupProgressStatus.Idle,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const downloaded = successes + failures;
|
||||
if (downloaded === total) {
|
||||
set(baseBackupRestoreProgressAtom, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue