diff --git a/app/scripts/migrations/105.test.ts b/app/scripts/migrations/105.test.ts index b7d5ac0303e6..0dda4da172ab 100644 --- a/app/scripts/migrations/105.test.ts +++ b/app/scripts/migrations/105.test.ts @@ -1,6 +1,7 @@ import { v4 as uuid } from 'uuid'; -import { sha256FromString } from 'ethereumjs-util'; +import { sha256 } from '@noble/hashes/sha256'; import { InternalAccount } from '@metamask/keyring-internal-api'; +import { toBuffer } from 'ethereumjs-util'; import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods'; import { migrate } from './105'; @@ -18,7 +19,7 @@ global.sentry = { function addressToUUID(address: string): string { return uuid({ - random: sha256FromString(address).slice(0, 16), + random: sha256(toBuffer(address)).slice(0, 16), }); } diff --git a/app/scripts/migrations/105.ts b/app/scripts/migrations/105.ts index 5febcb0479f2..b571211b541f 100644 --- a/app/scripts/migrations/105.ts +++ b/app/scripts/migrations/105.ts @@ -1,6 +1,7 @@ import { EthAccountType } from '@metamask/keyring-api'; import { InternalAccount } from '@metamask/keyring-internal-api'; -import { sha256FromString } from 'ethereumjs-util'; +import { sha256 } from '@noble/hashes/sha256'; +import { toBuffer } from 'ethereumjs-util'; import { v4 as uuid } from 'uuid'; import { cloneDeep } from 'lodash'; import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods'; @@ -88,7 +89,7 @@ function createInternalAccountsForAccountsController( Object.values(identities).forEach((identity) => { const expectedId = uuid({ - random: sha256FromString(identity.address).slice(0, 16), + random: sha256(toBuffer(identity.address)).slice(0, 16), }); accounts[expectedId] = {