From 08367ad5a4bb0576069a9a00674d2d20600f630c Mon Sep 17 00:00:00 2001
From: Piotr Roslaniec
Date: Wed, 10 Jul 2024 10:25:29 +0200
Subject: [PATCH] apply pr suggestions
---
packages/taco/src/taco.ts | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/packages/taco/src/taco.ts b/packages/taco/src/taco.ts
index 5e59de4de..d05b210cc 100644
--- a/packages/taco/src/taco.ts
+++ b/packages/taco/src/taco.ts
@@ -13,13 +13,17 @@ import {
GlobalAllowListAgent,
toBytes,
} from '@nucypher/shared';
-import { AuthProviders, EIP4361_AUTH_METHOD, EIP4361AuthProvider } from '@nucypher/taco-auth';
+import {
+ AuthProviders,
+ EIP4361_AUTH_METHOD,
+ EIP4361AuthProvider,
+} from '@nucypher/taco-auth';
import { ethers } from 'ethers';
import { keccak256 } from 'ethers/lib/utils';
import { Condition } from './conditions/condition';
import { ConditionExpression } from './conditions/condition-expr';
-import { CustomContextParam} from './conditions/context';
+import { CustomContextParam } from './conditions/context';
import { DkgClient } from './dkg';
import { retrieveAndDecrypt } from './tdec';
@@ -125,7 +129,7 @@ export const encryptWithPublicKey = async (
* @param {Domain} domain - Represents the logical network in which the decryption will be performed.
* Must match the `ritualId`.
* @param {ThresholdMessageKit} messageKit - The kit containing the message to be decrypted
- * @param authProvider
+ * @param authProvider - The authentication provider that will be used to provide the authorization
* @param {string} [porterUri] - The URI for the Porter service. If not provided, a value will be obtained
* from the Domain
* @param {Record} [customParameters] - Optional custom parameters that may be required
@@ -140,7 +144,7 @@ export const decrypt = async (
provider: ethers.providers.Provider,
domain: Domain,
messageKit: ThresholdMessageKit,
- authProvider: EIP4361AuthProvider,
+ authProvider?: EIP4361AuthProvider,
porterUri?: string,
customParameters?: Record,
): Promise => {
@@ -154,9 +158,11 @@ export const decrypt = async (
messageKit.acp.publicKey,
);
const ritual = await DkgClient.getActiveRitual(provider, domain, ritualId);
- const authProviders: AuthProviders = {
- [EIP4361_AUTH_METHOD]: authProvider,
- };
+ const authProviders: AuthProviders = authProvider
+ ? {
+ [EIP4361_AUTH_METHOD]: authProvider,
+ }
+ : {};
return retrieveAndDecrypt(
provider,
domain,
@@ -170,7 +176,6 @@ export const decrypt = async (
);
};
-
/**
* Checks if the encryption from the provided messageKit is authorized for the specified ritual.
*