- Notifications
You must be signed in to change notification settings - Fork 88
Feature/jss 141 add update function for wrapped keys #1006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Feature/jss 141 add update function for wrapped keys #1006
Conversation
# WHAT - Add a wrapped key update e2e test and register it in Tinny. - Wire a new updateEncryptedKey API (PUT /encrypted/{pkpAddress}/{id}) through the SDK exports, service client, and types, including optional includeVersions on getEncryptedKey and the WrappedKeyVersion typing. - Expose updatedAt/versions in stored key metadata to support opt-in versioned reads. There was a problem hiding this comment.
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 adds support for updating wrapped keys and fetching version history. The feature allows clients to update encrypted keys while preserving previous versions, enabling key rotation workflows. The implementation follows existing patterns in the wrapped-keys package with proper type safety and comprehensive test coverage.
Key Changes
- Added
updateEncryptedKeyAPI function that updates a key and preserves previous state as a version - Extended
getEncryptedKeywith optionalincludeVersionsparameter to retrieve version history - Introduced
WrappedKeyVersion,UpdateEncryptedKeyParams, andUpdateEncryptedKeyResulttypes to support versioning
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
packages/wrapped-keys/src/lib/types.ts | Added type definitions for update operations and version history including UpdateEncryptedKeyParams, UpdateEncryptedKeyResult, WrappedKeyVersion, and extended existing types with version-related fields |
packages/wrapped-keys/src/lib/service-client/types.ts | Added UpdateKeyParams interface and updated BaseRequestParams to support PUT method for updates; added includeVersions to FetchKeyParams |
packages/wrapped-keys/src/lib/service-client/client.ts | Implemented updatePrivateKey function for PUT requests and added query parameter support for version history in fetchPrivateKey |
packages/wrapped-keys/src/lib/service-client/index.ts | Exported new updatePrivateKey function |
packages/wrapped-keys/src/lib/api/update-encrypted-key.ts | New API layer function that wraps service client and handles session signature extraction |
packages/wrapped-keys/src/lib/api/get-encrypted-key.ts | Added includeVersions parameter passthrough to service client |
packages/wrapped-keys/src/lib/api/index.ts | Exported updateEncryptedKey function |
packages/wrapped-keys/src/index.ts | Added package-level exports for new types and functions |
local-tests/tests/wrapped-keys/testUpdateWrappedKey.ts | Comprehensive E2E test covering update flow and version history validation |
local-tests/test.ts | Registered new test in test suite |
.github/workflows/release-docker-images.yml | Added explorer to Docker image build matrix (unrelated to wrapped-keys feature) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| */ | ||
| export type GetEncryptedKeyDataParams = BaseApiParams & { | ||
| id: string; | ||
| includeVersions?: boolean; |
Copilot AI Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new includeVersions property added to GetEncryptedKeyDataParams is not documented in the JSDoc comment above. The existing documentation should be updated to include this new optional property.
Add to the JSDoc comment:
* @property { boolean } [includeVersions] Optional flag to include version history in the responseThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Related PRs
WHAT
Wrapped-keys now supports updating a stored key and fetching version history (
includeVersions=true)PUT /encrypted/{pkpAddress}/{id}) through the SDK exports, service client, and types, including optionalincludeVersionsongetEncryptedKey.updatedAt/versionsin stored key metadata to support opt-in versioned reads.USAGE
TEST
RUN_IN_BAND=true NETWORK=datil-dev yarn test:local --filter=testUpdateWrappedKeyDynamoDB Results
Command
Results