mirror of
https://github.com/luxfi/fhe.git
synced 2026-07-26 23:16:08 +00:00
- data-seal: Verifiable Data Integrity Seal (PIP-0010/LP-0535) FHE-encrypted tamper-proof sealing with Public/ZK/Private modes, batch sealing, homomorphic verification - content-provenance: AI & Media Content Provenance (PIP-0011/LP-7110) Model manifests, output attestation via homomorphic comparison, media derivation DAGs - encrypted-crdt: Encrypted CRDT (PIP-0013/LP-6500) LWW-Register with FHE values, OR-Set with tag-based add/remove, Lamport timestamp conflict resolution, deterministic merge - shadow-governance: Shadow Government Protocol (PIP-7010) Anonymous ministries, encrypted voting with homomorphic tallying, nullifier-based anti-fraud, quorum enforcement Each example includes Solidity contracts, Hardhat tests, CLI tasks, and README linking to corresponding PIP and LP specifications.
27 lines
1.2 KiB
TypeScript
27 lines
1.2 KiB
TypeScript
import { task } from "hardhat/config";
|
|
import { fhe, Encryptable } from "@luxfhe/sdk/node";
|
|
|
|
task("task:register-content", "Register content for provenance tracking")
|
|
.addParam("contract", "ContentProvenance contract address")
|
|
.addParam("hash", "Content hash (hex)")
|
|
.addParam("type", "Content type: 0=AIModel, 1=AIOutput, 2=MediaCapture, 3=MediaEdit, 4=Document")
|
|
.addOptionalParam("parent", "Parent content ID for derivations", "0")
|
|
.addOptionalParam("model", "Model ID (for AI outputs)", "0")
|
|
.setAction(async ({ contract, hash, type, parent, model }, hre) => {
|
|
const [signer] = await hre.ethers.getSigners();
|
|
const provenance = await hre.ethers.getContractAt("ContentProvenance", contract);
|
|
|
|
const [encModelId] = await fhe.encrypt([Encryptable.uint32(BigInt(model))]);
|
|
const tx = await provenance.connect(signer).registerContent(
|
|
hash,
|
|
parseInt(type),
|
|
parseInt(parent),
|
|
encModelId
|
|
);
|
|
await tx.wait();
|
|
|
|
const count = await provenance.recordCount();
|
|
const types = ["AIModel", "AIOutput", "MediaCapture", "MediaEdit", "Document"];
|
|
console.log(`Registered ${types[parseInt(type)]} content. ID: ${(count - 1n).toString()}`);
|
|
});
|