Skip to content

Commit

Permalink
Remove unnecessary taco api calls; one of which is no longer applicable.
Browse files Browse the repository at this point in the history
  • Loading branch information
derekpierre committed Aug 20, 2024
1 parent 5f28cfe commit 4f9edeb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 47 deletions.
4 changes: 2 additions & 2 deletions packages/taco/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
45 changes: 0 additions & 45 deletions packages/taco/src/taco.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ import {
ThresholdMessageKit,
} from '@nucypher/nucypher-core';
import {
ChecksumAddress,
DkgCoordinatorAgent,
Domain,
fromHexString,
getPorterUris,
GlobalAllowListAgent,
PorterClient,
toBytes,
} from '@nucypher/shared';
Expand Down Expand Up @@ -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<boolean>} 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<boolean> =>
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<void> => {
await GlobalAllowListAgent.registerEncrypters(
provider,
signer,
domain,
ritualId,
encrypters,
);
};

0 comments on commit 4f9edeb

Please sign in to comment.