Skip to content

Commit a6f7ce3

Browse files
committed
style: alias ERC1024 encrypt/decrypt imports to distinguish them from others
1 parent 31ab6f0 commit a6f7ce3

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +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';
14+
import { encrypt as ERC1024Encrypt } from '@metamask/eth-sig-util';
1515
import {
1616
type KeyringControllerGetStateAction,
1717
type KeyringControllerLockEvent,
@@ -386,7 +386,7 @@ export default class UserStorageController extends BaseController<
386386
return await this.#snapDecryptMessage(ciphertext);
387387
},
388388
encryptMessage: async (message: string, publicKeyHex: string) => {
389-
const erc1024Payload = encrypt({
389+
const erc1024Payload = ERC1024Encrypt({
390390
// eth-sig-util expects the public key to be in base64 format
391391
publicKey: byteArrayToBase64(hexToBytes(publicKeyHex)),
392392
data: message,

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

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

66
import type {
@@ -112,7 +112,7 @@ export function mockUserStorageMessenger(
112112
Promise.resolve(MOCK_ENCRYPTION_PUBLIC_KEY),
113113
);
114114
const mockDecryptMessage = jest.fn((data: EthEncryptedData) => {
115-
return decrypt({
115+
return ERC1024Decrypt({
116116
encryptedData: data,
117117
privateKey: MOCK_ENCRYPTION_PRIVATE_KEY,
118118
});

packages/profile-sync-controller/src/sdk/user-storage.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export class UserStorage {
160160
return storageKey;
161161
}
162162
// if no cache, fetch raw entry and decrypt using SRP storage key
163-
// using the SRP public key as a salt to avoid collisions.
163+
// using the SRP encryption public key just as a salt to avoid collisions.
164164
const srpKey = await this.config.encryption?.getEncryptionPublicKey();
165165
let profileStorageKeyPath = null;
166166
if (srpKey) {

0 commit comments

Comments
 (0)