Skip to content

Commit 9970cb5

Browse files
hide condition expression from the taco api
1 parent b2cf2e4 commit 9970cb5

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/taco.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
import { ethers } from 'ethers';
77

88
import { ThresholdDecrypter } from './characters/cbd-recipient';
9-
import { ConditionExpression } from './conditions';
9+
import { Condition, ConditionExpression } from './conditions';
1010
import { DkgClient } from './dkg';
1111
import { toBytes } from './utils';
1212

@@ -23,13 +23,13 @@ export interface TacoMessageKit {
2323
export const encrypt = async (
2424
web3Provider: ethers.providers.Web3Provider,
2525
message: string,
26-
conditions: ConditionExpression,
26+
condition: Condition,
2727
ritualId: number
2828
): Promise<TacoMessageKit> => {
2929
const dkgRitual = await DkgClient.getFinalizedRitual(web3Provider, ritualId);
3030
return await encryptLight(
3131
message,
32-
conditions,
32+
condition,
3333
dkgRitual.dkgPublicKey,
3434
dkgRitual.dkgParams.threshold,
3535
ritualId
@@ -38,13 +38,13 @@ export const encrypt = async (
3838

3939
export const encryptLight = async (
4040
message: string,
41-
conditions: ConditionExpression,
41+
condition: Condition,
4242
dkgPublicKey: DkgPublicKey,
4343
// TODO: Remove these parameters after fixing TacoMessageKit
4444
threshold: number,
4545
ritualId: number
4646
): Promise<TacoMessageKit> => {
47-
const aad = conditions.asAad();
47+
const aad = new ConditionExpression(condition).asAad();
4848
const ciphertext = ferveoEncrypt(toBytes(message), aad, dkgPublicKey);
4949
return {
5050
ciphertext,

test/unit/taco.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import { aliceSecretKeyBytes } from './testVariables';
2424

2525
const {
2626
predefined: { ERC721Ownership },
27-
ConditionExpression,
2827
} = conditions;
2928

3029
// Shared test variables
@@ -34,7 +33,6 @@ const ownsNFT = new ERC721Ownership({
3433
parameters: [3591],
3534
chain: 5,
3635
});
37-
const conditionExpr = new ConditionExpression(ownsNFT);
3836
const variant = FerveoVariant.precomputed;
3937
const message = 'this is a secret';
4038

@@ -48,7 +46,7 @@ describe('taco', () => {
4846
const tacoMk = await taco.encrypt(
4947
web3Provider,
5048
message,
51-
conditionExpr,
49+
ownsNFT,
5250
mockedDkg.ritualId
5351
);
5452

0 commit comments

Comments
 (0)