@gsknnft/bigint-buffer 1.4.5 → 1.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -3
- package/build/Release/bigint_buffer.node +0 -0
- package/dist/build/Release/bigint_buffer.node +0 -0
- package/dist/conversion/index.d.ts +2 -0
- package/dist/index.cjs +1 -1
- package/dist/{types/dist/dist/index.d.ts → index.d.ts} +1 -2
- package/dist/index.js +360 -333
- package/dist/index.umd.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/conversion/index.d.ts +2 -1
- package/dist/types/conversion/src/ts/converter.d.ts +14 -0
- package/dist/types/conversion/src/ts/index.d.ts +19 -10
- package/dist/types/conversion/test/fixedPoint.test.d.ts +1 -0
- package/dist/types/index.d.ts +1 -2
- package/package.json +153 -132
- package/prebuilds/win32-x64/@gsknnft+bigint-buffer.node +0 -0
- package/scripts/postinstall.cjs +38 -0
- package/build/Release/bigint_buffer.exp +0 -0
- package/build/Release/bigint_buffer.iobj +0 -0
- package/build/Release/bigint_buffer.ipdb +0 -0
- package/build/Release/bigint_buffer.lib +0 -0
- package/build/Release/bigint_buffer.pdb +0 -0
- package/build/Release/obj/bigint_buffer/bigint_buffer.node.recipe +0 -11
- package/build/Release/obj/bigint_buffer/bigint_buffer.tlog/CL.command.1.tlog +0 -0
- package/build/Release/obj/bigint_buffer/bigint_buffer.tlog/CL.read.1.tlog +0 -0
- package/build/Release/obj/bigint_buffer/bigint_buffer.tlog/CL.write.1.tlog +0 -0
- package/build/Release/obj/bigint_buffer/bigint_buffer.tlog/Cl.items.tlog +0 -2
- package/build/Release/obj/bigint_buffer/bigint_buffer.tlog/bigint_buffer.lastbuildstate +0 -2
- package/build/Release/obj/bigint_buffer/bigint_buffer.tlog/link.command.1.tlog +0 -0
- package/build/Release/obj/bigint_buffer/bigint_buffer.tlog/link.read.1.tlog +0 -0
- package/build/Release/obj/bigint_buffer/bigint_buffer.tlog/link.secondary.1.tlog +0 -5
- package/build/Release/obj/bigint_buffer/bigint_buffer.tlog/link.write.1.tlog +0 -0
- package/build/Release/obj/bigint_buffer/src/bigint-buffer.obj +0 -0
- package/build/Release/obj/bigint_buffer/win_delay_load_hook.obj +0 -0
- package/build/bigint_buffer.vcxproj +0 -148
- package/build/bigint_buffer.vcxproj.filters +0 -64
- package/build/binding.sln +0 -19
- package/build/config.gypi +0 -525
- package/build/conversion/index.js +0 -18
- package/build/conversion/index.js.map +0 -1
- package/build/conversion/src/ts/fixedPoint/index.d.ts +0 -12
- package/build/conversion/src/ts/fixedPoint/index.js +0 -79
- package/build/conversion/src/ts/fixedPoint/index.js.map +0 -1
- package/build/conversion/src/ts/index.d.ts +0 -169
- package/build/conversion/src/ts/index.js +0 -453
- package/build/conversion/src/ts/index.js.map +0 -1
- package/build/conversion/test/bigintToBase64.test.js +0 -72
- package/build/conversion/test/bigintToBase64.test.js.map +0 -1
- package/build/conversion/test/bigintToBuf.test.js +0 -77
- package/build/conversion/test/bigintToBuf.test.js.map +0 -1
- package/build/conversion/test/bigintToHex.test.js +0 -86
- package/build/conversion/test/bigintToHex.test.js.map +0 -1
- package/build/conversion/test/bigintToText.test.js +0 -63
- package/build/conversion/test/bigintToText.test.js.map +0 -1
- package/build/conversion/test/bufToBigint.test.js +0 -55
- package/build/conversion/test/bufToBigint.test.js.map +0 -1
- package/build/conversion/test/hexToBigint.test.js +0 -56
- package/build/conversion/test/hexToBigint.test.js.map +0 -1
- package/build/conversion/test/hexToBuf.test.js +0 -73
- package/build/conversion/test/hexToBuf.test.js.map +0 -1
- package/build/conversion/test/parseHex.test.js +0 -69
- package/build/conversion/test/parseHex.test.js.map +0 -1
- package/build/conversion/test/textToBuf.test.js +0 -59
- package/build/conversion/test/textToBuf.test.js.map +0 -1
- package/build/index.js +0 -242
- package/build/index.js.map +0 -1
- package/dist/types/conversion/src/ts/fixedPoint/index.d.ts +0 -12
- package/dist/types/dist/dist/conversion/conversion/index.d.ts +0 -1
- package/src/bigint-buffer.test.ts +0 -11
- package/src/conversion/.github/workflows/build-and-test.yml +0 -116
- package/src/conversion/CODE_OF_CONDUCT.md +0 -134
- package/src/conversion/LICENSE +0 -21
- package/src/conversion/README.md +0 -48
- package/src/conversion/docs/README.md +0 -42
- package/src/conversion/docs/functions/base64ToBigint.md +0 -27
- package/src/conversion/docs/functions/bigintToBase64.md +0 -43
- package/src/conversion/docs/functions/bigintToBuf.md +0 -35
- package/src/conversion/docs/functions/bigintToHex.md +0 -43
- package/src/conversion/docs/functions/bigintToText.md +0 -31
- package/src/conversion/docs/functions/bufToBigint.md +0 -25
- package/src/conversion/docs/functions/bufToHex.md +0 -37
- package/src/conversion/docs/functions/bufToText.md +0 -27
- package/src/conversion/docs/functions/hexToBigint.md +0 -29
- package/src/conversion/docs/functions/hexToBuf.md +0 -37
- package/src/conversion/docs/functions/parseHex.md +0 -45
- package/src/conversion/docs/functions/textToBigint.md +0 -27
- package/src/conversion/docs/functions/textToBuf.md +0 -33
- package/src/conversion/docs/functions/toBigIntBE.md +0 -27
- package/src/conversion/docs/functions/toBigIntLE.md +0 -27
- package/src/conversion/docs/functions/toBufferBE.md +0 -33
- package/src/conversion/docs/functions/toBufferLE.md +0 -33
- package/src/conversion/docs/functions/validateBigIntBuffer.md +0 -15
- package/src/conversion/docs/type-aliases/TypedArray.md +0 -11
- package/src/conversion/docs/variables/isNative.md +0 -11
- package/src/conversion/example.cjs +0 -9
- package/src/conversion/example.esm.js +0 -11
- package/src/conversion/index.ts +0 -1
- package/src/conversion/package.json +0 -163
- package/src/conversion/src/docs/index.md +0 -52
- package/src/conversion/src/ts/fixedPoint/index.ts +0 -87
- package/src/conversion/src/ts/index.ts +0 -529
- package/src/conversion/test/bigintToBase64.test.ts +0 -37
- package/src/conversion/test/bigintToBuf.test.ts +0 -43
- package/src/conversion/test/bigintToHex.test.ts +0 -52
- package/src/conversion/test/bigintToText.test.ts +0 -30
- package/src/conversion/test/bufToBigint.test.ts +0 -20
- package/src/conversion/test/hexToBigint.test.ts +0 -22
- package/src/conversion/test/hexToBuf.test.ts +0 -39
- package/src/conversion/test/parseHex.test.ts +0 -35
- package/src/conversion/test/setup.test.ts +0 -9
- package/src/conversion/test/textToBuf.test.ts +0 -26
- package/src/conversion/tsconfig.json +0 -57
- package/src/conversion/tsconfig.rollup.json +0 -9
- package/src/conversion/typedoc.json +0 -5
- package/src/conversion/types/bindings.d.t.s +0 -4
- package/src/conversion/vite.config.ts +0 -10
- package/src/conversion/vitest.config.ts +0 -15
- package/src/index.bench.ts +0 -206
- package/src/index.spec.ts +0 -318
- package/src/index.ts +0 -215
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { Buffer } from 'buffer';
|
|
2
|
-
export { toFixedPoint, fromFixedPoint, addFixedPoint, subtractFixedPoint, averageFixedPoint, compareFixedPoint, type FixedPoint, FIXED_POINT_DECIMALS, ZERO_FIXED_POINT, fixedPointToBigInt, toBigIntValue, } from './fixedPoint';
|
|
3
|
-
export declare let isNative: boolean;
|
|
4
|
-
/**
|
|
5
|
-
* Convert a little-endian buffer into a BigInt.
|
|
6
|
-
* @param buf The little-endian buffer to convert
|
|
7
|
-
* @returns A BigInt with the little-endian representation of buf.
|
|
8
|
-
*/
|
|
9
|
-
export declare function toBigIntLE(buf: Buffer): bigint;
|
|
10
|
-
export declare function validateBigIntBuffer(): boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Convert a big-endian buffer into a BigInt
|
|
13
|
-
* @param buf The big-endian buffer to convert.
|
|
14
|
-
* @returns A BigInt with the big-endian representation of buf.
|
|
15
|
-
*/
|
|
16
|
-
export declare function toBigIntBE(buf: Buffer): bigint;
|
|
17
|
-
/**
|
|
18
|
-
* Convert a BigInt to a little-endian buffer.
|
|
19
|
-
* @param num The BigInt to convert.
|
|
20
|
-
* @param width The number of bytes that the resulting buffer should be.
|
|
21
|
-
* @returns A little-endian buffer representation of num.
|
|
22
|
-
*/
|
|
23
|
-
export declare function toBufferLE(num: bigint, width: number): Buffer;
|
|
24
|
-
/**
|
|
25
|
-
* Convert a BigInt to a big-endian buffer.
|
|
26
|
-
* @param num The BigInt to convert.
|
|
27
|
-
* @param width The number of bytes that the resulting buffer should be.
|
|
28
|
-
* @returns A big-endian buffer representation of num.
|
|
29
|
-
*/
|
|
30
|
-
export declare function toBufferBE(num: bigint, width: number): Buffer;
|
|
31
|
-
export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
|
|
32
|
-
/**
|
|
33
|
-
* Parses a hexadecimal string for correctness and returns it with or without
|
|
34
|
-
* '0x' prefix, and/or with the specified byte length
|
|
35
|
-
* @param a - the string with an hexadecimal number to be parsed
|
|
36
|
-
* @param prefix0x - set to true to prefix the output with '0x'
|
|
37
|
-
* @param byteLength - pad the output to have the desired byte length. Notice
|
|
38
|
-
* that the hex length is double the byte length.
|
|
39
|
-
*
|
|
40
|
-
* @returns
|
|
41
|
-
*
|
|
42
|
-
* @throws {@link RangeError} if input string does not hold an hexadecimal number
|
|
43
|
-
* @throws {@link RangeError} if requested byte length is less than the input byte length
|
|
44
|
-
*/
|
|
45
|
-
export declare function parseHex(a: string, prefix0x?: boolean, byteLength?: number): string;
|
|
46
|
-
/**
|
|
47
|
-
* Converts an arbitrary-size non-negative bigint to an ArrayBuffer or a Buffer
|
|
48
|
-
* (default for Node.js)
|
|
49
|
-
*
|
|
50
|
-
* @param a
|
|
51
|
-
* @param returnArrayBuffer - In Node.js, it forces the output to be an
|
|
52
|
-
* ArrayBuffer instead of a Buffer.
|
|
53
|
-
*
|
|
54
|
-
* @returns an ArrayBuffer or a Buffer with a binary representation of the input
|
|
55
|
-
* bigint
|
|
56
|
-
*
|
|
57
|
-
* @throws {@link RangeError} if a < 0.
|
|
58
|
-
*/
|
|
59
|
-
export declare function bigintToBuf(a: bigint, returnArrayBuffer?: boolean): ArrayBuffer | Buffer;
|
|
60
|
-
/**
|
|
61
|
-
* Converts an ArrayBuffer, TypedArray or Buffer (node.js) to a bigint
|
|
62
|
-
* @param buf
|
|
63
|
-
* @returns a bigint
|
|
64
|
-
*/
|
|
65
|
-
export declare function bufToBigint(buf: ArrayBuffer | TypedArray | Buffer): bigint;
|
|
66
|
-
/**
|
|
67
|
-
* Converts a non-negative bigint to a hexadecimal string
|
|
68
|
-
* @param a - a non negative bigint
|
|
69
|
-
* @param prefix0x - set to true to prefix the output with '0x'
|
|
70
|
-
* @param byteLength - pad the output to have the desired byte length. Notice
|
|
71
|
-
* that the hex length is double the byte length.
|
|
72
|
-
*
|
|
73
|
-
* @returns hexadecimal representation of the input bigint
|
|
74
|
-
*
|
|
75
|
-
* @throws {@link RangeError} if a < 0
|
|
76
|
-
*/
|
|
77
|
-
export declare function bigintToHex(a: bigint, prefix0x?: boolean, byteLength?: number): string;
|
|
78
|
-
/**
|
|
79
|
-
* Converts a hexadecimal string to a bigint
|
|
80
|
-
*
|
|
81
|
-
* @param hexStr
|
|
82
|
-
*
|
|
83
|
-
* @returns a bigint
|
|
84
|
-
*
|
|
85
|
-
* @throws {@link RangeError} if input string does not hold an hexadecimal number
|
|
86
|
-
*/
|
|
87
|
-
export declare function hexToBigint(hexStr: string): bigint;
|
|
88
|
-
/**
|
|
89
|
-
* Converts a non-negative bigint representing a binary array of utf-8 encoded
|
|
90
|
-
* text to a string of utf-8 text
|
|
91
|
-
*
|
|
92
|
-
* @param a - A non-negative bigint representing a binary array of utf-8 encoded
|
|
93
|
-
* text.
|
|
94
|
-
*
|
|
95
|
-
* @returns a string text with utf-8 encoding
|
|
96
|
-
*
|
|
97
|
-
* @throws {@link RangeError} if a < 0.
|
|
98
|
-
*/
|
|
99
|
-
export declare function bigintToText(a: bigint): string;
|
|
100
|
-
/**
|
|
101
|
-
* Converts a utf-8 string to a bigint (from its binary representaion)
|
|
102
|
-
*
|
|
103
|
-
* @param text - A string text with utf-8 encoding
|
|
104
|
-
*
|
|
105
|
-
* @returns a bigint representing a binary array of the input utf-8 encoded text
|
|
106
|
-
*/
|
|
107
|
-
export declare function textToBigint(text: string): bigint;
|
|
108
|
-
/**
|
|
109
|
-
* Converts an ArrayBuffer, TypedArray or Buffer (in Node.js) containing utf-8
|
|
110
|
-
* encoded text to a string of utf-8 text
|
|
111
|
-
*
|
|
112
|
-
* @param buf - A buffer containing utf-8 encoded text
|
|
113
|
-
*
|
|
114
|
-
* @returns a string text with utf-8 encoding
|
|
115
|
-
*/
|
|
116
|
-
export declare function bufToText(buf: ArrayBuffer | TypedArray | Buffer): string;
|
|
117
|
-
/**
|
|
118
|
-
* Converts a string of utf-8 encoded text to an ArrayBuffer or a Buffer
|
|
119
|
-
* (default in Node.js)
|
|
120
|
-
*
|
|
121
|
-
* @param str - A string of text (with utf-8 encoding)
|
|
122
|
-
* @param returnArrayBuffer - When invoked in Node.js, it can force the output
|
|
123
|
-
* to be an ArrayBuffer instead of a Buffer.
|
|
124
|
-
*
|
|
125
|
-
* @returns an ArrayBuffer or a Buffer containing the utf-8 encoded text
|
|
126
|
-
*/
|
|
127
|
-
export declare function textToBuf(str: string, returnArrayBuffer?: boolean): ArrayBuffer | Buffer;
|
|
128
|
-
/**
|
|
129
|
-
* Returns the hexadecimal representation of a buffer.
|
|
130
|
-
*
|
|
131
|
-
* @param buf
|
|
132
|
-
* @param prefix0x - set to true to prefix the output with '0x'
|
|
133
|
-
* @param byteLength - pad the output to have the desired byte length. Notice
|
|
134
|
-
* that the hex length is double the byte length.
|
|
135
|
-
*
|
|
136
|
-
* @returns a string with a hexadecimal representation of the input buffer
|
|
137
|
-
*/
|
|
138
|
-
export declare function bufToHex(buf: ArrayBuffer | TypedArray | Buffer, prefix0x?: boolean, byteLength?: number): string;
|
|
139
|
-
/**
|
|
140
|
-
* Converts a hexadecimal string to a buffer
|
|
141
|
-
*
|
|
142
|
-
* @param hexStr - A string representing a number with hexadecimal notation
|
|
143
|
-
* @param returnArrayBuffer - In Node.js, it forces the output to be an
|
|
144
|
-
* ArrayBuffer instead of a Buffer.
|
|
145
|
-
*
|
|
146
|
-
* @returns An ArrayBuffer or a Buffer
|
|
147
|
-
*
|
|
148
|
-
* @throws {@link RangeError} if input string does not hold an hexadecimal number
|
|
149
|
-
*/
|
|
150
|
-
export declare function hexToBuf(hexStr: string, returnArrayBuffer?: boolean): ArrayBuffer | Buffer;
|
|
151
|
-
/**
|
|
152
|
-
* Converts an arbitrary-size non-negative bigint to a base64 string
|
|
153
|
-
* @param a - a non negative bigint
|
|
154
|
-
* @param urlsafe - if true Base64 URL encoding is used ('+' and '/' are
|
|
155
|
-
* replaced by '-', '_')
|
|
156
|
-
* @param padding - if false, padding (trailing '=') is removed
|
|
157
|
-
* @returns a base64 representation of the input bigint
|
|
158
|
-
*
|
|
159
|
-
* @throws {RangeError}
|
|
160
|
-
* Thrown if a < 0
|
|
161
|
-
*/
|
|
162
|
-
export declare function bigintToBase64(a: bigint, urlsafe?: boolean, padding?: boolean): string;
|
|
163
|
-
/**
|
|
164
|
-
* Converts a base64 string to bigint.
|
|
165
|
-
* @param a base64 string. It accepts standard and URL-safe base64 with and
|
|
166
|
-
* without padding
|
|
167
|
-
* @returns a bigint
|
|
168
|
-
*/
|
|
169
|
-
export declare function base64ToBigint(a: string): bigint;
|
|
@@ -1,453 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isNative = exports.toBigIntValue = exports.fixedPointToBigInt = exports.ZERO_FIXED_POINT = exports.FIXED_POINT_DECIMALS = exports.compareFixedPoint = exports.averageFixedPoint = exports.subtractFixedPoint = exports.addFixedPoint = exports.fromFixedPoint = exports.toFixedPoint = void 0;
|
|
7
|
-
exports.toBigIntLE = toBigIntLE;
|
|
8
|
-
exports.validateBigIntBuffer = validateBigIntBuffer;
|
|
9
|
-
exports.toBigIntBE = toBigIntBE;
|
|
10
|
-
exports.toBufferLE = toBufferLE;
|
|
11
|
-
exports.toBufferBE = toBufferBE;
|
|
12
|
-
exports.parseHex = parseHex;
|
|
13
|
-
exports.bigintToBuf = bigintToBuf;
|
|
14
|
-
exports.bufToBigint = bufToBigint;
|
|
15
|
-
exports.bigintToHex = bigintToHex;
|
|
16
|
-
exports.hexToBigint = hexToBigint;
|
|
17
|
-
exports.bigintToText = bigintToText;
|
|
18
|
-
exports.textToBigint = textToBigint;
|
|
19
|
-
exports.bufToText = bufToText;
|
|
20
|
-
exports.textToBuf = textToBuf;
|
|
21
|
-
exports.bufToHex = bufToHex;
|
|
22
|
-
exports.hexToBuf = hexToBuf;
|
|
23
|
-
exports.bigintToBase64 = bigintToBase64;
|
|
24
|
-
exports.base64ToBigint = base64ToBigint;
|
|
25
|
-
const buffer_1 = require("buffer");
|
|
26
|
-
const path_1 = __importDefault(require("path"));
|
|
27
|
-
const fs_1 = __importDefault(require("fs"));
|
|
28
|
-
var fixedPoint_1 = require("./fixedPoint");
|
|
29
|
-
Object.defineProperty(exports, "toFixedPoint", { enumerable: true, get: function () { return fixedPoint_1.toFixedPoint; } });
|
|
30
|
-
Object.defineProperty(exports, "fromFixedPoint", { enumerable: true, get: function () { return fixedPoint_1.fromFixedPoint; } });
|
|
31
|
-
Object.defineProperty(exports, "addFixedPoint", { enumerable: true, get: function () { return fixedPoint_1.addFixedPoint; } });
|
|
32
|
-
Object.defineProperty(exports, "subtractFixedPoint", { enumerable: true, get: function () { return fixedPoint_1.subtractFixedPoint; } });
|
|
33
|
-
Object.defineProperty(exports, "averageFixedPoint", { enumerable: true, get: function () { return fixedPoint_1.averageFixedPoint; } });
|
|
34
|
-
Object.defineProperty(exports, "compareFixedPoint", { enumerable: true, get: function () { return fixedPoint_1.compareFixedPoint; } });
|
|
35
|
-
Object.defineProperty(exports, "FIXED_POINT_DECIMALS", { enumerable: true, get: function () { return fixedPoint_1.FIXED_POINT_DECIMALS; } });
|
|
36
|
-
Object.defineProperty(exports, "ZERO_FIXED_POINT", { enumerable: true, get: function () { return fixedPoint_1.ZERO_FIXED_POINT; } });
|
|
37
|
-
Object.defineProperty(exports, "fixedPointToBigInt", { enumerable: true, get: function () { return fixedPoint_1.fixedPointToBigInt; } });
|
|
38
|
-
Object.defineProperty(exports, "toBigIntValue", { enumerable: true, get: function () { return fixedPoint_1.toBigIntValue; } });
|
|
39
|
-
exports.isNative = false;
|
|
40
|
-
let converter;
|
|
41
|
-
let nativeLoadError;
|
|
42
|
-
const IS_BROWSER = typeof globalThis !== "undefined" &&
|
|
43
|
-
typeof globalThis.document !== "undefined";
|
|
44
|
-
const candidateRoots = [
|
|
45
|
-
// when running from dist/
|
|
46
|
-
path_1.default.resolve(__dirname, ".."),
|
|
47
|
-
// when running from build/conversion/src/ts
|
|
48
|
-
path_1.default.resolve(__dirname, "../../.."),
|
|
49
|
-
// when running from src/conversion/src/ts
|
|
50
|
-
path_1.default.resolve(__dirname, "../../../../"),
|
|
51
|
-
];
|
|
52
|
-
const findModuleRoot = () => {
|
|
53
|
-
for (const root of candidateRoots) {
|
|
54
|
-
const candidate = path_1.default.join(root, "build", "Release", "bigint_buffer.node");
|
|
55
|
-
if (fs_1.default.existsSync(candidate))
|
|
56
|
-
return root;
|
|
57
|
-
}
|
|
58
|
-
return candidateRoots[0];
|
|
59
|
-
};
|
|
60
|
-
function loadNative() {
|
|
61
|
-
try {
|
|
62
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
63
|
-
const bindings = require("bindings");
|
|
64
|
-
const moduleRoot = findModuleRoot();
|
|
65
|
-
return bindings({
|
|
66
|
-
bindings: "bigint_buffer",
|
|
67
|
-
module_root: moduleRoot,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
catch (err) {
|
|
71
|
-
nativeLoadError = err;
|
|
72
|
-
return undefined;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (!IS_BROWSER) {
|
|
76
|
-
converter = loadNative();
|
|
77
|
-
exports.isNative = converter !== undefined;
|
|
78
|
-
if (!exports.isNative &&
|
|
79
|
-
nativeLoadError !== undefined &&
|
|
80
|
-
process.env?.BIGINT_BUFFER_SILENT_NATIVE_FAIL !== "1") {
|
|
81
|
-
console.warn("bigint-buffer: Failed to load native bindings; using pure JS fallback. Run npm run rebuild to restore native.", nativeLoadError);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
if (converter === undefined) {
|
|
85
|
-
// fallback to pure JS if needed (browser or when native load fails)
|
|
86
|
-
converter = {
|
|
87
|
-
toBigInt: (buf, bigEndian = true) => {
|
|
88
|
-
const copy = buffer_1.Buffer.from(buf);
|
|
89
|
-
if (!bigEndian)
|
|
90
|
-
copy.reverse();
|
|
91
|
-
const hex = copy.toString("hex");
|
|
92
|
-
return hex.length === 0 ? 0n : BigInt(`0x${hex}`);
|
|
93
|
-
},
|
|
94
|
-
fromBigInt: (num, buf, bigEndian = true) => {
|
|
95
|
-
const hex = num.toString(16);
|
|
96
|
-
const width = buf.length;
|
|
97
|
-
const filled = hex.padStart(width * 2, "0").slice(0, width * 2);
|
|
98
|
-
const tmp = buffer_1.Buffer.from(filled, "hex");
|
|
99
|
-
if (!bigEndian)
|
|
100
|
-
tmp.reverse();
|
|
101
|
-
tmp.copy(buf);
|
|
102
|
-
return buf;
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Convert a little-endian buffer into a BigInt.
|
|
108
|
-
* @param buf The little-endian buffer to convert
|
|
109
|
-
* @returns A BigInt with the little-endian representation of buf.
|
|
110
|
-
*/
|
|
111
|
-
function toBigIntLE(buf) {
|
|
112
|
-
if (IS_BROWSER || converter === undefined) {
|
|
113
|
-
const reversed = buffer_1.Buffer.from(buf);
|
|
114
|
-
reversed.reverse();
|
|
115
|
-
const hex = reversed.toString("hex");
|
|
116
|
-
if (hex.length === 0) {
|
|
117
|
-
return BigInt(0);
|
|
118
|
-
}
|
|
119
|
-
return BigInt(`0x${hex}`);
|
|
120
|
-
}
|
|
121
|
-
return converter.toBigInt(buf, false);
|
|
122
|
-
}
|
|
123
|
-
function validateBigIntBuffer() {
|
|
124
|
-
try {
|
|
125
|
-
const test = toBigIntLE(buffer_1.Buffer.from([0x01, 0x00]));
|
|
126
|
-
return test === BigInt(1);
|
|
127
|
-
}
|
|
128
|
-
catch {
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Convert a big-endian buffer into a BigInt
|
|
134
|
-
* @param buf The big-endian buffer to convert.
|
|
135
|
-
* @returns A BigInt with the big-endian representation of buf.
|
|
136
|
-
*/
|
|
137
|
-
function toBigIntBE(buf) {
|
|
138
|
-
if (IS_BROWSER || converter === undefined) {
|
|
139
|
-
const hex = buf.toString("hex");
|
|
140
|
-
if (hex.length === 0) {
|
|
141
|
-
return BigInt(0);
|
|
142
|
-
}
|
|
143
|
-
return BigInt(`0x${hex}`);
|
|
144
|
-
}
|
|
145
|
-
return converter.toBigInt(buf, true);
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Convert a BigInt to a little-endian buffer.
|
|
149
|
-
* @param num The BigInt to convert.
|
|
150
|
-
* @param width The number of bytes that the resulting buffer should be.
|
|
151
|
-
* @returns A little-endian buffer representation of num.
|
|
152
|
-
*/
|
|
153
|
-
function toBufferLE(num, width) {
|
|
154
|
-
if (IS_BROWSER || converter === undefined) {
|
|
155
|
-
const hex = num.toString(16);
|
|
156
|
-
const buffer = buffer_1.Buffer.from(hex.padStart(width * 2, "0").slice(0, width * 2), "hex");
|
|
157
|
-
buffer.reverse();
|
|
158
|
-
return buffer;
|
|
159
|
-
}
|
|
160
|
-
// Allocation is done here, since it is slower using napi in C
|
|
161
|
-
return converter.fromBigInt(num, buffer_1.Buffer.allocUnsafe(width), false);
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Convert a BigInt to a big-endian buffer.
|
|
165
|
-
* @param num The BigInt to convert.
|
|
166
|
-
* @param width The number of bytes that the resulting buffer should be.
|
|
167
|
-
* @returns A big-endian buffer representation of num.
|
|
168
|
-
*/
|
|
169
|
-
function toBufferBE(num, width) {
|
|
170
|
-
if (IS_BROWSER || converter === undefined) {
|
|
171
|
-
const hex = num.toString(16);
|
|
172
|
-
return buffer_1.Buffer.from(hex.padStart(width * 2, "0").slice(0, width * 2), "hex");
|
|
173
|
-
}
|
|
174
|
-
return converter.fromBigInt(num, buffer_1.Buffer.allocUnsafe(width), true);
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Parses a hexadecimal string for correctness and returns it with or without
|
|
178
|
-
* '0x' prefix, and/or with the specified byte length
|
|
179
|
-
* @param a - the string with an hexadecimal number to be parsed
|
|
180
|
-
* @param prefix0x - set to true to prefix the output with '0x'
|
|
181
|
-
* @param byteLength - pad the output to have the desired byte length. Notice
|
|
182
|
-
* that the hex length is double the byte length.
|
|
183
|
-
*
|
|
184
|
-
* @returns
|
|
185
|
-
*
|
|
186
|
-
* @throws {@link RangeError} if input string does not hold an hexadecimal number
|
|
187
|
-
* @throws {@link RangeError} if requested byte length is less than the input byte length
|
|
188
|
-
*/
|
|
189
|
-
function parseHex(a, prefix0x = false, byteLength) {
|
|
190
|
-
const hexMatch = a.match(/^(0x)?([\da-fA-F]+)$/);
|
|
191
|
-
if (hexMatch == null) {
|
|
192
|
-
throw new RangeError("input must be a hexadecimal string, e.g. '0x124fe3a' or '0214f1b2'");
|
|
193
|
-
}
|
|
194
|
-
let hex = hexMatch[2];
|
|
195
|
-
if (byteLength !== undefined) {
|
|
196
|
-
if (byteLength < hex.length / 2) {
|
|
197
|
-
throw new RangeError(`expected byte length ${byteLength} < input hex byte length ${Math.ceil(hex.length / 2)}`);
|
|
198
|
-
}
|
|
199
|
-
hex = hex.padStart(byteLength * 2, "0");
|
|
200
|
-
}
|
|
201
|
-
return prefix0x ? "0x" + hex : hex;
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Converts an arbitrary-size non-negative bigint to an ArrayBuffer or a Buffer
|
|
205
|
-
* (default for Node.js)
|
|
206
|
-
*
|
|
207
|
-
* @param a
|
|
208
|
-
* @param returnArrayBuffer - In Node.js, it forces the output to be an
|
|
209
|
-
* ArrayBuffer instead of a Buffer.
|
|
210
|
-
*
|
|
211
|
-
* @returns an ArrayBuffer or a Buffer with a binary representation of the input
|
|
212
|
-
* bigint
|
|
213
|
-
*
|
|
214
|
-
* @throws {@link RangeError} if a < 0.
|
|
215
|
-
*/
|
|
216
|
-
function bigintToBuf(a, returnArrayBuffer = false) {
|
|
217
|
-
if (a < 0) {
|
|
218
|
-
throw RangeError("a should be a non-negative integer. Negative values are not supported");
|
|
219
|
-
}
|
|
220
|
-
return hexToBuf(bigintToHex(a), returnArrayBuffer);
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Converts an ArrayBuffer, TypedArray or Buffer (node.js) to a bigint
|
|
224
|
-
* @param buf
|
|
225
|
-
* @returns a bigint
|
|
226
|
-
*/
|
|
227
|
-
function bufToBigint(buf) {
|
|
228
|
-
let bits = 8n;
|
|
229
|
-
if (ArrayBuffer.isView(buf)) {
|
|
230
|
-
bits = BigInt(buf.BYTES_PER_ELEMENT * 8);
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
buf = new Uint8Array(buf);
|
|
234
|
-
}
|
|
235
|
-
let ret = 0n;
|
|
236
|
-
for (const i of buf.values()) {
|
|
237
|
-
const bi = BigInt(i);
|
|
238
|
-
ret = (ret << bits) + bi;
|
|
239
|
-
}
|
|
240
|
-
return ret;
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Converts a non-negative bigint to a hexadecimal string
|
|
244
|
-
* @param a - a non negative bigint
|
|
245
|
-
* @param prefix0x - set to true to prefix the output with '0x'
|
|
246
|
-
* @param byteLength - pad the output to have the desired byte length. Notice
|
|
247
|
-
* that the hex length is double the byte length.
|
|
248
|
-
*
|
|
249
|
-
* @returns hexadecimal representation of the input bigint
|
|
250
|
-
*
|
|
251
|
-
* @throws {@link RangeError} if a < 0
|
|
252
|
-
*/
|
|
253
|
-
function bigintToHex(a, prefix0x = false, byteLength) {
|
|
254
|
-
if (a < 0) {
|
|
255
|
-
throw RangeError("a should be a non-negative integer. Negative values are not supported");
|
|
256
|
-
}
|
|
257
|
-
return parseHex(a.toString(16), prefix0x, byteLength);
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Converts a hexadecimal string to a bigint
|
|
261
|
-
*
|
|
262
|
-
* @param hexStr
|
|
263
|
-
*
|
|
264
|
-
* @returns a bigint
|
|
265
|
-
*
|
|
266
|
-
* @throws {@link RangeError} if input string does not hold an hexadecimal number
|
|
267
|
-
*/
|
|
268
|
-
function hexToBigint(hexStr) {
|
|
269
|
-
return BigInt(parseHex(hexStr, true));
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Converts a non-negative bigint representing a binary array of utf-8 encoded
|
|
273
|
-
* text to a string of utf-8 text
|
|
274
|
-
*
|
|
275
|
-
* @param a - A non-negative bigint representing a binary array of utf-8 encoded
|
|
276
|
-
* text.
|
|
277
|
-
*
|
|
278
|
-
* @returns a string text with utf-8 encoding
|
|
279
|
-
*
|
|
280
|
-
* @throws {@link RangeError} if a < 0.
|
|
281
|
-
*/
|
|
282
|
-
function bigintToText(a) {
|
|
283
|
-
if (a < 0) {
|
|
284
|
-
throw RangeError("a should be a non-negative integer. Negative values are not supported");
|
|
285
|
-
}
|
|
286
|
-
return bufToText(hexToBuf(a.toString(16)));
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Converts a utf-8 string to a bigint (from its binary representaion)
|
|
290
|
-
*
|
|
291
|
-
* @param text - A string text with utf-8 encoding
|
|
292
|
-
*
|
|
293
|
-
* @returns a bigint representing a binary array of the input utf-8 encoded text
|
|
294
|
-
*/
|
|
295
|
-
function textToBigint(text) {
|
|
296
|
-
return hexToBigint(bufToHex(textToBuf(text)));
|
|
297
|
-
}
|
|
298
|
-
function toBuffer(input) {
|
|
299
|
-
if (buffer_1.Buffer.isBuffer(input)) {
|
|
300
|
-
return input;
|
|
301
|
-
}
|
|
302
|
-
if (ArrayBuffer.isView(input)) {
|
|
303
|
-
return buffer_1.Buffer.from(input.buffer, input.byteOffset, input.byteLength);
|
|
304
|
-
}
|
|
305
|
-
if (input instanceof ArrayBuffer) {
|
|
306
|
-
return buffer_1.Buffer.from(new Uint8Array(input));
|
|
307
|
-
}
|
|
308
|
-
throw new TypeError("Unsupported input type for Buffer.from");
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Converts an ArrayBuffer, TypedArray or Buffer (in Node.js) containing utf-8
|
|
312
|
-
* encoded text to a string of utf-8 text
|
|
313
|
-
*
|
|
314
|
-
* @param buf - A buffer containing utf-8 encoded text
|
|
315
|
-
*
|
|
316
|
-
* @returns a string text with utf-8 encoding
|
|
317
|
-
*/
|
|
318
|
-
function bufToText(buf) {
|
|
319
|
-
const input = toBuffer(buf);
|
|
320
|
-
if (IS_BROWSER) {
|
|
321
|
-
return new TextDecoder().decode(new Uint8Array(input));
|
|
322
|
-
}
|
|
323
|
-
else {
|
|
324
|
-
return buffer_1.Buffer.from(input).toString();
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Converts a string of utf-8 encoded text to an ArrayBuffer or a Buffer
|
|
329
|
-
* (default in Node.js)
|
|
330
|
-
*
|
|
331
|
-
* @param str - A string of text (with utf-8 encoding)
|
|
332
|
-
* @param returnArrayBuffer - When invoked in Node.js, it can force the output
|
|
333
|
-
* to be an ArrayBuffer instead of a Buffer.
|
|
334
|
-
*
|
|
335
|
-
* @returns an ArrayBuffer or a Buffer containing the utf-8 encoded text
|
|
336
|
-
*/
|
|
337
|
-
function textToBuf(str, returnArrayBuffer = false) {
|
|
338
|
-
if (!IS_BROWSER && !returnArrayBuffer) {
|
|
339
|
-
return buffer_1.Buffer.from(new TextEncoder().encode(str).buffer);
|
|
340
|
-
}
|
|
341
|
-
return new TextEncoder().encode(str).buffer;
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Returns the hexadecimal representation of a buffer.
|
|
345
|
-
*
|
|
346
|
-
* @param buf
|
|
347
|
-
* @param prefix0x - set to true to prefix the output with '0x'
|
|
348
|
-
* @param byteLength - pad the output to have the desired byte length. Notice
|
|
349
|
-
* that the hex length is double the byte length.
|
|
350
|
-
*
|
|
351
|
-
* @returns a string with a hexadecimal representation of the input buffer
|
|
352
|
-
*/
|
|
353
|
-
function bufToHex(buf, prefix0x = false, byteLength) {
|
|
354
|
-
if (IS_BROWSER) {
|
|
355
|
-
let s = "";
|
|
356
|
-
const h = "0123456789abcdef";
|
|
357
|
-
if (ArrayBuffer.isView(buf)) {
|
|
358
|
-
buf = new Uint8Array(buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength));
|
|
359
|
-
}
|
|
360
|
-
else {
|
|
361
|
-
buf = new Uint8Array(buf);
|
|
362
|
-
}
|
|
363
|
-
buf.forEach((v) => {
|
|
364
|
-
s += h[v >> 4] + h[v & 15];
|
|
365
|
-
});
|
|
366
|
-
return parseHex(s, prefix0x, byteLength);
|
|
367
|
-
}
|
|
368
|
-
else {
|
|
369
|
-
const input = toBuffer(buf);
|
|
370
|
-
if (ArrayBuffer.isView(input)) {
|
|
371
|
-
buf = new Uint8Array(input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength));
|
|
372
|
-
}
|
|
373
|
-
return parseHex(buffer_1.Buffer.from(toBuffer(buf)).toString("hex"), prefix0x, byteLength);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* Converts a hexadecimal string to a buffer
|
|
378
|
-
*
|
|
379
|
-
* @param hexStr - A string representing a number with hexadecimal notation
|
|
380
|
-
* @param returnArrayBuffer - In Node.js, it forces the output to be an
|
|
381
|
-
* ArrayBuffer instead of a Buffer.
|
|
382
|
-
*
|
|
383
|
-
* @returns An ArrayBuffer or a Buffer
|
|
384
|
-
*
|
|
385
|
-
* @throws {@link RangeError} if input string does not hold an hexadecimal number
|
|
386
|
-
*/
|
|
387
|
-
function hexToBuf(hexStr, returnArrayBuffer = false) {
|
|
388
|
-
let hex = parseHex(hexStr);
|
|
389
|
-
hex = parseHex(hexStr, false, Math.ceil(hex.length / 2)); // pad to have a length in bytes
|
|
390
|
-
if (IS_BROWSER) {
|
|
391
|
-
return Uint8Array.from(hex.match(/[\da-fA-F]{2}/g).map((h) => {
|
|
392
|
-
// ...existing code...
|
|
393
|
-
return Number("0x" + h);
|
|
394
|
-
})).buffer;
|
|
395
|
-
}
|
|
396
|
-
else {
|
|
397
|
-
const b = buffer_1.Buffer.from(hex, "hex");
|
|
398
|
-
return returnArrayBuffer
|
|
399
|
-
? b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength)
|
|
400
|
-
: b;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Converts an arbitrary-size non-negative bigint to a base64 string
|
|
405
|
-
* @param a - a non negative bigint
|
|
406
|
-
* @param urlsafe - if true Base64 URL encoding is used ('+' and '/' are
|
|
407
|
-
* replaced by '-', '_')
|
|
408
|
-
* @param padding - if false, padding (trailing '=') is removed
|
|
409
|
-
* @returns a base64 representation of the input bigint
|
|
410
|
-
*
|
|
411
|
-
* @throws {RangeError}
|
|
412
|
-
* Thrown if a < 0
|
|
413
|
-
*/
|
|
414
|
-
function bigintToBase64(a, urlsafe = false, padding = true) {
|
|
415
|
-
if (a < 0n) {
|
|
416
|
-
throw new RangeError("negative bigint");
|
|
417
|
-
}
|
|
418
|
-
const buf = bigintToBuf(a);
|
|
419
|
-
let base64 = buffer_1.Buffer.isBuffer(buf)
|
|
420
|
-
? buf.toString("base64")
|
|
421
|
-
: buffer_1.Buffer.from(buf).toString("base64");
|
|
422
|
-
if (urlsafe) {
|
|
423
|
-
base64 = base64.replace(/\+/g, "-").replace(/\//g, "_");
|
|
424
|
-
}
|
|
425
|
-
if (!padding) {
|
|
426
|
-
base64 = base64.replace(/=+$/, "");
|
|
427
|
-
}
|
|
428
|
-
return base64;
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* Converts a base64 string to bigint.
|
|
432
|
-
* @param a base64 string. It accepts standard and URL-safe base64 with and
|
|
433
|
-
* without padding
|
|
434
|
-
* @returns a bigint
|
|
435
|
-
*/
|
|
436
|
-
function base64ToBigint(a) {
|
|
437
|
-
if (!a || a.trim() === "") {
|
|
438
|
-
return 0n;
|
|
439
|
-
}
|
|
440
|
-
const cleaned = a.trim();
|
|
441
|
-
if (!/^[A-Za-z0-9+/=_-]*$/.test(cleaned)) {
|
|
442
|
-
throw new RangeError("invalid base64");
|
|
443
|
-
}
|
|
444
|
-
// Implementation now uses Buffer, see above
|
|
445
|
-
let base64 = cleaned.replace(/-/g, "+").replace(/_/g, "/");
|
|
446
|
-
// Pad base64 string if necessary
|
|
447
|
-
while (base64.length % 4 !== 0) {
|
|
448
|
-
base64 += "=";
|
|
449
|
-
}
|
|
450
|
-
const buf = buffer_1.Buffer.from(base64, "base64");
|
|
451
|
-
return bufToBigint(buf);
|
|
452
|
-
}
|
|
453
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/conversion/src/ts/index.ts"],"names":[],"mappings":";;;;;;AAyGA,gCAWC;AAED,oDAOC;AAOD,gCASC;AAQD,gCAYC;AAQD,gCAMC;AA4BD,4BAuBC;AAeD,kCAUC;AAOD,kCAcC;AAaD,kCAWC;AAWD,kCAEC;AAaD,oCAOC;AASD,oCAEC;AAwBD,8BAOC;AAYD,8BAQC;AAYD,4BAqCC;AAaD,4BAmBC;AAaD,wCAmBC;AAQD,wCAgBC;AAhhBD,mCAAgC;AAChC,gDAAwB;AACxB,4CAAoB;AAEpB,2CAYqB;AAXnB,0GAAA,YAAY,OAAA;AACZ,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