File tree Expand file tree Collapse file tree 3 files changed +4
-16
lines changed Expand file tree Collapse file tree 3 files changed +4
-16
lines changed Original file line number Diff line number Diff line change 25
25
],
26
26
"dependencies" : {
27
27
"micro-base" : " ^0.10.0" ,
28
- "@noble/hashes" : " ^0.5.1 " ,
28
+ "@noble/hashes" : " ^0.5.2 " ,
29
29
"@noble/secp256k1" : " ^1.3.3"
30
30
},
31
31
"browser" : {
Original file line number Diff line number Diff line change 1
1
import { pbkdf2 , pbkdf2Async } from "@noble/hashes/pbkdf2" ;
2
2
import { sha256 } from "@noble/hashes/sha256" ;
3
3
import { sha512 } from "@noble/hashes/sha512" ;
4
- import { assertNumber } from "@noble/hashes/utils" ;
4
+ import { assertBytes , assertNumber } from "@noble/hashes/utils" ;
5
5
import { utils as baseUtils } from "micro-base" ;
6
6
import { getRandomBytesSync } from "../random" ;
7
- import { assertBytes } from "../utils" ;
8
7
9
8
const isJapanese = ( wordlist : string [ ] ) =>
10
9
wordlist [ 0 ] === "\u3042\u3044\u3053\u304f\u3057\u3093" ; // Japanese wordlist
Original file line number Diff line number Diff line change 1
1
// buf.toString('hex') -> toHex(buf)
2
- export { bytesToHex as toHex , createView } from "@noble/hashes/utils" ;
2
+ import { assertBytes } from "@noble/hashes/utils" ;
3
+ export { bytesToHex as toHex , assertBytes , createView } from "@noble/hashes/utils" ;
3
4
// Buffer.from(hex, 'hex') -> hexToBytes(hex)
4
5
export function hexToBytes ( hex : string ) : Uint8Array {
5
6
if ( typeof hex !== "string" ) {
@@ -56,18 +57,6 @@ export function concatBytes(...arrays: Uint8Array[]): Uint8Array {
56
57
return result ;
57
58
}
58
59
// Internal utils
59
- export function assertBytes ( bytes : Uint8Array , ...len : number [ ] ) {
60
- if (
61
- bytes instanceof Uint8Array &&
62
- ( ! len . length || len . includes ( bytes . length ) )
63
- ) {
64
- return ;
65
- }
66
- throw new TypeError (
67
- `Expected ${ len } bytes, not ${ typeof bytes } with length=${ bytes . length } `
68
- ) ;
69
- }
70
-
71
60
export function assertBool ( b : boolean ) {
72
61
if ( typeof b !== "boolean" ) {
73
62
throw new Error ( `Expected boolean, not ${ b } ` ) ;
You can’t perform that action at this time.
0 commit comments