mirror of
https://github.com/Discreetly/frontend.git
synced 2026-01-09 12:58:03 -05:00
@@ -49,8 +49,10 @@
|
||||
};
|
||||
}
|
||||
|
||||
let unsubscribeStore = currentSelectedRoom.subscribe((currentValue) => {
|
||||
let unsubscribeStore = currentSelectedRoom.subscribe(async (currentValue) => {
|
||||
await Promise.resolve();
|
||||
updateMessages($selectedServer, roomId);
|
||||
|
||||
getKey().then((k) => {
|
||||
key = k;
|
||||
});
|
||||
@@ -192,7 +194,8 @@
|
||||
{#key $currentSelectedRoom.roomId}
|
||||
<Conversation
|
||||
{roomRateLimit}
|
||||
{getKey} />
|
||||
{getKey}
|
||||
{roomId} />
|
||||
{/key}
|
||||
<InputPrompt
|
||||
{socket}
|
||||
@@ -207,7 +210,8 @@
|
||||
{#key $currentSelectedRoom.roomId}
|
||||
<Conversation
|
||||
{roomRateLimit}
|
||||
{getKey} />
|
||||
{getKey}
|
||||
{roomId} />
|
||||
{/key}
|
||||
<InputPrompt
|
||||
{socket}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<script lang="ts">
|
||||
import { currentRoomMessages } from '$lib/stores';
|
||||
import { currentRoomMessages, roomKeyStore, roomPassStore } from '$lib/stores';
|
||||
import { getEpochFromTimestamp, getTimestampFromEpoch } from '$lib/utils/rateLimit';
|
||||
import type { MessageI } from 'discreetly-interfaces';
|
||||
import { onMount } from 'svelte';
|
||||
import BubbleText from './BubbleText.svelte';
|
||||
import { minidenticon } from 'minidenticons';
|
||||
import { bubbleBgFromSessionId } from '$lib/utils/color';
|
||||
import { decrypt } from '$lib/crypto/crypto';
|
||||
import { decrypt, deriveKey } from '$lib/crypto/crypto';
|
||||
|
||||
export let roomRateLimit: number;
|
||||
export let getKey: () => Promise<CryptoKey>;
|
||||
export let roomId: string;
|
||||
let key: CryptoKey;
|
||||
|
||||
let elemChat: HTMLElement;
|
||||
|
||||
$: {
|
||||
@@ -26,12 +26,11 @@
|
||||
|
||||
async function decryptText(text: string): Promise<string> {
|
||||
if (!key) {
|
||||
return getKey().then(async (k) => {
|
||||
key = k;
|
||||
key = await getKey();
|
||||
const result = await decrypt(text, key);
|
||||
return result ? result : text;
|
||||
});
|
||||
} else if (key) {
|
||||
key = await deriveKey($roomPassStore[roomId].password, roomId);
|
||||
const result = await decrypt(text, key);
|
||||
return result ? result : text;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user