Skip to content

Commit f328904

Browse files
committed
style: fix linter warnings
1 parent 10f3885 commit f328904

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

packages/profile-sync-controller/src/controllers/user-storage/UserStorageController.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type {
1111
StateMetadata,
1212
} from '@metamask/base-controller';
1313
import { BaseController } from '@metamask/base-controller';
14+
import { encrypt } from '@metamask/eth-sig-util';
1415
import {
1516
type KeyringControllerGetStateAction,
1617
type KeyringControllerLockEvent,
@@ -26,6 +27,7 @@ import type {
2627
NetworkControllerUpdateNetworkAction,
2728
} from '@metamask/network-controller';
2829
import type { HandleSnapRequest } from '@metamask/snaps-controllers';
30+
import { hexToBytes } from '@noble/hashes/utils';
2931

3032
import {
3133
saveInternalAccountToUserStorage,
@@ -37,6 +39,7 @@ import {
3739
startNetworkSyncing,
3840
} from './network-syncing/controller-integration';
3941
import { Env, UserStorage } from '../../sdk';
42+
import { byteArrayToBase64 } from '../../shared/encryption/utils';
4043
import type { UserStorageFeatureKeys } from '../../shared/storage-schema';
4144
import {
4245
type UserStoragePathWithFeatureAndKey,
@@ -54,8 +57,6 @@ import {
5457
createSnapEncryptionPublicKeyRequest,
5558
createSnapSignMessageRequest,
5659
} from '../authentication/auth-snap-requests';
57-
import { encrypt } from '@metamask/eth-sig-util';
58-
import { bytesToBase64, hexToBytes } from '@metamask/utils';
5960

6061
const controllerName = 'UserStorageController';
6162

@@ -390,7 +391,7 @@ export default class UserStorageController extends BaseController<
390391
encryptMessage: async (message: string, publicKeyHex: string) => {
391392
const erc1024Payload = encrypt({
392393
// eth-sig-util expects the public key to be in base64 format
393-
publicKey: bytesToBase64(hexToBytes(publicKeyHex)),
394+
publicKey: byteArrayToBase64(hexToBytes(publicKeyHex)),
394395
data: message,
395396
version: 'x25519-xsalsa20-poly1305',
396397
});
@@ -690,6 +691,7 @@ export default class UserStorageController extends BaseController<
690691

691692
/**
692693
* Calls the snap to attempt to decrypt the message.
694+
*
693695
* @param ciphertext - the encrypted text to decrypt.
694696
* @returns The decrypted message, if decryption was possible.
695697
*/

packages/profile-sync-controller/src/controllers/user-storage/__fixtures__/mockMessenger.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { NotNamespacedBy } from '@metamask/base-controller';
22
import { Messenger } from '@metamask/base-controller';
3-
import type { EthKeyring } from '@metamask/keyring-internal-api';
43
import { decrypt, type EthEncryptedData } from '@metamask/eth-sig-util';
4+
import type { EthKeyring } from '@metamask/keyring-internal-api';
55

66
import type {
77
AllowedActions,

packages/profile-sync-controller/src/controllers/user-storage/account-syncing/__fixtures__/test-utils.ts

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export function mockUserStorageMessengerForAccountSyncing(options?: {
3131
messengerMocks.mockKeyringGetAccounts.mockImplementation(async () => {
3232
return (
3333
options?.accounts?.accountsList
34-
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
3534
?.filter((a) => a.metadata.keyring.type === KeyringTypes.hd)
3635
.map((a) => a.address) ??
3736
MOCK_INTERNAL_ACCOUNTS.ALL.map((a) => a.address)

packages/profile-sync-controller/src/controllers/user-storage/mocks/mockStorage.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import encryption, { createSHA256Hash } from '../../../shared/encryption';
33
export const MOCK_STORAGE_KEY_SIGNATURE = 'mockStorageKey';
44
export const MOCK_STORAGE_KEY = createSHA256Hash(MOCK_STORAGE_KEY_SIGNATURE);
55
export const MOCK_STORAGE_DATA = JSON.stringify({ hello: 'world' });
6-
export const MOCK_ENCRYPTION_PRIVATE_KEY = '29411742c5cf3d7eb1a0cf57230488900e86778c876078fb87164ec6864841cd';
7-
export const MOCK_ENCRYPTION_PUBLIC_KEY = '37a3160dda3e0086a89974854f1ba7c3e6b1bc960e06311bcc4c15264d95ee36';
6+
export const MOCK_ENCRYPTION_PRIVATE_KEY =
7+
'29411742c5cf3d7eb1a0cf57230488900e86778c876078fb87164ec6864841cd';
8+
export const MOCK_ENCRYPTION_PUBLIC_KEY =
9+
'37a3160dda3e0086a89974854f1ba7c3e6b1bc960e06311bcc4c15264d95ee36';
810

911
// NOTE - using encryption.encryptString directly in fixtures causes issues on mobile.
1012
// This is because this fixture is getting added in at run time. Will be improved once we support multiple exports

packages/profile-sync-controller/src/controllers/user-storage/network-syncing/controller-integration.ts

-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ export function startNetworkSyncing(props: StartNetworkSyncingProps) {
4848
try {
4949
messenger.subscribe(
5050
'NetworkController:networkRemoved',
51-
52-
// eslint-disable-next-line @typescript-eslint/no-misused-promises
5351
async (networkConfiguration) => {
5452
try {
5553
// If blocked (e.g. we have not yet performed a main-sync), then we should not perform any mutations

0 commit comments

Comments
 (0)