Skip to content

Fix Storacha client principal assumption to support all DID types #262

@sujalsalekar

Description

@sujalsalekar

Fix Storacha client principal assumption to support all DID types

Description

Issue Summary

The Storacha client currently enforces a did:key requirement for principals, which is unnecessarily restrictive and could cause compatibility issues with other DID types.

Current Implementation

// app/lib/server/jobs.ts:237-245
const agentData = new AgentData({
  // FIXME: The Storacha client thinks a principal has to be a `did:key`,
  // which is a bit silly. All DIDs have keys, and any `Signer` by
  // definition has its private key loaded and can sign.
  principal: getServerIdentity() as unknown as Signer<DID<'key'>>,
  // ... rest of configuration
})

Problem

  • The code forces a type cast to Signer<DID<'key'>> even though the actual identity may be a different DID type
  • This assumption is incorrect - all DIDs have keys, and any Signer can sign regardless of DID type
  • Could cause TypeScript errors or runtime issues if other DID types are used
  • Limits flexibility for future DID implementations

Impact

  • Severity: Medium
  • Risk: Future breakage or security issues if DIDs other than did:key are used
  • Affected Areas: Storacha client initialization, authentication, signing operations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions