closedhumanPR #117Identity

hackathon/yashjadhav1595-projects : Ed25519 rotating identity with key rotation

The default did_key plugin produces a static, deterministic identity that cannot be rotated — a compromised key remains valid forever.

Author

yashjadhav1595-projects avatar

@yashjadhav1595-projects

github profile →
Status
Closed without merging
Opened on
Jul 9
Branch
hackathon/yashjadhav-identity-rotation

Description

The pitch.

### What this solves (Problem 05: Identity Key Rotation)
The default `did_key` plugin produces a static, deterministic identity that cannot be rotated — a compromised key remains valid forever. This PR adds `Ed25519RotatingIdentity`: a drop-in identity plugin that supports key rotation with cryptographic continuity proofs and temporal validity windows.

### Implementation Checklist
- [x] **Implement Ed25519 key rotation** where retiring keys cryptographically sign their successors via a continuity proof.
- [x] **Enforce temporal validity windows** (`as_of` tick bounds checking against `issued_at` and `rotated_out`).
- [x] **Implement chain-tip guarding** in `verify_continuity` and `apply_rotation` to prevent retired-key injection attacks.
- [x] **Integration with `parc` trust layer** by exposing the full public key history through `resolve()`.
- [x] **98 Unit & Integration Tests** passing (including full adversarial scenario validation for post-rotation forgery, backdating, and retired-key injection).

### The Solution: Cryptographic Continuity & Temporal Bounds
This PR implements `Ed25519RotatingIdentity`, an identity plugin that natively supports key lifecycle management and deterministic rotation.

**Key Features:**
*   **Cryptographic Continuity**: When `rotate_key()` is called, the old key signs a canonical `RotationRecord` binding the agent ID, old key ID, new key ID, and new public key, proving authorization of the new key.
*   **Temporal Validity Windows**: Signatures are verified against the specific time they were observed (`as_of`), rather than the attacker-controlled `signed_at` time. Keys are strictly valid only between their `issued_at` and `rotated_out` ticks.
*   **Chain-tip Guarding**: `verify_continuity()` prevents "Stale Key Injection" by ensuring that a key cannot authorize a new successor if it has already been rotated out.
*   **Adversarial Validators**: Two new validators (`validate_identity_post_rotation_forgery` and `validate_identity_backdating_rejected`) prove the system accurately blocks temporal boundary attacks.

### Validation & Testing
This implementation passes the full `identity_rotation` adversarial validator scenario out-of-the-box, correctly catching:
1.  **Post-rotation forgery**: old key used after its `rotated_out` tick -> rejected by temporal window check.
2.  **Backdating**: new key with claimed `signed_at` before its `issued_at` -> rejected by `as_of` anchor.
3.  **Retired-key injection**: attacker with stale key tries to mint a new successor -> rejected by chain-tip guard.

Includes **36 specific unit tests** and passes **52 parc integration tests**, proving deterministic rotation and boundary safety.

```mermaid
graph TD
    %% Styling
    classDef agent fill:#1e1e1e,stroke:#4a4a4a,stroke-width:2px,color:#fff;
    classDef key fill:#2b3a42,stroke:#10b981,stroke-width:2px,color:#fff;
    classDef evil fill:#4a1e1e,stroke:#ef4444,stroke-width:2px,color:#fff;
    classDef action fill:#1e1e1e,stroke:#3b82f6,stroke-width:2px,color:#fff,stroke-dasharray: 5 5;

    subgraph Legitimate Key Rotation
        A[Agent Identity]:::agent
        K0[Key 0<br>Valid: Tick 0 - 5]:::key
        K1[Key 1<br>Valid: Tick 5+]:::key

        A -->|Tick 0: Issues| K0
        A -.->|Tick 5: Rotates| K1
        K0 -->|Signs Continuity Proof| K1
    end

    subgraph Stale Key Injection Defense
        E[Attacker with<br>Compromised K0]:::evil
        EK[Evil Key X]:::evil
        V{Verify Continuity}:::action

        E -.->|Forges Proof| EK
        EK -.->|Presents to Peer| V
        V -->|Checks Chain Tip| K1
        K1 -->|Tip is K1, not K0!| V
        V -->|REJECTS Evil Key| EK
    end
```

Try it

Open PR on GitHubView diff

Checkout locally

git fetch origin pull/117/head:pr-117
git checkout pr-117