Skip to content

fix: refactor DID:web key generation to use agent wallet#431

Merged
rmlearney-digicatapult merged 7 commits into
mainfrom
fix/did-web-key-generation
Dec 17, 2025
Merged

fix: refactor DID:web key generation to use agent wallet#431
rmlearney-digicatapult merged 7 commits into
mainfrom
fix/did-web-key-generation

Conversation

@rmlearney-digicatapult

@rmlearney-digicatapult rmlearney-digicatapult commented Dec 16, 2025

Copy link
Copy Markdown
Contributor

Pull Request

Checklist

  • Have you read Digital Catapult's Code of Conduct?
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

PR Type

Please delete options that are irrelevant.

  • Feature

Linked tickets

High level description

Generate signing keys from agent's wallet to remove dependency on ts-jose and back-importing of generated keys

Detailed description

AI-assisted change to generate DID document's signing keys from agent wallet for guaranteed storage in the agent, enhanced privacy (keys not calculated or stored in memory, private keys not exposed), and reduced complexity by removing helper methods.

Refactored to in-line did document import method after generation.

Enhanced unit test for signing key and encryption key verification.

Use credo-ts native filtering for did lookup.

Describe alternatives you've considered

Operational impact

No functional changes

Additional context

Copilot AI review requested due to automatic review settings December 16, 2025 16:07
@rmlearney-digicatapult
rmlearney-digicatapult requested a review from a team as a code owner December 16, 2025 16:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors DID:web key generation to use the Credo TS agent's wallet for key creation and storage, removing the dependency on the ts-jose library. The change enhances security by ensuring keys are generated and stored directly in the agent's secure wallet rather than being temporarily held in memory.

Key Changes:

  • Generate signing and encryption keys directly through the agent's wallet API instead of using ts-jose
  • Remove the need to import private keys after generation since they're already stored in the wallet
  • Eliminate the extractKeyComponents helper method and related private key handling code

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/utils/didWebGenerator.ts Refactored to use agent.wallet.createKey() for key generation, removed ts-jose imports and helper methods, simplified importDidWeb() to no longer pass privateKeys
package.json Removed ts-jose dependency and bumped version to 0.16.15

Comment thread src/utils/didWebGenerator.ts Outdated
Comment thread src/utils/didWebGenerator.ts Outdated
Comment thread src/utils/didWebGenerator.ts
@rmlearney-digicatapult
rmlearney-digicatapult merged commit 610c75f into main Dec 17, 2025
11 of 17 checks passed
@rmlearney-digicatapult
rmlearney-digicatapult deleted the fix/did-web-key-generation branch December 17, 2025 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants