replicator.ts
2.7 KB · TypeScript · Updated May 19, 2026
- 1
import { verifyManifestSignature } from "./attestations"; - 2
- 3
export interface ReplicaTarget { - 4
peerId: string; - 5
region: string; - 6
contentId: string; - 7
} - 8
- 9
export async function publishReplica(target: ReplicaTarget) { - 10
const verified = await verifyManifestSignature(target.contentId); - 11
- 12
if (!verified) { - 13
throw new Error("Replica manifest signature could not be verified"); - 14
} - 15
- 16
return { - 17
peerId: target.peerId, - 18
region: target.region, - 19
status: "queued", - 20
receipt: `replica:${target.peerId}:${Date.now()}`, - 21
}; - 22
}
