Skip to content

Commit 1af0e0d

Browse files
dependabot[bot]achowdhry-ripplepdp2121
authored
build(deps): bump @noble/hashes from 1.8.0 to 2.0.1 (#3151)
* build(deps): bump @noble/hashes from 1.8.0 to 2.0.1 Bumps [@noble/hashes](https://github.com/paulmillr/noble-hashes) from 1.8.0 to 2.0.1. - [Release notes](https://github.com/paulmillr/noble-hashes/releases) - [Commits](paulmillr/noble-hashes@1.8.0...2.0.1) --- updated-dependencies: - dependency-name: "@noble/hashes" dependency-version: 2.0.1 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * fix build and test * fix linter * use utf8ToBytes --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: achowdhry-ripple <achowdhry@ripple.com> Co-authored-by: pdp2121 <71317875+pdp2121@users.noreply.github.com> Co-authored-by: Phu Pham <ppham@ripple.com>
1 parent 59518c8 commit 1af0e0d

10 files changed

Lines changed: 29 additions & 39 deletions

File tree

package-lock.json

Lines changed: 8 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/isomorphic/eslint.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ module.exports = [
7474
'multiline-comment-style': 'off',
7575
'@typescript-eslint/no-require-imports': 'off',
7676
'n/no-unsupported-features/node-builtins': 'off',
77+
// Allow .js extensions for @noble packages (required by @noble/hashes 2.0+)
78+
'import/extensions': 'off',
7779
},
7880
},
7981
{

packages/isomorphic/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"test": "test"
2929
},
3030
"dependencies": {
31-
"@noble/hashes": "^1.0.0",
31+
"@noble/hashes": "^2.0.1",
3232
"eventemitter3": "5.0.1",
3333
"ws": "^8.17.1"
3434
},
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1+
import { utf8ToBytes } from '@noble/hashes/utils.js'
2+
13
import { Input } from './types'
24

35
/**
4-
* Normalize a string, number array, or Uint8Array to a string or Uint8Array.
5-
* Both node and noble lib functions accept these types.
6+
* Normalize a string, number array, or Uint8Array to a Uint8Array.
7+
* Strings are converted to Uint8Array using UTF-8 encoding.
68
*
79
* @param input - value to normalize
810
*/
9-
export default function normalizeInput(input: Input): string | Uint8Array {
10-
return Array.isArray(input) ? new Uint8Array(input) : input
11+
export default function normalizeInput(input: Input): Uint8Array {
12+
if (Array.isArray(input)) {
13+
return new Uint8Array(input)
14+
}
15+
if (typeof input === 'string') {
16+
return utf8ToBytes(input)
17+
}
18+
return input
1119
}

packages/isomorphic/src/internal/wrapNoble.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CHash } from '@noble/hashes/utils'
1+
import { CHash } from '@noble/hashes/utils.js'
22
import { Hash, HashFn, Input } from './types'
33
import normalizeInput from './normalizeInput'
44

packages/isomorphic/src/ripemd160/browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ripemd160 as nobleImpl } from '@noble/hashes/ripemd160'
1+
import { ripemd160 as nobleImpl } from '@noble/hashes/legacy.js'
22

33
import wrapNoble from '../internal/wrapNoble'
44

packages/isomorphic/src/sha256/browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { sha256 as nobleImpl } from '@noble/hashes/sha256'
1+
import { sha256 as nobleImpl } from '@noble/hashes/sha2.js'
22

33
import wrapNoble from '../internal/wrapNoble'
44

packages/isomorphic/src/sha512/browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { sha512 as nobleImpl } from '@noble/hashes/sha512'
1+
import { sha512 as nobleImpl } from '@noble/hashes/sha2.js'
22

33
import wrapNoble from '../internal/wrapNoble'
44

packages/isomorphic/src/utils/browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
bytesToHex as nobleBytesToHex,
33
randomBytes as nobleRandomBytes,
4-
} from '@noble/hashes/utils'
4+
} from '@noble/hashes/utils.js'
55
import type {
66
BytesToHexFn,
77
HexToBytesFn,

packages/isomorphic/src/utils/shared.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { concatBytes } from '@noble/hashes/utils'
1+
import { concatBytes } from '@noble/hashes/utils.js'
22

33
export const HEX_REGEX = /^[A-F0-9]*$/iu
44

0 commit comments

Comments
 (0)