Skip to content

Commit

Permalink
chore: pgpHelper fixes (#1012)
Browse files Browse the repository at this point in the history
  • Loading branch information
kalashshah authored Jan 11, 2024
1 parent a2dee2b commit 4762ea8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/restapi/src/lib/chat/helpers/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { get as getUser } from '../../user';
import { createUserService } from './service';
import Constants, { ENV } from '../../constants';
import { getDomainInformation, getTypeInformation } from './signature';
import { IPGPHelper, pgpDecrypt, verifySignature } from './pgp';
import { IPGPHelper } from './pgp';
import { aesDecrypt } from './aes';
import { getEncryptedSecret } from './getEncryptedSecret';
import { getGroup } from '../getGroup';
Expand Down Expand Up @@ -481,7 +481,7 @@ export const decryptAndVerifyMessage = async (
};
const hash = CryptoJS.SHA256(JSON.stringify(bodyToBeHashed)).toString();
const signature = message.verificationProof.split(':')[1];
await verifySignature({
await pgpHelper.verifySignature({
messageContent: hash,
signatureArmored: signature,
publicKeyArmored: pgpPublicKey,
Expand Down
10 changes: 5 additions & 5 deletions packages/restapi/src/lib/chat/helpers/inbox.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IPGPHelper, PGPHelper } from '.';
import * as PGP from './pgp';
import Constants, { ENV } from '../../constants';
import { isValidCAIP10NFTAddress, pCAIP10ToWallet } from '../../helpers';
import { IFeeds, IMessageIPFS, IUser, SpaceIFeeds } from '../../types';
Expand Down Expand Up @@ -31,13 +31,13 @@ type DecryptConverationType = {
messages: IMessageIPFS[];
connectedUser: IUser; //caip10
pgpPrivateKey?: string;
pgpHelper: IPGPHelper;
pgpHelper?: PGP.IPGPHelper;
env?: ENV;
};

export const getInboxLists = async (
options: InboxListsType,
pgpHelper:IPGPHelper=PGPHelper
pgpHelper = PGP.PGPHelper
): Promise<IFeeds[]> => {
const {
lists,
Expand Down Expand Up @@ -123,7 +123,7 @@ export const getSpaceInboxLists = async (
}

if (toDecrypt)
return decryptFeeds({ feeds, connectedUser, pgpPrivateKey, pgpHelper:PGPHelper, env });
return decryptFeeds({ feeds, connectedUser, pgpPrivateKey, pgpHelper: PGP.PGPHelper, env });
return feeds;
};

Expand Down Expand Up @@ -167,7 +167,7 @@ export const decryptConversation = async (options: DecryptConverationType) => {
messages,
connectedUser,
pgpPrivateKey,
pgpHelper,
pgpHelper = PGP.PGPHelper,
env = Constants.ENV.PROD,
} = options || {};
let otherPeer: IUser;
Expand Down

0 comments on commit 4762ea8

Please sign in to comment.