# trail/duplicity

https://toip.tools/spec/trail/duplicity/0.1

Whoever catches duplicity sends the evidence to someone who relies on the log: two conflicting signed versions at the same position, from the controller or from a witness. The evidence proves itself against the controller's KEL. The receiver replies with an empty object.

- **Sent**: whoever caught it (a watcher, controller or verifier) → a party that relies on the log
- **Kind**: Request and response. The response's type is `https://toip.tools/spec/trail/duplicity/0.1#response`.
- **Envelope**: Signed by the issuer, addressed to one recipient, timestamped, and encrypted in a TSP Direct message. The signature and recipient binding prevent its use as a bearer token.
- **Defined in**: [`packages/eventlog/src/tasks.ts:17`](https://github.com/yourbuddyconner/toip-tools/blob/main/packages/eventlog/src/tasks.ts#L17) as `duplicity`
- **Handled in**: [`packages/eventlog/src/tasks.ts`](https://github.com/yourbuddyconner/toip-tools/blob/main/packages/eventlog/src/tasks.ts)
- **Design**: [10.2 Evidence](https://github.com/yourbuddyconner/toip-tools/blob/main/projects/trail/docs/design.md#102-evidence) in `projects/trail/docs/design.md`

## Payload

As the handler declares it, in packages/eventlog/src/tasks.ts:

```ts
{ evidence: StoredEvidence }
```

## Response payload

As the handler declares it, in packages/eventlog/src/tasks.ts:

```ts
Record<string, never>
```

### Types it uses

packages/eventlog/src/store.ts:56:

```ts
/** Evidence as JSON: its two messages as CESR text. */
export interface StoredEvidence extends Omit<DuplicityEvidence, "a" | "b"> {
  a: string;
  b: string;
}
```

## Document envelope

Every Trust Task uses this envelope. Replace `payload` with the structure shown above.

Shape of a document of this type:

```json
{
  "id": "urn:uuid:…",
  "type": "https://toip.tools/spec/trail/duplicity/0.1",
  "issuer": "did:key:… (the sender)",
  "recipient": "did:key:… (the receiver)",
  "issuedAt": "2026-11-06T18:00:00.000Z",
  "payload": { … },
  "proof": {
    "type": "DataIntegrityProof",
    "cryptosuite": "eddsa-jcs-2022",
    "verificationMethod": "did:key:…#…",
    "proofPurpose": "assertionMethod",
    "proofValue": "z…"
  }
}
```

---

This is the Markdown version of https://toip.tools/spec/trail/duplicity/0.1/. An index of the documentation for AI assistants is at https://toip.tools/llms.txt.
