-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from zama-ai/keccak
Keccak
- Loading branch information
Showing
4 changed files
with
56 additions
and
77 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
import initSDK, { InitOutput } from 'tfhe'; | ||
import wasm from 'tfhe/tfhe_bg.wasm'; | ||
import initTFHE, { InitInput as TFHEInput } from 'tfhe'; | ||
import wasmTFHE from 'tfhe/tfhe_bg.wasm'; | ||
|
||
let initialized: InitOutput; | ||
import initKMS, { InitInput as KMSInput } from './kms/web/kms_lib.js'; | ||
import wasmKMS from './kms/web/kms_lib_bg.wasm'; | ||
|
||
type InitFhevm = typeof initSDK; | ||
let initialized = false; | ||
|
||
export const initFhevm: InitFhevm = async (params) => { | ||
export const initFhevm = async ({ | ||
tfheParams, | ||
kmsParams, | ||
}: { | ||
tfheParams?: TFHEInput; | ||
kmsParams?: KMSInput; | ||
} = {}) => { | ||
if (!initialized) { | ||
initialized = await initSDK(params || wasm()); | ||
await initTFHE(tfheParams || wasmTFHE()); | ||
await initKMS( | ||
kmsParams || | ||
(wasmKMS as unknown as () => Promise<WebAssembly.Instance>)(), | ||
); | ||
initialized = true; | ||
} | ||
return initialized; | ||
return true; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters