Comparing version 0.0.0-20240815T051629 to 0.0.0-20240815T061458
@@ -6,3 +6,3 @@ export { concat } from './internal/data/concat.js'; | ||
export { isBytesEqual } from './internal/data/isBytesEqual.js'; | ||
export { randomBytes } from './internal/data/random.js'; | ||
export { randomHex, randomBytes } from './internal/data/random.js'; | ||
export { size } from './internal/data/size.js'; | ||
@@ -9,0 +9,0 @@ export { slice } from './internal/data/slice.js'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.trimRight = exports.trimLeft = exports.slice = exports.size = exports.randomBytes = exports.isBytesEqual = exports.padRight = exports.padLeft = exports.isHex = exports.isBytes = exports.concat = void 0; | ||
exports.trimRight = exports.trimLeft = exports.slice = exports.size = exports.randomBytes = exports.randomHex = exports.isBytesEqual = exports.padRight = exports.padLeft = exports.isHex = exports.isBytes = exports.concat = void 0; | ||
var concat_js_1 = require("./internal/data/concat.js"); | ||
@@ -16,2 +16,3 @@ Object.defineProperty(exports, "concat", { enumerable: true, get: function () { return concat_js_1.concat; } }); | ||
var random_js_1 = require("./internal/data/random.js"); | ||
Object.defineProperty(exports, "randomHex", { enumerable: true, get: function () { return random_js_1.randomHex; } }); | ||
Object.defineProperty(exports, "randomBytes", { enumerable: true, get: function () { return random_js_1.randomBytes; } }); | ||
@@ -18,0 +19,0 @@ var size_js_1 = require("./internal/data/size.js"); |
@@ -11,3 +11,4 @@ export { concat } from './internal/data/concat.js'; | ||
export { booleanToHex, booleanToHex as fromBoolean, bytesToHex, bytesToHex as fromBytes, numberToHex, numberToHex as fromBigInt, numberToHex as fromNumber, stringToHex, stringToHex as fromString, toHex, toHex as from, } from './internal/hex/toHex.js'; | ||
export { randomHex as random } from './internal/data/random.js'; | ||
export type { Hex } from './internal/types/data.js'; | ||
//# sourceMappingURL=Hex.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.from = exports.toHex = exports.fromString = exports.stringToHex = exports.fromNumber = exports.fromBigInt = exports.numberToHex = exports.fromBytes = exports.bytesToHex = exports.fromBoolean = exports.booleanToHex = exports.toBytes = exports.hexToBytes = exports.toString = exports.hexToString = exports.toNumber = exports.hexToNumber = exports.toBoolean = exports.hexToBoolean = exports.toBigInt = exports.hexToBigInt = exports.to = exports.fromHex = exports.trimRight = exports.trimLeft = exports.size = exports.slice = exports.padRight = exports.padLeft = exports.isEqual = exports.isHex = exports.concat = void 0; | ||
exports.random = exports.from = exports.toHex = exports.fromString = exports.stringToHex = exports.fromNumber = exports.fromBigInt = exports.numberToHex = exports.fromBytes = exports.bytesToHex = exports.fromBoolean = exports.booleanToHex = exports.toBytes = exports.hexToBytes = exports.toString = exports.hexToString = exports.toNumber = exports.hexToNumber = exports.toBoolean = exports.hexToBoolean = exports.toBigInt = exports.hexToBigInt = exports.to = exports.fromHex = exports.trimRight = exports.trimLeft = exports.size = exports.slice = exports.padRight = exports.padLeft = exports.isEqual = exports.isHex = exports.concat = void 0; | ||
var concat_js_1 = require("./internal/data/concat.js"); | ||
@@ -46,2 +46,4 @@ Object.defineProperty(exports, "concat", { enumerable: true, get: function () { return concat_js_1.concat; } }); | ||
Object.defineProperty(exports, "from", { enumerable: true, get: function () { return toHex_js_1.toHex; } }); | ||
var random_js_1 = require("./internal/data/random.js"); | ||
Object.defineProperty(exports, "random", { enumerable: true, get: function () { return random_js_1.randomHex; } }); | ||
//# sourceMappingURL=Hex.js.map |
import type { ErrorType as ErrorType_ } from '../errors/error.js'; | ||
import type { Bytes } from '../types/data.js'; | ||
import type { Bytes, Hex } from '../types/data.js'; | ||
export declare namespace randomBytes { | ||
@@ -7,2 +7,6 @@ type ErrorType = ErrorType_; | ||
export declare function randomBytes(length: number): Bytes; | ||
export declare namespace randomHex { | ||
type ErrorType = ErrorType_; | ||
} | ||
export declare function randomHex(length: number): Hex; | ||
//# sourceMappingURL=random.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.randomBytes = randomBytes; | ||
exports.randomHex = randomHex; | ||
const toHex_js_1 = require("../hex/toHex.js"); | ||
function randomBytes(length) { | ||
return crypto.getRandomValues(new Uint8Array(length)); | ||
} | ||
function randomHex(length) { | ||
return (0, toHex_js_1.bytesToHex)(randomBytes(length)); | ||
} | ||
//# sourceMappingURL=random.js.map |
@@ -1,2 +0,2 @@ | ||
export declare const version = "0.0.0-20240815T051629"; | ||
export declare const version = "0.0.0-20240815T061458"; | ||
//# sourceMappingURL=version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = '0.0.0-20240815T051629'; | ||
exports.version = '0.0.0-20240815T061458'; | ||
//# sourceMappingURL=version.js.map |
@@ -6,3 +6,3 @@ export { concat } from './internal/data/concat.js'; | ||
export { isBytesEqual } from './internal/data/isBytesEqual.js'; | ||
export { randomBytes } from './internal/data/random.js'; | ||
export { randomHex, randomBytes } from './internal/data/random.js'; | ||
export { size } from './internal/data/size.js'; | ||
@@ -9,0 +9,0 @@ export { slice } from './internal/data/slice.js'; |
@@ -6,3 +6,3 @@ export { concat } from './internal/data/concat.js'; | ||
export { isBytesEqual } from './internal/data/isBytesEqual.js'; | ||
export { randomBytes } from './internal/data/random.js'; | ||
export { randomHex, randomBytes } from './internal/data/random.js'; | ||
export { size } from './internal/data/size.js'; | ||
@@ -9,0 +9,0 @@ export { slice } from './internal/data/slice.js'; |
@@ -11,3 +11,4 @@ export { concat } from './internal/data/concat.js'; | ||
export { booleanToHex, booleanToHex as fromBoolean, bytesToHex, bytesToHex as fromBytes, numberToHex, numberToHex as fromBigInt, numberToHex as fromNumber, stringToHex, stringToHex as fromString, toHex, toHex as from, } from './internal/hex/toHex.js'; | ||
export { randomHex as random } from './internal/data/random.js'; | ||
export type { Hex } from './internal/types/data.js'; | ||
//# sourceMappingURL=Hex.d.ts.map |
@@ -11,2 +11,3 @@ export { concat } from './internal/data/concat.js'; | ||
export { booleanToHex, booleanToHex as fromBoolean, bytesToHex, bytesToHex as fromBytes, numberToHex, numberToHex as fromBigInt, numberToHex as fromNumber, stringToHex, stringToHex as fromString, toHex, toHex as from, } from './internal/hex/toHex.js'; | ||
export { randomHex as random } from './internal/data/random.js'; | ||
//# sourceMappingURL=Hex.js.map |
import type { ErrorType as ErrorType_ } from '../errors/error.js'; | ||
import type { Bytes } from '../types/data.js'; | ||
import type { Bytes, Hex } from '../types/data.js'; | ||
export declare namespace randomBytes { | ||
@@ -24,2 +24,23 @@ type ErrorType = ErrorType_; | ||
export declare function randomBytes(length: number): Bytes; | ||
export declare namespace randomHex { | ||
type ErrorType = ErrorType_; | ||
} | ||
/** | ||
* Generates a random Hex value of the specified length. | ||
* | ||
* - Docs: https://oxlib.sh/api/hex/random | ||
* | ||
* @example | ||
* ```ts | ||
* import { Hex } from 'ox' | ||
* const hex = Hex.random(32) | ||
* ``` | ||
* | ||
* @example | ||
* ```ts | ||
* import { Data } from 'ox' | ||
* const hex = Data.randomHex(32) | ||
* ``` | ||
*/ | ||
export declare function randomHex(length: number): Hex; | ||
//# sourceMappingURL=random.d.ts.map |
@@ -0,1 +1,2 @@ | ||
import { bytesToHex } from '../hex/toHex.js'; | ||
/** | ||
@@ -21,2 +22,22 @@ * Generates a random byte array of the specified length. | ||
} | ||
/** | ||
* Generates a random Hex value of the specified length. | ||
* | ||
* - Docs: https://oxlib.sh/api/hex/random | ||
* | ||
* @example | ||
* ```ts | ||
* import { Hex } from 'ox' | ||
* const hex = Hex.random(32) | ||
* ``` | ||
* | ||
* @example | ||
* ```ts | ||
* import { Data } from 'ox' | ||
* const hex = Data.randomHex(32) | ||
* ``` | ||
*/ | ||
export function randomHex(length) { | ||
return bytesToHex(randomBytes(length)); | ||
} | ||
//# sourceMappingURL=random.js.map |
/** @internal */ | ||
export declare const version = "0.0.0-20240815T051629"; | ||
export declare const version = "0.0.0-20240815T061458"; | ||
//# sourceMappingURL=version.d.ts.map |
/** @internal */ | ||
export const version = '0.0.0-20240815T051629'; | ||
export const version = '0.0.0-20240815T061458'; | ||
//# sourceMappingURL=version.js.map |
@@ -14,3 +14,3 @@ export { concat } from './internal/data/concat.js' | ||
export { randomBytes } from './internal/data/random.js' | ||
export { randomHex, randomBytes } from './internal/data/random.js' | ||
@@ -17,0 +17,0 @@ export { size } from './internal/data/size.js' |
@@ -53,2 +53,4 @@ export { concat } from './internal/data/concat.js' | ||
export { randomHex as random } from './internal/data/random.js' | ||
export type { Hex } from './internal/types/data.js' |
import type { ErrorType as ErrorType_ } from '../errors/error.js' | ||
import type { Bytes } from '../types/data.js' | ||
import { bytesToHex } from '../hex/toHex.js' | ||
import type { Bytes, Hex } from '../types/data.js' | ||
@@ -28,1 +29,26 @@ export declare namespace randomBytes { | ||
} | ||
export declare namespace randomHex { | ||
type ErrorType = ErrorType_ | ||
} | ||
/** | ||
* Generates a random Hex value of the specified length. | ||
* | ||
* - Docs: https://oxlib.sh/api/hex/random | ||
* | ||
* @example | ||
* ```ts | ||
* import { Hex } from 'ox' | ||
* const hex = Hex.random(32) | ||
* ``` | ||
* | ||
* @example | ||
* ```ts | ||
* import { Data } from 'ox' | ||
* const hex = Data.randomHex(32) | ||
* ``` | ||
*/ | ||
export function randomHex(length: number): Hex { | ||
return bytesToHex(randomBytes(length)) | ||
} |
{ | ||
"name": "ox", | ||
"description": "Ethereum Standard Library", | ||
"version": "0.0.0-20240815T051629", | ||
"version": "0.0.0-20240815T061458", | ||
"main": "./_cjs/index.js", | ||
@@ -6,0 +6,0 @@ "module": "./_esm/index.js", |
/** @internal */ | ||
export const version = '0.0.0-20240815T051629' | ||
export const version = '0.0.0-20240815T061458' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
438583
7594