Skip to content

Commit

Permalink
accounts-conteroller: use sha256 from @noble/hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
legobeat committed Oct 13, 2023
1 parent d506841 commit a23ee87
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/accounts-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@metamask/keyring-api": "^1.0.0",
"@metamask/snaps-utils": "^3.0.0",
"@metamask/utils": "^8.1.0",
"@noble/hashes": "^1.3.2",
"deepmerge": "^4.2.2",
"immer": "^9.0.6",
"uuid": "^8.3.2"
Expand Down
4 changes: 2 additions & 2 deletions packages/accounts-controller/src/AccountsController.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { sha256FromString } from '@ethereumjs/util';
import type { RestrictedControllerMessenger } from '@metamask/base-controller';
import { BaseControllerV2 } from '@metamask/base-controller';
import { SnapKeyring } from '@metamask/eth-snap-keyring';
Expand All @@ -17,6 +16,7 @@ import type {
} from '@metamask/snaps-controllers';
import type { Snap, ValidatedSnapId } from '@metamask/snaps-utils';
import type { Keyring, Json } from '@metamask/utils';
import { sha256 } from '@noble/hashes/sha256';
import type { Patch } from 'immer';
import { v4 as uuid } from 'uuid';

Expand Down Expand Up @@ -406,7 +406,7 @@ export class AccountsController extends BaseControllerV2<
address,
);
const v4options = {
random: sha256FromString(address).slice(0, 16),
random: sha256(address).slice(0, 16),
};

internalAccounts.push({
Expand Down
3 changes: 2 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,7 @@ __metadata:
"@metamask/snaps-controllers": ^3.0.0
"@metamask/snaps-utils": ^3.0.0
"@metamask/utils": ^8.1.0
"@noble/hashes": ^1.3.2
"@types/jest": ^27.4.1
"@types/readable-stream": ^2.3.0
deepmerge: ^4.2.2
Expand Down Expand Up @@ -2591,7 +2592,7 @@ __metadata:
languageName: node
linkType: hard

"@noble/hashes@npm:^1.0.0, @noble/hashes@npm:^1.3.1, @noble/hashes@npm:~1.3.0, @noble/hashes@npm:~1.3.1":
"@noble/hashes@npm:^1.0.0, @noble/hashes@npm:^1.3.1, @noble/hashes@npm:^1.3.2, @noble/hashes@npm:~1.3.0, @noble/hashes@npm:~1.3.1":
version: 1.3.2
resolution: "@noble/hashes@npm:1.3.2"
checksum: fe23536b436539d13f90e4b9be843cc63b1b17666a07634a2b1259dded6f490be3d050249e6af98076ea8f2ea0d56f578773c2197f2aa0eeaa5fba5bc18ba474
Expand Down

0 comments on commit a23ee87

Please sign in to comment.