From 56b9ec329745f1d95fff08dae6d027c7ce1d99d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20=27birdy=27=20Danjou?= Date: Tue, 20 Feb 2024 00:44:36 +0100 Subject: [PATCH] fix: add bigint parameter on encrypt64 --- src/sdk/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sdk/index.ts b/src/sdk/index.ts index 7a76d8b..5059b49 100644 --- a/src/sdk/index.ts +++ b/src/sdk/index.ts @@ -15,7 +15,7 @@ export type FhevmInstance = { encrypt8: (value: number) => Uint8Array; encrypt16: (value: number) => Uint8Array; encrypt32: (value: number) => Uint8Array; - encrypt64: (value: number) => Uint8Array; + encrypt64: (value: number | bigint) => Uint8Array; generateToken: ( options: GeneratePublicKeyParams & { force?: boolean; @@ -148,7 +148,8 @@ export const createInstance = async ( encrypt64(value) { if (value == null) throw new Error('Missing value'); - if (typeof value !== 'number') throw new Error('Value must be a number'); + if (typeof value !== 'number' && typeof value !== 'bigint') + throw new Error('Value must be a number or a bigint'); if (!tfheCompactPublicKey) throw new Error( 'Your instance has been created without the public blockchain key',