From 844e31250fc7d0ebadbcb40d0e6a13abed224a7d Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Wed, 27 Nov 2024 20:41:03 -0500 Subject: [PATCH] update the validator --- packages/frames-validator/src/validation.ts | 20 +++++++------------- sdks/node-sdk/src/Client.ts | 2 +- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/packages/frames-validator/src/validation.ts b/packages/frames-validator/src/validation.ts index 12e9bdde..91ea75c9 100644 --- a/packages/frames-validator/src/validation.ts +++ b/packages/frames-validator/src/validation.ts @@ -51,19 +51,9 @@ export async function validateFramesPost( throw new Error("Invalid wallet address"); } } else { - const randomWallet = Wallet.createRandom(); - const encryptionKey = getRandomValues(new Uint8Array(32)); - const client = await Client.create( - { - getAddress: () => randomWallet.address, - signMessage: async (message: string) => - getBytes(await randomWallet.signMessage(message)), - }, - encryptionKey, - ); - // make sure inbox IDs match - const authorized = await client.isInstallationAuthorized( + const authorized = await Client.isInstallationAuthorized( + { env }, inboxId, installationId, ); @@ -71,7 +61,11 @@ export async function validateFramesPost( throw new Error("Installation not a member of association state"); } - const isMember = await client.isAddressAuthorized(inboxId, walletAddress); + const isMember = await Client.isAddressAuthorized( + { env }, + inboxId, + walletAddress, + ); if (!isMember) { throw new Error("Unable to associate wallet address with inbox"); diff --git a/sdks/node-sdk/src/Client.ts b/sdks/node-sdk/src/Client.ts index 45845af2..16455c34 100644 --- a/sdks/node-sdk/src/Client.ts +++ b/sdks/node-sdk/src/Client.ts @@ -464,7 +464,7 @@ export class Client { return await isAddressAuthorizedBinding(host, inboxId, address); } - static async isInstallationAuthori( + static async isInstallationAuthorized( networkOptions: NetworkOptions, inboxId: string, installation: Uint8Array,