From 5e30573558e8bc37cbf4848916b18e9da50ea669 Mon Sep 17 00:00:00 2001 From: Prithpal Sooriya Date: Thu, 19 Sep 2024 15:13:55 +0100 Subject: [PATCH] refactor: move and organize shared profile sync dependencies (#4717) ## Explanation This decouples dependencies between profile sync SDK and profile sync Controllers. It creates a shared section that both can use instead of the "cyclic dependencies". This should also help with tree shaking and reducing bundle size if using a subpath export. ## References https://consensyssoftware.atlassian.net/browse/NOTIFY-1129 ## Changelog ### `@metamask/profile-sync-controller` - **CHANGED**: Moved `encryption` folder into shared folder - **CHANGED**: Moved `storage-schema` into shared folder - **CHANGED**: Moved `env` into shared folder - **REMOVED**: Removed old `encryption` file in SDK to instead use shared encryption file. ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes --- .../controllers/authentication/services.ts | 2 +- .../UserStorageController.test.ts | 2 +- .../user-storage/UserStorageController.ts | 20 ++++++------------- .../__fixtures__/mockResponses.ts | 4 ++-- .../user-storage/__fixtures__/mockServices.ts | 2 +- .../user-storage/__fixtures__/mockStorage.ts | 2 +- .../src/controllers/user-storage/index.ts | 2 +- .../src/controllers/user-storage/services.ts | 10 +++++----- .../src/sdk/__fixtures__/mock-auth.ts | 2 +- .../src/sdk/__fixtures__/mock-userstorage.ts | 4 ++-- .../src/sdk/__fixtures__/test-utils.ts | 2 +- .../sdk/authentication-jwt-bearer/services.ts | 4 ++-- .../sdk/authentication-jwt-bearer/types.ts | 2 +- .../src/sdk/authentication.test.ts | 2 +- .../src/sdk/authentication.ts | 2 +- .../src/sdk/encryption.ts | 4 ---- .../profile-sync-controller/src/sdk/index.ts | 4 ++-- .../src/sdk/user-storage.test.ts | 2 +- .../src/sdk/user-storage.ts | 18 +++++++++++------ .../encryption/cache.ts | 0 .../encryption/encryption.test.ts | 0 .../encryption/encryption.ts | 2 +- .../encryption/index.ts | 0 .../encryption/utils.ts | 0 .../src/{sdk => shared}/env.test.ts | 2 +- .../src/{sdk => shared}/env.ts | 0 .../storage-schema.test.ts} | 2 +- .../schema.ts => shared/storage-schema.ts} | 0 .../src/shared/types/encryption.ts | 8 ++++++++ 29 files changed, 53 insertions(+), 51 deletions(-) delete mode 100644 packages/profile-sync-controller/src/sdk/encryption.ts rename packages/profile-sync-controller/src/{controllers/user-storage => shared}/encryption/cache.ts (100%) rename packages/profile-sync-controller/src/{controllers/user-storage => shared}/encryption/encryption.test.ts (100%) rename packages/profile-sync-controller/src/{controllers/user-storage => shared}/encryption/encryption.ts (99%) rename packages/profile-sync-controller/src/{controllers/user-storage => shared}/encryption/index.ts (100%) rename packages/profile-sync-controller/src/{controllers/user-storage => shared}/encryption/utils.ts (100%) rename packages/profile-sync-controller/src/{sdk => shared}/env.test.ts (95%) rename packages/profile-sync-controller/src/{sdk => shared}/env.ts (100%) rename packages/profile-sync-controller/src/{controllers/user-storage/schema.test.ts => shared/storage-schema.test.ts} (98%) rename packages/profile-sync-controller/src/{controllers/user-storage/schema.ts => shared/storage-schema.ts} (100%) create mode 100644 packages/profile-sync-controller/src/shared/types/encryption.ts diff --git a/packages/profile-sync-controller/src/controllers/authentication/services.ts b/packages/profile-sync-controller/src/controllers/authentication/services.ts index 78222a8ccb..4fe4954996 100644 --- a/packages/profile-sync-controller/src/controllers/authentication/services.ts +++ b/packages/profile-sync-controller/src/controllers/authentication/services.ts @@ -1,4 +1,4 @@ -import { Env, Platform, getEnvUrls, getOidcClientId } from '../../sdk/env'; +import { Env, Platform, getEnvUrls, getOidcClientId } from '../../shared/env'; const ENV_URLS = getEnvUrls(Env.PRD); diff --git a/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.test.ts b/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.test.ts index 8789d2b299..5996653c22 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.test.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.test.ts @@ -2,6 +2,7 @@ import { ControllerMessenger } from '@metamask/base-controller'; import type { InternalAccount } from '@metamask/keyring-api'; import type nock from 'nock'; +import encryption from '../../shared/encryption'; import type { AuthenticationControllerGetBearerToken, AuthenticationControllerGetSessionProfile, @@ -23,7 +24,6 @@ import { MOCK_STORAGE_KEY_SIGNATURE, } from './__fixtures__/mockStorage'; import * as AccountsUserStorageModule from './accounts/user-storage'; -import encryption from './encryption/encryption'; import type { GetUserStorageAllFeatureEntriesResponse, GetUserStorageResponse, diff --git a/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts b/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts index c7de6cedf0..3b868ea01f 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts @@ -21,6 +21,12 @@ import type { import type { NetworkConfiguration } from '@metamask/network-controller'; import type { HandleSnapRequest } from '@metamask/snaps-controllers'; +import { createSHA256Hash } from '../../shared/encryption'; +import type { + UserStoragePathWithFeatureAndKey, + UserStoragePathWithFeatureOnly, +} from '../../shared/storage-schema'; +import type { NativeScrypt } from '../../shared/types/encryption'; import { createSnapSignMessageRequest } from '../authentication/auth-snap-requests'; import type { AuthenticationControllerGetBearerToken, @@ -34,12 +40,7 @@ import { isNameDefaultAccountName, mapInternalAccountToUserStorageAccount, } from './accounts/user-storage'; -import { createSHA256Hash } from './encryption'; import { startNetworkSyncing } from './network-syncing/controller-integration'; -import type { - UserStoragePathWithFeatureAndKey, - UserStoragePathWithFeatureOnly, -} from './schema'; import { getUserStorage, getUserStorageAllFeatureEntries, @@ -80,15 +81,6 @@ export declare type NotificationServicesControllerSelectIsNotificationServicesEn handler: () => boolean; }; -export declare type NativeScrypt = ( - passwd: string, - salt: Uint8Array, - N: number, - r: number, - p: number, - size: number, -) => Promise; - const controllerName = 'UserStorageController'; // State diff --git a/packages/profile-sync-controller/src/controllers/user-storage/__fixtures__/mockResponses.ts b/packages/profile-sync-controller/src/controllers/user-storage/__fixtures__/mockResponses.ts index 68f95b3c8f..94e9229215 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/__fixtures__/mockResponses.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/__fixtures__/mockResponses.ts @@ -1,8 +1,8 @@ import type { UserStoragePathWithFeatureAndKey, UserStoragePathWithFeatureOnly, -} from '../schema'; -import { createEntryPath } from '../schema'; +} from '../../../shared/storage-schema'; +import { createEntryPath } from '../../../shared/storage-schema'; import type { GetUserStorageAllFeatureEntriesResponse, GetUserStorageResponse, diff --git a/packages/profile-sync-controller/src/controllers/user-storage/__fixtures__/mockServices.ts b/packages/profile-sync-controller/src/controllers/user-storage/__fixtures__/mockServices.ts index 00bead8cf3..57fbc9a944 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/__fixtures__/mockServices.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/__fixtures__/mockServices.ts @@ -3,7 +3,7 @@ import nock from 'nock'; import type { UserStoragePathWithFeatureAndKey, UserStoragePathWithFeatureOnly, -} from '../schema'; +} from '../../../shared/storage-schema'; import { getMockUserStorageGetResponse, getMockUserStoragePutResponse, diff --git a/packages/profile-sync-controller/src/controllers/user-storage/__fixtures__/mockStorage.ts b/packages/profile-sync-controller/src/controllers/user-storage/__fixtures__/mockStorage.ts index 628f45d05f..c6de9beeac 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/__fixtures__/mockStorage.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/__fixtures__/mockStorage.ts @@ -1,4 +1,4 @@ -import encryption, { createSHA256Hash } from '../encryption'; +import encryption, { createSHA256Hash } from '../../../shared/encryption'; export const MOCK_STORAGE_KEY_SIGNATURE = 'mockStorageKey'; export const MOCK_STORAGE_KEY = createSHA256Hash(MOCK_STORAGE_KEY_SIGNATURE); diff --git a/packages/profile-sync-controller/src/controllers/user-storage/index.ts b/packages/profile-sync-controller/src/controllers/user-storage/index.ts index f6b2fc8d0d..074e73da40 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/index.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/index.ts @@ -4,5 +4,5 @@ const UserStorageController = Controller; export { Controller }; export default UserStorageController; export * from './UserStorageController'; -export * from './encryption'; export * as Mocks from './__fixtures__'; +export * from '../../shared/encryption'; diff --git a/packages/profile-sync-controller/src/controllers/user-storage/services.ts b/packages/profile-sync-controller/src/controllers/user-storage/services.ts index 752c4f899a..49838b5532 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/services.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/services.ts @@ -1,13 +1,13 @@ import log from 'loglevel'; -import { Env, getEnvUrls } from '../../sdk/env'; -import encryption from './encryption'; +import encryption from '../../shared/encryption'; +import { Env, getEnvUrls } from '../../shared/env'; import type { UserStoragePathWithFeatureAndKey, UserStoragePathWithFeatureOnly, -} from './schema'; -import { createEntryPath } from './schema'; -import type { NativeScrypt } from './UserStorageController'; +} from '../../shared/storage-schema'; +import { createEntryPath } from '../../shared/storage-schema'; +import type { NativeScrypt } from '../../shared/types/encryption'; const ENV_URLS = getEnvUrls(Env.PRD); diff --git a/packages/profile-sync-controller/src/sdk/__fixtures__/mock-auth.ts b/packages/profile-sync-controller/src/sdk/__fixtures__/mock-auth.ts index 2313def5f2..b5a201bbea 100644 --- a/packages/profile-sync-controller/src/sdk/__fixtures__/mock-auth.ts +++ b/packages/profile-sync-controller/src/sdk/__fixtures__/mock-auth.ts @@ -1,5 +1,6 @@ import nock from 'nock'; +import { Env } from '../../shared/env'; import { NONCE_URL, SIWE_LOGIN_URL, @@ -7,7 +8,6 @@ import { OIDC_TOKEN_URL, PAIR_IDENTIFIERS, } from '../authentication-jwt-bearer/services'; -import { Env } from '../env'; type MockReply = { status: nock.StatusCode; diff --git a/packages/profile-sync-controller/src/sdk/__fixtures__/mock-userstorage.ts b/packages/profile-sync-controller/src/sdk/__fixtures__/mock-userstorage.ts index 913bea0d0f..e777e2e99b 100644 --- a/packages/profile-sync-controller/src/sdk/__fixtures__/mock-userstorage.ts +++ b/packages/profile-sync-controller/src/sdk/__fixtures__/mock-userstorage.ts @@ -1,7 +1,7 @@ import nock from 'nock'; -import encryption from '../encryption'; -import { Env } from '../env'; +import encryption from '../../shared/encryption'; +import { Env } from '../../shared/env'; import { STORAGE_URL } from '../user-storage'; type MockReply = { diff --git a/packages/profile-sync-controller/src/sdk/__fixtures__/test-utils.ts b/packages/profile-sync-controller/src/sdk/__fixtures__/test-utils.ts index 016359c79e..e163369bc5 100644 --- a/packages/profile-sync-controller/src/sdk/__fixtures__/test-utils.ts +++ b/packages/profile-sync-controller/src/sdk/__fixtures__/test-utils.ts @@ -1,10 +1,10 @@ +import { Env, Platform } from '../../shared/env'; import { JwtBearerAuth } from '../authentication'; import type { AuthSigningOptions, AuthStorageOptions, } from '../authentication-jwt-bearer/types'; import { AuthType } from '../authentication-jwt-bearer/types'; -import { Env, Platform } from '../env'; // Alias mocking variables with ANY to test runtime safety. // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/packages/profile-sync-controller/src/sdk/authentication-jwt-bearer/services.ts b/packages/profile-sync-controller/src/sdk/authentication-jwt-bearer/services.ts index 6002ae96f0..7eec0ad90f 100644 --- a/packages/profile-sync-controller/src/sdk/authentication-jwt-bearer/services.ts +++ b/packages/profile-sync-controller/src/sdk/authentication-jwt-bearer/services.ts @@ -1,5 +1,5 @@ -import type { Env, Platform } from '../env'; -import { getEnvUrls, getOidcClientId } from '../env'; +import type { Env, Platform } from '../../shared/env'; +import { getEnvUrls, getOidcClientId } from '../../shared/env'; import { NonceRetrievalError, PairError, diff --git a/packages/profile-sync-controller/src/sdk/authentication-jwt-bearer/types.ts b/packages/profile-sync-controller/src/sdk/authentication-jwt-bearer/types.ts index 0759346ed2..ca6721c371 100644 --- a/packages/profile-sync-controller/src/sdk/authentication-jwt-bearer/types.ts +++ b/packages/profile-sync-controller/src/sdk/authentication-jwt-bearer/types.ts @@ -1,4 +1,4 @@ -import type { Env, Platform } from '../env'; +import type { Env, Platform } from '../../shared/env'; export enum AuthType { /* sign in using a private key derived from your secret recovery phrase (SRP). diff --git a/packages/profile-sync-controller/src/sdk/authentication.test.ts b/packages/profile-sync-controller/src/sdk/authentication.test.ts index 965182aa91..5adc2edbd3 100644 --- a/packages/profile-sync-controller/src/sdk/authentication.test.ts +++ b/packages/profile-sync-controller/src/sdk/authentication.test.ts @@ -1,3 +1,4 @@ +import { Env, Platform } from '../shared/env'; import { MOCK_ACCESS_JWT, MOCK_SRP_LOGIN_RESPONSE, @@ -7,7 +8,6 @@ import type { MockVariable } from './__fixtures__/test-utils'; import { arrangeAuth } from './__fixtures__/test-utils'; import { JwtBearerAuth } from './authentication'; import type { LoginResponse, Pair } from './authentication-jwt-bearer/types'; -import { Env, Platform } from './env'; import { NonceRetrievalError, PairError, diff --git a/packages/profile-sync-controller/src/sdk/authentication.ts b/packages/profile-sync-controller/src/sdk/authentication.ts index 6d321f8c7d..119310cc7d 100644 --- a/packages/profile-sync-controller/src/sdk/authentication.ts +++ b/packages/profile-sync-controller/src/sdk/authentication.ts @@ -1,3 +1,4 @@ +import type { Env } from '../shared/env'; import { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe'; import { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp'; import { @@ -6,7 +7,6 @@ import { } from './authentication-jwt-bearer/services'; import type { UserProfile, Pair } from './authentication-jwt-bearer/types'; import { AuthType } from './authentication-jwt-bearer/types'; -import type { Env } from './env'; import { PairError, UnsupportedAuthTypeError } from './errors'; // Computing the Classes, so we only get back the public methods for the interface. diff --git a/packages/profile-sync-controller/src/sdk/encryption.ts b/packages/profile-sync-controller/src/sdk/encryption.ts deleted file mode 100644 index 0d17c4e6bc..0000000000 --- a/packages/profile-sync-controller/src/sdk/encryption.ts +++ /dev/null @@ -1,4 +0,0 @@ -import encryption from '../controllers/user-storage/encryption/encryption'; - -export * from '../controllers/user-storage/encryption/encryption'; -export default encryption; diff --git a/packages/profile-sync-controller/src/sdk/index.ts b/packages/profile-sync-controller/src/sdk/index.ts index 833b446bf6..e9daa6213e 100644 --- a/packages/profile-sync-controller/src/sdk/index.ts +++ b/packages/profile-sync-controller/src/sdk/index.ts @@ -1,6 +1,6 @@ export * from './authentication'; export * from './user-storage'; -export * from './env'; export * from './errors'; -export * from './encryption'; export * from './utils/messaging-signing-snap-requests'; +export * from '../shared/encryption'; +export * from '../shared/env'; diff --git a/packages/profile-sync-controller/src/sdk/user-storage.test.ts b/packages/profile-sync-controller/src/sdk/user-storage.test.ts index a398566384..8c5490b751 100644 --- a/packages/profile-sync-controller/src/sdk/user-storage.test.ts +++ b/packages/profile-sync-controller/src/sdk/user-storage.test.ts @@ -1,3 +1,4 @@ +import { Env } from '../shared/env'; import { arrangeAuthAPIs } from './__fixtures__/mock-auth'; import { MOCK_NOTIFICATIONS_DATA, @@ -8,7 +9,6 @@ import { } from './__fixtures__/mock-userstorage'; import { arrangeAuth, typedMockFn } from './__fixtures__/test-utils'; import type { IBaseAuth } from './authentication-jwt-bearer/types'; -import { Env } from './env'; import { NotFoundError, UserStorageError } from './errors'; import type { StorageOptions } from './user-storage'; import { STORAGE_URL, UserStorage } from './user-storage'; diff --git a/packages/profile-sync-controller/src/sdk/user-storage.ts b/packages/profile-sync-controller/src/sdk/user-storage.ts index 43695763d2..cbb4005b2f 100644 --- a/packages/profile-sync-controller/src/sdk/user-storage.ts +++ b/packages/profile-sync-controller/src/sdk/user-storage.ts @@ -1,13 +1,12 @@ +import encryption, { createSHA256Hash } from '../shared/encryption'; +import type { Env } from '../shared/env'; +import { getEnvUrls } from '../shared/env'; import type { UserStoragePathWithFeatureAndKey, UserStoragePathWithFeatureOnly, -} from '../controllers/user-storage/schema'; -import { createEntryPath } from '../controllers/user-storage/schema'; -import type { GetUserStorageAllFeatureEntriesResponse } from '../controllers/user-storage/services'; +} from '../shared/storage-schema'; +import { createEntryPath } from '../shared/storage-schema'; import type { IBaseAuth } from './authentication-jwt-bearer/types'; -import encryption, { createSHA256Hash } from './encryption'; -import type { Env } from './env'; -import { getEnvUrls } from './env'; import { NotFoundError, UserStorageError } from './errors'; export const STORAGE_URL = (env: Env, encryptedPath: string) => @@ -27,6 +26,13 @@ export type UserStorageOptions = { storage?: StorageOptions; }; +type GetUserStorageAllFeatureEntriesResponse = { + // eslint-disable-next-line @typescript-eslint/naming-convention + HashedKey: string; + // eslint-disable-next-line @typescript-eslint/naming-convention + Data: string; +}[]; + type ErrorMessage = { message: string; error: string; diff --git a/packages/profile-sync-controller/src/controllers/user-storage/encryption/cache.ts b/packages/profile-sync-controller/src/shared/encryption/cache.ts similarity index 100% rename from packages/profile-sync-controller/src/controllers/user-storage/encryption/cache.ts rename to packages/profile-sync-controller/src/shared/encryption/cache.ts diff --git a/packages/profile-sync-controller/src/controllers/user-storage/encryption/encryption.test.ts b/packages/profile-sync-controller/src/shared/encryption/encryption.test.ts similarity index 100% rename from packages/profile-sync-controller/src/controllers/user-storage/encryption/encryption.test.ts rename to packages/profile-sync-controller/src/shared/encryption/encryption.test.ts diff --git a/packages/profile-sync-controller/src/controllers/user-storage/encryption/encryption.ts b/packages/profile-sync-controller/src/shared/encryption/encryption.ts similarity index 99% rename from packages/profile-sync-controller/src/controllers/user-storage/encryption/encryption.ts rename to packages/profile-sync-controller/src/shared/encryption/encryption.ts index 3111f596a8..fcc53bc6e0 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/encryption/encryption.ts +++ b/packages/profile-sync-controller/src/shared/encryption/encryption.ts @@ -4,7 +4,7 @@ import { scryptAsync } from '@noble/hashes/scrypt'; import { sha256 } from '@noble/hashes/sha256'; import { utf8ToBytes, concatBytes, bytesToHex } from '@noble/hashes/utils'; -import type { NativeScrypt } from '../UserStorageController'; +import type { NativeScrypt } from '../types/encryption'; import { getAnyCachedKey, getCachedKeyBySalt, setCachedKey } from './cache'; import { base64ToByteArray, byteArrayToBase64, bytesToUtf8 } from './utils'; diff --git a/packages/profile-sync-controller/src/controllers/user-storage/encryption/index.ts b/packages/profile-sync-controller/src/shared/encryption/index.ts similarity index 100% rename from packages/profile-sync-controller/src/controllers/user-storage/encryption/index.ts rename to packages/profile-sync-controller/src/shared/encryption/index.ts diff --git a/packages/profile-sync-controller/src/controllers/user-storage/encryption/utils.ts b/packages/profile-sync-controller/src/shared/encryption/utils.ts similarity index 100% rename from packages/profile-sync-controller/src/controllers/user-storage/encryption/utils.ts rename to packages/profile-sync-controller/src/shared/encryption/utils.ts diff --git a/packages/profile-sync-controller/src/sdk/env.test.ts b/packages/profile-sync-controller/src/shared/env.test.ts similarity index 95% rename from packages/profile-sync-controller/src/sdk/env.test.ts rename to packages/profile-sync-controller/src/shared/env.test.ts index 16b0c49d2e..4f9e1403ab 100644 --- a/packages/profile-sync-controller/src/sdk/env.test.ts +++ b/packages/profile-sync-controller/src/shared/env.test.ts @@ -1,4 +1,4 @@ -import type { MockVariable } from './__fixtures__/test-utils'; +import type { MockVariable } from '../sdk/__fixtures__/test-utils'; import { getEnvUrls, Env, Platform, getOidcClientId } from './env'; describe('getEnvUrls', () => { diff --git a/packages/profile-sync-controller/src/sdk/env.ts b/packages/profile-sync-controller/src/shared/env.ts similarity index 100% rename from packages/profile-sync-controller/src/sdk/env.ts rename to packages/profile-sync-controller/src/shared/env.ts diff --git a/packages/profile-sync-controller/src/controllers/user-storage/schema.test.ts b/packages/profile-sync-controller/src/shared/storage-schema.test.ts similarity index 98% rename from packages/profile-sync-controller/src/controllers/user-storage/schema.test.ts rename to packages/profile-sync-controller/src/shared/storage-schema.test.ts index c35a9459c5..744f74388a 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/schema.test.ts +++ b/packages/profile-sync-controller/src/shared/storage-schema.test.ts @@ -2,7 +2,7 @@ import { createEntryPath, getFeatureAndKeyFromPath, USER_STORAGE_SCHEMA, -} from './schema'; +} from './storage-schema'; // eslint-disable-next-line @typescript-eslint/no-explicit-any type ErroneousUserStoragePath = any; diff --git a/packages/profile-sync-controller/src/controllers/user-storage/schema.ts b/packages/profile-sync-controller/src/shared/storage-schema.ts similarity index 100% rename from packages/profile-sync-controller/src/controllers/user-storage/schema.ts rename to packages/profile-sync-controller/src/shared/storage-schema.ts diff --git a/packages/profile-sync-controller/src/shared/types/encryption.ts b/packages/profile-sync-controller/src/shared/types/encryption.ts new file mode 100644 index 0000000000..7ac85606bf --- /dev/null +++ b/packages/profile-sync-controller/src/shared/types/encryption.ts @@ -0,0 +1,8 @@ +export declare type NativeScrypt = ( + passwd: string, + salt: Uint8Array, + N: number, + r: number, + p: number, + size: number, +) => Promise;