+
Settings
+
+
Security
+
Cross-signing
- {#await client.getCrypto()?.isCrossSigningReady() }
+ {#await client.getCrypto()?.isCrossSigningReady()}
Loading...
- {:then sign}
+ {:then sign}
{#if sign}
Cross-signing is ready
{:else}
@@ -69,9 +31,9 @@
{/await}
-
Secure backup
+
Secure backup
- {#await Promise.all([client.getCrypto()?.getActiveSessionBackupVersion()]) }
+ {#await Promise.all([client.getCrypto()?.getActiveSessionBackupVersion()])}
Loading...
{:then [version]}
{#if version === null}
@@ -86,22 +48,22 @@
{/await}
-
Devices
+
Devices
-
+
{#await client.getDevices()}
Loading...
- {:then devices}
- {#each devices.devices ?? [] as device (device['device_id'])}
-
-
+ {:then devices}
+ {#each devices.devices ?? [] as device (device.device_id)}
+
+
-
{ device['display_name'] }
-
{device['device_id']}
+
{device.display_name}
+
{device.device_id}
- {#if !client.checkDeviceTrust(client.getUserId() ?? '', device['device_id']).isVerified()}
-
+ {#if !client.checkDeviceTrust(client.getUserId() ?? '', device.device_id).isVerified()}
+
{/if}
{/each}
@@ -110,6 +72,4 @@
-
-
-
\ No newline at end of file
+
diff --git a/services/frontend/src/matrix/listeners/index.ts b/services/frontend/src/matrix/listeners/index.ts
index af3ce32..e973765 100644
--- a/services/frontend/src/matrix/listeners/index.ts
+++ b/services/frontend/src/matrix/listeners/index.ts
@@ -1,6 +1,7 @@
import { ClientEvent, CryptoEvent, HttpApiEvent, type MatrixClient } from 'matrix-js-sdk'
import { stateStore } from '../../stores/matrixState.store'
import { matrixLogout } from '..'
+import { startVerification } from '../verification'
export function registerListeners(client: MatrixClient) {
// Sync state with state store, which is used to show loading spinners
@@ -14,14 +15,7 @@ export function registerListeners(client: MatrixClient) {
client.on(CryptoEvent.VerificationRequestReceived, async (request) => {
await request.accept()
- const verifier = await request.startVerification('m.sas.v1')
-
- // @ts-expect-error: sad but necessary for missing import
- verifier.on('show_sas', async (sas: any) => {
- await sas.confirm()
- })
-
- await verifier.verify()
+ await startVerification(client, request)
})
// Log out handler, if logged out from the homeserver, clean old tokens and data
diff --git a/services/frontend/src/matrix/verification.ts b/services/frontend/src/matrix/verification.ts
new file mode 100644
index 0000000..941958d
--- /dev/null
+++ b/services/frontend/src/matrix/verification.ts
@@ -0,0 +1,15 @@
+import type { MatrixClient } from 'matrix-js-sdk'
+import { type VerificationRequest, VerifierEvent } from 'matrix-js-sdk/lib/crypto-api'
+import { createPopup } from '$lib/popup'
+
+export async function startVerification(_client: MatrixClient, req: VerificationRequest) {
+ const verifier = await req.startVerification('m.sas.v1')
+ verifier.on(VerifierEvent.ShowSas, async (sas) => {
+ createPopup({
+ type: 'device-verification',
+ sas,
+ })
+ })
+
+ await verifier.verify()
+}
diff --git a/services/frontend/src/routes/login/+page.svelte b/services/frontend/src/routes/login/+page.svelte
index 8ce6339..d0b00ed 100644
--- a/services/frontend/src/routes/login/+page.svelte
+++ b/services/frontend/src/routes/login/+page.svelte
@@ -58,7 +58,7 @@
user,
},
password,
- initial_device_display_name: 'Libretrix',
+ initial_device_display_name: `${window.location.host} | Libretrix`,
})
const baseUrl = result?.well_known?.['m.homeserver']?.base_url ?? client.baseUrl