2026-01-07 21:54:32 -05:00
# Implementation TODO
2026-01-10 18:20:32 -05:00
Remaining tasks for the Nebula Key Enclave. See [AGENTS.md ](./AGENTS.md ) for architecture overview and [CHANGELOG.md ](./CHANGELOG.md ) for completed work.
2026-01-10 17:10:45 -05:00
---
2026-01-10 18:20:32 -05:00
## 1. UCAN v1.0.0-rc.1 Remaining Work
2026-01-10 17:10:45 -05:00
2026-01-10 18:20:32 -05:00
### 1.1 SQLite Functions for Policy & Validation
2026-01-10 17:10:45 -05:00
2026-01-10 18:20:32 -05:00
- [ ] `ucan_policy_match(policy_json, args_json)` - Evaluate policy against args
- [ ] `ucan_cmd_subsumes(parent_cmd, child_cmd)` - Check command hierarchy
- [ ] `ucan_chain_valid(invocation_cid)` - Recursive CTE proof chain validation
- [ ] `ucan_parse_envelope(envelope_blob)` - Extract fields from DAG-CBOR as JSON
2026-01-10 17:10:45 -05:00
2026-01-10 18:20:32 -05:00
### 1.2 SQLite Functions for UCAN Signing
2026-01-10 17:10:45 -05:00
2026-01-10 18:20:32 -05:00
- [ ] `ucan_sign(enclave_id, payload)` - Sign delegation/invocation payloads
- [ ] `ucan_seal(enclave_id, delegation_json)` - Build complete sealed envelope
- [ ] Integrate with go-ucan's `crypto.Signer` interface via SQLite bridge
2026-01-08 14:54:40 -05:00
2026-01-10 18:20:32 -05:00
### 1.3 Revocation Checker
2026-01-08 14:54:40 -05:00
2026-01-10 18:20:32 -05:00
- [ ] Implement revocation checking interface for go-ucan
- [ ] Integration with chain validation via `ExecutionAllowed()`
2026-01-08 14:54:40 -05:00
2026-01-10 18:20:32 -05:00
### 1.4 Testing
2026-01-08 14:54:40 -05:00
2026-01-08 16:37:36 -05:00
- [ ] Unit tests for builders (DelegationBuilder, InvocationBuilder)
2026-01-08 14:54:40 -05:00
- [ ] Interoperability tests against TypeScript implementation
- [ ] Test vectors from UCAN spec
---
2026-01-10 18:20:32 -05:00
## 2. Remaining Actions
2026-01-08 15:25:54 -05:00
2026-01-10 18:20:32 -05:00
### 2.1 Sync Checkpoint Actions
2026-01-07 21:54:32 -05:00
2026-01-10 18:20:32 -05:00
- [ ] `GetSyncCheckpoint(ctx, resourceType)`
- [ ] `UpsertSyncCheckpoint(ctx, params)`
- [ ] `ListSyncCheckpoints(ctx)`
2026-01-08 15:25:54 -05:00
2026-01-10 18:20:32 -05:00
### 2.2 Invocation Validation
2026-01-07 21:54:32 -05:00
2026-01-10 18:20:32 -05:00
- [ ] `ValidateInvocation(ctx, invocation)` - Requires delegation.Loader
2026-01-07 21:54:32 -05:00
---
2026-01-10 18:20:32 -05:00
## 3. Plugin Extensions
2026-01-07 21:54:32 -05:00
2026-01-10 18:20:32 -05:00
### 3.1 Exec Handlers
2026-01-07 23:39:40 -05:00
2026-01-10 18:20:32 -05:00
- [ ] Add `invocations` resource handler
2026-01-07 21:54:32 -05:00
- [ ] Add `sync_checkpoints` resource handler
2026-01-10 18:20:32 -05:00
### 3.2 Generate Function
2026-01-07 23:39:40 -05:00
2026-01-07 21:54:32 -05:00
- [ ] Parse WebAuthn credential properly (CBOR/COSE format)
- [ ] Extract public key from credential
- [ ] Create initial verification method
- [ ] Create initial credential record
2026-01-10 18:20:32 -05:00
### 3.3 SQLite Functions
2026-01-07 23:39:40 -05:00
2026-01-10 18:20:32 -05:00
- [ ] `enclave_sign(enclave_id, data)` - Sign in queries
- [ ] Dedicated `sign` wasmexport function
2026-01-07 21:54:32 -05:00
---
2026-01-10 18:20:32 -05:00
## 4. Capability Delegation (v1.0.0-rc.1)
2026-01-07 21:54:32 -05:00
2026-01-10 18:20:32 -05:00
SQLite triggers and views for real-time delegation validation.
2026-01-07 21:54:32 -05:00
2026-01-10 18:20:32 -05:00
### 4.1 Schema Enhancements
2026-01-07 23:39:40 -05:00
2026-01-10 18:20:32 -05:00
- [ ] `delegation_depth` generated column using recursive CTE
- [ ] CHECK constraint for max depth (e.g., 10 levels)
- [ ] `valid_delegations` view joining chain validation
- [ ] `is_expired` / `is_active` generated columns
- [ ] Partial index on `is_active = 1`
2026-01-07 21:54:32 -05:00
2026-01-10 18:20:32 -05:00
### 4.2 Policy Functions
2026-01-08 14:54:40 -05:00
2026-01-10 17:10:45 -05:00
- [ ] `ucan_policy_subsumes(parent_pol, child_pol)` - Check attenuation
- [ ] `ucan_cmd_covers(parent_cmd, child_cmd)` - Command hierarchy
2026-01-10 18:20:32 -05:00
- [ ] Trigger `BEFORE INSERT ON ucan_delegations` to validate attenuation
2026-01-07 21:54:32 -05:00
---
2026-01-10 18:20:32 -05:00
## 5. DID State Sync
2026-01-07 23:39:40 -05:00
2026-01-07 21:54:32 -05:00
- [ ] Create `internal/enclave/sync.go` - DID state sync logic
2026-01-10 18:20:32 -05:00
- [ ] Checkpoint tracking (block height, tx hash)
2026-01-07 21:54:32 -05:00
- [ ] Fetch DID document updates from chain
- [ ] Handle reorgs and rollbacks
---
2026-01-10 18:20:32 -05:00
## 6. TypeScript SDK
2026-01-07 21:54:32 -05:00
2026-01-10 18:20:32 -05:00
### 6.1 Core SDK (Partial - Basic wrappers exist)
2026-01-07 23:39:40 -05:00
2026-01-10 18:20:32 -05:00
- [ ] Full type definitions for all responses
- [ ] Error handling improvements
- [ ] Documentation and examples
2026-01-07 21:54:32 -05:00
2026-01-10 18:20:32 -05:00
### 6.2 UCAN SDK
2026-01-07 23:39:40 -05:00
2026-01-10 18:20:32 -05:00
- [ ] Delegation/Invocation builders
2026-01-08 14:54:40 -05:00
- [ ] Policy builder helpers
2026-01-10 18:20:32 -05:00
- [ ] DAG-CBOR encoding/decoding
2026-01-08 14:54:40 -05:00
- [ ] CID computation
2026-01-07 21:54:32 -05:00
2026-01-10 18:20:32 -05:00
### 6.3 WebAuthn Integration
2026-01-07 23:39:40 -05:00
2026-01-07 21:54:32 -05:00
- [ ] Helper for credential creation
2026-01-10 18:20:32 -05:00
- [ ] PRF extension output helper
2026-01-07 21:54:32 -05:00
---
2026-01-10 18:20:32 -05:00
## 7. Testing
2026-01-07 23:39:40 -05:00
2026-01-10 18:20:32 -05:00
- [ ] Unit tests for ActionManager methods
- [ ] Serialization roundtrip tests
- [ ] UCAN policy evaluation tests
- [ ] Integration tests (generate -> load -> exec)
- [ ] Go <-> TypeScript interoperability
2026-01-08 14:54:40 -05:00
2026-01-07 21:54:32 -05:00
---
2026-01-10 18:20:32 -05:00
## 8. Security Hardening
2026-01-07 23:39:40 -05:00
2026-01-10 18:20:32 -05:00
- [ ] JSON schema validation
- [ ] DID format validation
- [ ] Constant-time comparison for sensitive data
- [ ] Session validation before sensitive ops
- [ ] Grant scope checking
2026-01-07 21:54:32 -05:00
---
## Priority Order
2026-01-10 18:20:32 -05:00
1. **High Priority (SQLite Functions) **
- `ucan_sign()` / `ucan_seal()` for UCAN signing
- `ucan_parse_envelope()` for JSON extraction
- `ucan_chain_valid()` for proof validation
- `enclave_sign()` for general signing
- `invocations` exec handler
2. **Medium Priority (SQLite Automation) **
- Generated columns for delegation status
- Policy evaluation functions
- Delegation depth constraints
3. **Lower Priority (Enhancement) **
- TypeScript SDK completion
- DID State Sync
- Testing
- Security Hardening
2026-01-08 14:54:40 -05:00
---
2026-01-10 17:10:45 -05:00
See [CHANGELOG.md ](./CHANGELOG.md ) for completed items and version history.