Skip to content

Commit

Permalink
chore: replace reencrypt by decrypt
Browse files Browse the repository at this point in the history
  • Loading branch information
immortal-tofu committed Jan 3, 2025
1 parent 82bd5d7 commit 2565653
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions src/sdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ export type FhevmInstance = {
contractAddress: string,
delegatedAccount?: string,
) => EIP712;
decrypt: (
handle: bigint,
privateKey: string,
publicKey: string,
signature: string,
contractAddress: string,
userAddress: string,
) => Promise<bigint>;
/**
* @deprecated This method is replaced by decrypt, using same parameters
*/
reencrypt: (
handle: bigint,
privateKey: string,
Expand Down Expand Up @@ -74,6 +85,14 @@ export const createInstance = async (
const publicParamsData = await getPublicParams(config);

const kmsSigners = await getKMSSigners(provider, config);
const decrypt = reencryptRequest(
kmsSigners,
chainId,
kmsContractAddress,
aclContractAddress,
cleanURL(config.gatewayUrl),
provider,
);

return {
createEncryptedInput: createEncryptedInput(
Expand All @@ -86,14 +105,13 @@ export const createInstance = async (
),
generateKeypair,
createEIP712: createEIP712(chainId),
reencrypt: reencryptRequest(
kmsSigners,
chainId,
kmsContractAddress,
aclContractAddress,
cleanURL(config.gatewayUrl),
provider,
),
decrypt,
reencrypt(...params) {
console.warn(
"Warning: 'reencrypt' is deprecated and will be removed in future versions. Please use 'decrypt' instead, which accepts the same parameters.",
);
return decrypt(...params);
},
getPublicKey: () =>
publicKeyData.publicKey
? {
Expand Down

0 comments on commit 2565653

Please sign in to comment.