From 9de46b44d5bbfed16eee82f13adb9575ea49e371 Mon Sep 17 00:00:00 2001 From: Elliot Winkler Date: Wed, 9 Sep 2026 09:04:15 -0600 Subject: [PATCH 1/2] Fix dev-only lint errors in universal-kyc packages Currently, there are some type errors that exist in delegation packages. These type errors are not present in production code, so they are not flagged by `yarn build`, but they _will_ be flagged soon by `yarn lint:tsc`, and so we need to fix them. The notable change here is that since `@metamask/profile-sync-controller` has custom subpath exports, they need to be added to the mapping in `tsconfig.packages.json` to ensure that TypeScript resolves types from source files, _not_ built files. --- packages/kyc-controller/src/KycController.test.ts | 3 +-- packages/kyc-controller/src/KycService.test.ts | 7 +++---- packages/kyc-controller/src/ukyc/testToken.test.ts | 3 ++- tsconfig.packages.json | 6 ++++++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/kyc-controller/src/KycController.test.ts b/packages/kyc-controller/src/KycController.test.ts index 40c9a7d14ac..e487d652527 100644 --- a/packages/kyc-controller/src/KycController.test.ts +++ b/packages/kyc-controller/src/KycController.test.ts @@ -541,7 +541,6 @@ describe('KycController', () => { }, }, async ({ controller, handlers }) => { - // @ts-expect-error T&C2 flags are required await controller.acceptTermsAndStartSession(); expect(controller.state.phase).toBe('error'); @@ -4950,7 +4949,7 @@ function withController( parent: rootMessenger, }); rootMessenger.delegate({ - actions: SERVICE_ACTIONS, + actions: [...SERVICE_ACTIONS], events: [], messenger, }); diff --git a/packages/kyc-controller/src/KycService.test.ts b/packages/kyc-controller/src/KycService.test.ts index a6554a902c9..b6882ffdd48 100644 --- a/packages/kyc-controller/src/KycService.test.ts +++ b/packages/kyc-controller/src/KycService.test.ts @@ -1,8 +1,8 @@ import { Messenger, MOCK_ANY_NAMESPACE } from '@metamask/messenger'; import type { - MockAnyNamespace, MessengerActions, MessengerEvents, + MockAnyNamespace, } from '@metamask/messenger'; import nock, { cleanAll } from 'nock'; @@ -53,8 +53,7 @@ describe('KycService', () => { expect( () => new KycService({ - messenger: - messenger as unknown as MockAnyNamespace, + messenger, baseUrl: MOCK_API_URL, }), ).toThrow( @@ -558,7 +557,7 @@ describe('KycService', () => { }); it('falls back to status-only HttpError when the body is not an object', async () => { - nock(MOCK_API_URL).get('/sessions/sid/status').reply(409, null); + nock(MOCK_API_URL).get('/sessions/sid/status').reply(409, 'null'); const { service } = getService(); await expect( diff --git a/packages/kyc-controller/src/ukyc/testToken.test.ts b/packages/kyc-controller/src/ukyc/testToken.test.ts index 0098a6bbbc6..0ba54fbf802 100644 --- a/packages/kyc-controller/src/ukyc/testToken.test.ts +++ b/packages/kyc-controller/src/ukyc/testToken.test.ts @@ -8,6 +8,7 @@ import { UKYC_KWIL_AUDIENCE, } from './constants.js'; import { canonicalizeJson } from './storageAccessToken.js'; +import type { UkycStorageAccessToken } from './storageAccessToken.js'; import { mintUkycTestToken } from './testToken.js'; // A fixed 32-byte secret (all 0x42), as hex, so storage_id and keys are stable. @@ -23,7 +24,7 @@ const EXPIRES_AT = new Date('2026-07-07T04:00:00Z'); * @returns The decoded token envelope. */ function decodeHeader(header: string): { - payload: Record; + payload: UkycStorageAccessToken['payload']; signature: string; } { const [scheme, creds] = header.split(' '); diff --git a/tsconfig.packages.json b/tsconfig.packages.json index fbde19a5981..8d846b3b185 100644 --- a/tsconfig.packages.json +++ b/tsconfig.packages.json @@ -13,6 +13,12 @@ */ "paths": { "@metamask/json-rpc-engine/v2": ["../json-rpc-engine/src/v2/index.ts"], + "@metamask/profile-sync-controller/auth": [ + "../profile-sync-controller/src/controllers/authentication/index.ts" + ], + "@metamask/profile-sync-controller/user-storage": [ + "../profile-sync-controller/src/controllers/user-storage/index.ts" + ], "@metamask/*": ["../*/src"] } } From 6c4115b9ceb4b378a98ebbc96e4c2ddf00e6ba26 Mon Sep 17 00:00:00 2001 From: Elliot Winkler Date: Wed, 9 Sep 2026 14:05:22 -0600 Subject: [PATCH 2/2] Use UkycStorageAccessTokenPayload --- packages/kyc-controller/src/ukyc/testToken.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/kyc-controller/src/ukyc/testToken.test.ts b/packages/kyc-controller/src/ukyc/testToken.test.ts index 0ba54fbf802..21e9ac66c99 100644 --- a/packages/kyc-controller/src/ukyc/testToken.test.ts +++ b/packages/kyc-controller/src/ukyc/testToken.test.ts @@ -8,7 +8,7 @@ import { UKYC_KWIL_AUDIENCE, } from './constants.js'; import { canonicalizeJson } from './storageAccessToken.js'; -import type { UkycStorageAccessToken } from './storageAccessToken.js'; +import type { UkycStorageAccessTokenPayload } from './storageAccessToken.js'; import { mintUkycTestToken } from './testToken.js'; // A fixed 32-byte secret (all 0x42), as hex, so storage_id and keys are stable. @@ -24,7 +24,7 @@ const EXPIRES_AT = new Date('2026-07-07T04:00:00Z'); * @returns The decoded token envelope. */ function decodeHeader(header: string): { - payload: UkycStorageAccessToken['payload']; + payload: UkycStorageAccessTokenPayload; signature: string; } { const [scheme, creds] = header.split(' ');