-
Notifications
You must be signed in to change notification settings - Fork 300
feat(express): migrate update keychain passphrase to typed routes #7106
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
Merged
danielzhao122
merged 8 commits into
master
from
WP-5417-express-migrate-api-v2-coin-keychain-id-changepassword-to-typed-route
Oct 22, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
419045f
feat(express): migrate update keychain passphrase to typed routes
danielzhao122 cca1545
refactor: added back check for keychain
danielzhao122 d65aeb8
refactor: moved decode tests into its own file
danielzhao122 83e9658
refactor: split up express definition to circumvent error TS7056
danielzhao122 0915878
test(express): add supertests for keychainChangePassword
danielzhao122 71f5e13
Merge remote-tracking branch 'origin/master' into WP-5417-express-mig…
danielzhao122 b71daba
refactor: undo changes to key
danielzhao122 7f3cb74
refactor: undo changes to key
danielzhao122 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
modules/express/src/typedRoutes/api/v2/keychainChangePassword.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import * as t from 'io-ts'; | ||
| import { httpRoute, httpRequest, optional } from '@api-ts/io-ts-http'; | ||
| import { BitgoExpressError } from '../../schemas/error'; | ||
|
|
||
| /** | ||
| * Path parameters for changing a keychain's password | ||
| */ | ||
| export const KeychainChangePasswordParams = { | ||
| /** Coin identifier (e.g. btc, tbtc, eth) */ | ||
| coin: t.string, | ||
| /** The keychain id */ | ||
| id: t.string, | ||
| } as const; | ||
|
|
||
| /** | ||
| * Request body for changing a keychain's password | ||
| */ | ||
| export const KeychainChangePasswordBody = { | ||
| /** The old password used to encrypt the keychain */ | ||
| oldPassword: t.string, | ||
| /** The new password to re-encrypt the keychain */ | ||
| newPassword: t.string, | ||
| /** Optional OTP to unlock the session if required */ | ||
| otp: optional(t.string), | ||
| } as const; | ||
|
|
||
| /** | ||
| * Response for changing a keychain's password | ||
| */ | ||
| export const KeychainChangePasswordResponse = { | ||
| /** Successful update */ | ||
| 200: t.unknown, | ||
| /** Invalid request or not found */ | ||
| 400: BitgoExpressError, | ||
| 404: BitgoExpressError, | ||
| } as const; | ||
|
|
||
| /** | ||
| * Change a keychain's passphrase, re-encrypting the key to a new password. | ||
| * | ||
| * @operationId express.v2.keychain.changePassword | ||
| */ | ||
| export const PostKeychainChangePassword = httpRoute({ | ||
| path: '/api/v2/{coin}/keychain/{id}/changepassword', | ||
| method: 'POST', | ||
| request: httpRequest({ | ||
| params: KeychainChangePasswordParams, | ||
| body: KeychainChangePasswordBody, | ||
| }), | ||
| response: KeychainChangePasswordResponse, | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.