const inputCipher = {
ThresholdHybrid: {
threshold_params: {
SilentThreshold: {
td_params: Array.from(hexToUint8Array(stripHex(cypherText))),
pk_bytes: Array.from(hexToUint8Array(stripHex(groupInfo.groupPk))),
tau_params: Array.from(hexToUint8Array(stripHex(groupInfo.tauParams))),
},
},
symmetric_params: { ChaCha20Poly1305: { nonce: Array.from(nonce) } },
},
};
// nodePub: the specific guardian node's Ed25519 result-encryption key, see the caveat below
const resultNonce = crypto.getRandomValues(new Uint8Array(12));
const resultCipher = {
AsymmetricHybrid: {
asymmetric_params: {
Ed25519: {
recipient_public_key: Array.from(encAccount.publicKey),
ephemeral_public_key: Array.from(nodePub),
kdf: "HkdfSha256",
salt: null,
info: null,
},
},
symmetric_params: { ChaCha20Poly1305: { nonce: Array.from(resultNonce) } },
},
};
import { createAgreement } from "@palliora.org/chainsdk";
const result = await createAgreement(
{
contractType: "Active",
guardians: groupInfo.guardians,
compute: {
cipher: inputCipher,
computerIndices: groupInfo.guardians.map((_, i) => i),
fees: 0,
computeRate: 0,
deadline: 0,
confidentiality: { Trusted: 0 },
feeFunction: null,
input: { Inline: { data: Array.from(ciphertext) } },
program: { NativeExecute: "Inference" },
},
resultCipher,
},
account,
);