From 0d66aa1d8560533ff215b7f784025f373cd55276 Mon Sep 17 00:00:00 2001 From: Pranav Jain Date: Mon, 21 Jul 2025 19:06:07 -0400 Subject: [PATCH] chore(ebe): remove unreachable if conditions This was pre api-ts. These will fail on api-ts now if not provided. --- src/__tests__/api/enclaved/postIndependentKey.test.ts | 9 +++++++++ src/api/enclaved/handlers/postIndependentKey.ts | 3 --- src/api/enclaved/handlers/signMultisigTransaction.ts | 6 ------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/__tests__/api/enclaved/postIndependentKey.test.ts b/src/__tests__/api/enclaved/postIndependentKey.test.ts index e18be0e..3b94087 100644 --- a/src/__tests__/api/enclaved/postIndependentKey.test.ts +++ b/src/__tests__/api/enclaved/postIndependentKey.test.ts @@ -83,4 +83,13 @@ describe('postIndependentKey', () => { kmsNock.done(); }); + + it('should fail to post an independent key if source is not provided', async () => { + const response = await agent + .post(`/api/${coin}/key/independent`) + .set('Authorization', `Bearer ${accessToken}`) + .send({}); + + response.status.should.equal(400); + }); }); diff --git a/src/api/enclaved/handlers/postIndependentKey.ts b/src/api/enclaved/handlers/postIndependentKey.ts index 8ba4871..7727867 100644 --- a/src/api/enclaved/handlers/postIndependentKey.ts +++ b/src/api/enclaved/handlers/postIndependentKey.ts @@ -6,9 +6,6 @@ export async function postIndependentKey( req: EnclavedApiSpecRouteRequest<'v1.key.independent', 'post'>, ) { const { source, seed }: { source: string; seed?: string } = req.decoded; - if (!source) { - throw new Error('Source is required for key generation'); - } // setup clients const bitgo: BitGo = req.bitgo; diff --git a/src/api/enclaved/handlers/signMultisigTransaction.ts b/src/api/enclaved/handlers/signMultisigTransaction.ts index 1d6ea3d..fd360db 100644 --- a/src/api/enclaved/handlers/signMultisigTransaction.ts +++ b/src/api/enclaved/handlers/signMultisigTransaction.ts @@ -12,12 +12,6 @@ export async function signMultisigTransaction( txPrebuild, }: { source: string; pub: string; txPrebuild: TransactionPrebuild } = req.body; - if (!source || !pub) { - throw new Error('Source and public key are required for signing'); - } else if (!txPrebuild) { - throw new Error('Transaction prebuild is required for signing'); - } - const bitgo = req.bitgo; const kms = new KmsClient(req.config);