From 332a57080067d3c3c0c801f84b48983c9e19b5c9 Mon Sep 17 00:00:00 2001 From: derekpierre Date: Tue, 20 Aug 2024 09:13:20 -0400 Subject: [PATCH] Remove unnecessary taco api calls; one of which is no longer applicable. --- examples/taco/nodejs/src/index.ts | 13 --------- packages/taco/src/index.ts | 4 +-- packages/taco/src/taco.ts | 45 ------------------------------- 3 files changed, 2 insertions(+), 60 deletions(-) diff --git a/examples/taco/nodejs/src/index.ts b/examples/taco/nodejs/src/index.ts index 37e8974a..86d806ea 100644 --- a/examples/taco/nodejs/src/index.ts +++ b/examples/taco/nodejs/src/index.ts @@ -10,7 +10,6 @@ import { encrypt, fromBytes, initialize, - isAuthorized, toBytes, toHexString, } from '@nucypher/taco'; @@ -81,18 +80,6 @@ const encryptToBytes = async (messageString: string) => { encryptorSigner, ); - // Note: Not actually needed but used by CI for checking contract compatibility. - // Calling it after the encryption because we need material from messageKit. - const isEncryptorAuthenticated = await isAuthorized( - provider, - domain, - messageKit, - ritualId, - ); - if (!isEncryptorAuthenticated) { - throw new Error('Not authorized'); - } - return messageKit.toBytes(); }; diff --git a/packages/taco/src/index.ts b/packages/taco/src/index.ts index 20d7ea00..2bc97084 100644 --- a/packages/taco/src/index.ts +++ b/packages/taco/src/index.ts @@ -10,8 +10,8 @@ export { } from '@nucypher/shared'; export * as conditions from './conditions'; -// TODO(#324): Expose registerEncrypters from taco API -export { decrypt, encrypt, encryptWithPublicKey, isAuthorized } from './taco'; + +export { decrypt, encrypt, encryptWithPublicKey } from './taco'; // TODO: Remove this re-export once `@nucypher/taco-auth` is mature and published export { diff --git a/packages/taco/src/taco.ts b/packages/taco/src/taco.ts index fc166bf0..da1fc9ce 100644 --- a/packages/taco/src/taco.ts +++ b/packages/taco/src/taco.ts @@ -5,12 +5,10 @@ import { ThresholdMessageKit, } from '@nucypher/nucypher-core'; import { - ChecksumAddress, DkgCoordinatorAgent, Domain, fromHexString, getPorterUris, - GlobalAllowListAgent, PorterClient, toBytes, } from '@nucypher/shared'; @@ -160,46 +158,3 @@ export const decrypt = async ( context, ); }; - -/** - * Checks if the encryption from the provided messageKit is authorized for the specified ritual. - * - * @export - * @param {ethers.providers.Provider} provider - Instance of ethers provider which is used to interact with - * your selected network. - * @param {Domain} domain - The domain which was used to encrypt the network. Must match the `ritualId`. - * @param {ThresholdMessageKit} messageKit - The encrypted message kit to be checked. - * @param {number} ritualId - The ID of the DKG Ritual under which the messageKit was supposedly encrypted. - * - * @returns {Promise} Returns a Promise that resolves with the authorization status. - * True if authorized, false otherwise - */ -export const isAuthorized = async ( - provider: ethers.providers.Provider, - domain: Domain, - messageKit: ThresholdMessageKit, - ritualId: number, -): Promise => - DkgCoordinatorAgent.isEncryptionAuthorized( - provider, - domain, - ritualId, - messageKit, - ); - -// TODO is this still valid and actually needed? should we remove this? -export const registerEncrypters = async ( - provider: ethers.providers.Provider, - signer: ethers.Signer, - domain: Domain, - ritualId: number, - encrypters: ChecksumAddress[], -): Promise => { - await GlobalAllowListAgent.registerEncrypters( - provider, - signer, - domain, - ritualId, - encrypters, - ); -};