diff --git a/src/sdk/encrypt.test.ts b/src/sdk/encrypt.test.ts index bd3923b..09e8f3a 100644 --- a/src/sdk/encrypt.test.ts +++ b/src/sdk/encrypt.test.ts @@ -21,6 +21,16 @@ describe('encrypt8', () => { publicKey = keypair.publicKey; }); + it('encrypt/decrypt 0 8bits', async () => { + const buffer = encrypt8(0, publicKey); + const compactList = CompactFheUint8List.deserialize(buffer); + let encryptedList = compactList.expand(); + encryptedList.forEach((v: FheUint8) => { + const decrypted = v.decrypt(clientKey); + expect(decrypted).toBe(0); + }); + }); + it('encrypt/decrypt 8bits', async () => { const buffer = encrypt8(34, publicKey); const compactList = CompactFheUint8List.deserialize(buffer); @@ -31,6 +41,16 @@ describe('encrypt8', () => { }); }); + it('encrypt/decrypt 0 16bits', async () => { + const buffer = encrypt16(0, publicKey); + const compactList = CompactFheUint8List.deserialize(buffer); + let encryptedList = compactList.expand(); + encryptedList.forEach((v: FheUint8) => { + const decrypted = v.decrypt(clientKey); + expect(decrypted).toBe(0); + }); + }); + it('encrypt/decrypt 16bits', async () => { const buffer = encrypt16(434, publicKey); const compactList = CompactFheUint16List.deserialize(buffer); @@ -41,6 +61,16 @@ describe('encrypt8', () => { }); }); + it('encrypt/decrypt 0 32bits', async () => { + const buffer = encrypt32(0, publicKey); + const compactList = CompactFheUint8List.deserialize(buffer); + let encryptedList = compactList.expand(); + encryptedList.forEach((v: FheUint8) => { + const decrypted = v.decrypt(clientKey); + expect(decrypted).toBe(0); + }); + }); + it('encrypt/decrypt 32bits', async () => { const buffer = encrypt32(30210, publicKey); const compactList = CompactFheUint32List.deserialize(buffer); diff --git a/src/sdk/index.ts b/src/sdk/index.ts index 5ce6dc2..523f12a 100644 --- a/src/sdk/index.ts +++ b/src/sdk/index.ts @@ -70,18 +70,18 @@ export const createInstance = async (params: FhevmInstanceParams): Promise