66import { ethers } from 'ethers' ;
77
88import { ThresholdDecrypter } from './characters/cbd-recipient' ;
9- import { ConditionExpression } from './conditions' ;
9+ import { Condition , ConditionExpression } from './conditions' ;
1010import { DkgClient } from './dkg' ;
1111import { toBytes } from './utils' ;
1212
@@ -23,13 +23,13 @@ export interface TacoMessageKit {
2323export 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
3939export 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,
0 commit comments