A self hosted chat application with end-to-end encrypted messaging.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
import { EncryptionService } from "../service/EncryptionService"; import { ChatMessageDTO } from "../dto/ChatMessageDTO"; import * as log from "loglevel"; import { getOneMessage } from "../ajax/Messages";
export async function isPassphraseValid( passphrase: string, userName: string, es: EncryptionService, authToken: string ): Promise<boolean> { const messages: ChatMessageDTO[] = await getOneMessage(userName, 0, authToken); if (messages.length === 0) return true; try { es.decrypt(passphrase, messages[0].messageCipher); } catch (error) { log.debug("here"); return false; } return true; }
|