From 9705c0afd7c6dad38f7eaab878a33594fcd70ff7 Mon Sep 17 00:00:00 2001 From: tamarafinogina Date: Mon, 13 Jan 2025 17:01:13 +0100 Subject: [PATCH] remove dead code --- src/app/crypto/services/utilspgp.ts | 66 ----------------------------- 1 file changed, 66 deletions(-) diff --git a/src/app/crypto/services/utilspgp.ts b/src/app/crypto/services/utilspgp.ts index 5e517dc72..674692422 100644 --- a/src/app/crypto/services/utilspgp.ts +++ b/src/app/crypto/services/utilspgp.ts @@ -1,5 +1,3 @@ -import { DecryptMessageResult, WebStream } from 'openpgp'; -import localStorageService from '../../core/services/local-storage.service'; import { getOpenpgp } from './pgp.service'; export async function isValidBase64(key: string): Promise { @@ -17,67 +15,3 @@ export async function isValid(key: string): Promise { return false; } } - -export async function decryptPGP(armoredMessage: string): Promise { - const user = localStorageService.getUser(); - const openpgp = await getOpenpgp(); - - if (!user) { - throw Error('User not found on local storage'); - } - - // User settings - const privateKey = Buffer.from(user.privateKey, 'base64').toString(); - const publicKey = Buffer.from(user.publicKey, 'base64').toString(); - - // Prepare input - const cipherText = await openpgp.readMessage({ armoredMessage }); - const publicKeyArmored = await openpgp.readKey({ armoredKey: publicKey }); - const privateKeyArmored = await openpgp.readPrivateKey({ armoredKey: privateKey }); - - // Decrypt message - return openpgp.decrypt({ - message: cipherText, - verificationKeys: publicKeyArmored, - decryptionKeys: privateKeyArmored, - }); -} - -export async function encryptPGP(message: string): Promise> { - const user = localStorageService.getUser(); - const openpgp = await getOpenpgp(); - - if (!user) { - throw Error('User not found on local storage'); - } - - // User settings - const publicKey = Buffer.from(user.publicKey, 'base64').toString(); - - // Prepare input - const originalText = await openpgp.createMessage({ text: message }); - const publicKeyArmored = await openpgp.readKey({ armoredKey: publicKey }); - - // Encrypt message - return openpgp.encrypt({ - message: originalText, - encryptionKeys: publicKeyArmored, - }); -} - -export async function encryptPGPInvitations(message: string, key: string): Promise> { - const openpgp = await getOpenpgp(); - - // User settings - const publicKey = Buffer.from(key, 'base64').toString(); - - // Prepare input - const originalText = await openpgp.createMessage({ text: message }); - const publicKeyArmored = await openpgp.readKey({ armoredKey: publicKey }); - - // Encrypt message - return openpgp.encrypt({ - message: originalText, - encryptionKeys: publicKeyArmored, - }); -}