- Homomorphic Encryption Test Worker
- Performs computations on encrypted data without decrypting it through REST API and blockchain network
docker build -t he-test-worker .
docker run -dp [EXPOSED_PORT]:3000 he-test-worker
- Use ain-js
import Ain from '@ainblockchain/ain-js';
const ain = new Ain('http://node.ainetwork.ai:8080');
await ain.he.init();
const TEST_DATA = Float64Array.from({ length: ain.he.seal.encoder.slotCount }).map((x, i) => i);
const cipherText = ain.he.encrypt(TEST_DATA);
const encrypted = cipherText.save(); // base64 string
import Ain from '@ainblockchain/ain-js';
const ain = new Ain('http://node.ainetwork.ai:8080');
await ain.he.init();
const result = ... // get result from he-test-worker
const decrypted = ain.he.decrypt(result); // decrypted as Float64Array format
- Body parameters
operand
: encrypted base64 string
- Response
result
: encrypted base64 string- encrypted result of
operand * 2
- encrypted result of
- Body parameters
operand1
: encrypted base64 stringoperand2
: encrypted base64 string
- Response
result
: encrypted base64 string- encrypted result of
operand1 + operand2
- encrypted result of
- Endpoint for blockchain based HE calculation
- DO NOT CALL THIS ENDPOINT DIRECTLY
- Body parameters
function
: blockchain function setting parameterstransaction
: transaction info which caused this API calltx_body
ref
: reference path of blockchainvalue
: recorded value