ccxt-ir 4.9.13 → 4.9.14

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.
Files changed (82) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +229 -229
  4. package/dist/cjs/package.json +1 -1
  5. package/dist/cjs/src/abantether.js +344 -344
  6. package/dist/cjs/src/abstract/bitbarg.js +1 -1
  7. package/dist/cjs/src/abstract/bydfi.js +1 -1
  8. package/dist/cjs/src/abstract/cafearz.js +1 -1
  9. package/dist/cjs/src/abstract/hamtapay.js +1 -1
  10. package/dist/cjs/src/abstract/kifpoolme.js +1 -1
  11. package/dist/cjs/src/abstract/mazdax.js +1 -1
  12. package/dist/cjs/src/abstract/pingi.js +1 -1
  13. package/dist/cjs/src/abstract/pooleno.js +1 -1
  14. package/dist/cjs/src/afratether.js +347 -347
  15. package/dist/cjs/src/arzplus.js +572 -572
  16. package/dist/cjs/src/bitbarg.js +303 -303
  17. package/dist/cjs/src/bydfi.js +425 -425
  18. package/dist/cjs/src/cafearz.js +337 -337
  19. package/dist/cjs/src/hamtapay.js +291 -291
  20. package/dist/cjs/src/kifpoolme.js +401 -401
  21. package/dist/cjs/src/mazdax.js +525 -526
  22. package/dist/cjs/src/pingi.js +437 -438
  23. package/dist/cjs/src/pooleno.js +338 -338
  24. package/dist/cjs/src/tetherland.js +358 -358
  25. package/dist/cjs/src/twox.js +362 -362
  26. package/js/ccxt.d.ts +673 -673
  27. package/js/ccxt.js +491 -491
  28. package/js/src/abantether.js +347 -347
  29. package/js/src/abstract/abantether.d.ts +8 -8
  30. package/js/src/abstract/arzplus.d.ts +11 -11
  31. package/js/src/abstract/bitbarg.d.ts +8 -8
  32. package/js/src/abstract/bitbarg.js +5 -5
  33. package/js/src/abstract/bydfi.d.ts +11 -11
  34. package/js/src/abstract/bydfi.js +5 -5
  35. package/js/src/abstract/cafearz.d.ts +8 -8
  36. package/js/src/abstract/cafearz.js +5 -5
  37. package/js/src/abstract/hamtapay.d.ts +9 -9
  38. package/js/src/abstract/hamtapay.js +5 -5
  39. package/js/src/abstract/kifpoolme.d.ts +9 -9
  40. package/js/src/abstract/kifpoolme.js +5 -5
  41. package/js/src/abstract/mazdax.d.ts +11 -11
  42. package/js/src/abstract/mazdax.js +5 -5
  43. package/js/src/abstract/pingi.d.ts +9 -9
  44. package/js/src/abstract/pingi.js +5 -5
  45. package/js/src/abstract/pooleno.d.ts +8 -8
  46. package/js/src/abstract/pooleno.js +5 -5
  47. package/js/src/afratether.js +350 -350
  48. package/js/src/arzplus.d.ts +26 -26
  49. package/js/src/arzplus.js +575 -575
  50. package/js/src/base/Exchange.d.ts +926 -926
  51. package/js/src/base/types.d.ts +586 -586
  52. package/js/src/bitbarg.d.ts +21 -21
  53. package/js/src/bitbarg.js +306 -306
  54. package/js/src/bydfi.d.ts +23 -23
  55. package/js/src/bydfi.js +428 -428
  56. package/js/src/cafearz.d.ts +21 -21
  57. package/js/src/cafearz.js +340 -340
  58. package/js/src/coinbaseexchange.d.ts +334 -334
  59. package/js/src/hamtapay.d.ts +21 -21
  60. package/js/src/hamtapay.js +294 -294
  61. package/js/src/kifpoolme.d.ts +23 -23
  62. package/js/src/kifpoolme.js +404 -404
  63. package/js/src/mazdax.d.ts +23 -23
  64. package/js/src/mazdax.js +528 -529
  65. package/js/src/pingi.d.ts +22 -22
  66. package/js/src/pingi.js +440 -441
  67. package/js/src/pooleno.d.ts +21 -21
  68. package/js/src/pooleno.js +341 -341
  69. package/js/src/protobuf/mexc/compiled.d.cts +2 -2
  70. package/js/src/static_dependencies/fflake/browser.d.ts +222 -222
  71. package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.d.ts +51 -51
  72. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
  73. package/js/src/static_dependencies/noble-curves/abstract/weierstrass.d.ts +204 -204
  74. package/js/src/static_dependencies/qs/formats.d.cts +8 -8
  75. package/js/src/static_dependencies/qs/index.d.cts +4 -4
  76. package/js/src/static_dependencies/qs/parse.d.cts +2 -2
  77. package/js/src/static_dependencies/qs/stringify.d.cts +2 -2
  78. package/js/src/static_dependencies/qs/utils.d.cts +9 -9
  79. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
  80. package/js/src/tetherland.js +361 -361
  81. package/js/src/twox.js +365 -365
  82. package/package.json +1 -1
@@ -1,101 +1,101 @@
1
- import { SecureRandom } from "./rng.js";
2
- /**
3
- * @type Class
4
- */
5
- export declare class BigInteger {
6
- constructor(a: number | number[] | string, b?: number | SecureRandom, c?: number | SecureRandom);
7
- toString(b: number): string;
8
- protected negate(): BigInteger;
9
- abs(): BigInteger;
10
- compareTo(a: BigInteger): number;
11
- bitLength(): number;
12
- mod(a: BigInteger): BigInteger;
13
- modPowInt(e: number, m: BigInteger): BigInteger;
14
- protected clone(): BigInteger;
15
- protected intValue(): number;
16
- protected byteValue(): number;
17
- protected shortValue(): number;
18
- protected signum(): 1 | 0 | -1;
19
- toByteArray(): number[];
20
- protected equals(a: BigInteger): boolean;
21
- protected min(a: BigInteger): BigInteger;
22
- protected max(a: BigInteger): BigInteger;
23
- protected and(a: BigInteger): BigInteger;
24
- protected or(a: BigInteger): BigInteger;
25
- protected xor(a: BigInteger): BigInteger;
26
- protected andNot(a: BigInteger): BigInteger;
27
- protected not(): BigInteger;
28
- protected shiftLeft(n: number): BigInteger;
29
- protected shiftRight(n: number): BigInteger;
30
- protected getLowestSetBit(): number;
31
- protected bitCount(): number;
32
- protected testBit(n: number): boolean;
33
- protected setBit(n: number): BigInteger;
34
- protected clearBit(n: number): BigInteger;
35
- protected flipBit(n: number): BigInteger;
36
- add(a: BigInteger): BigInteger;
37
- subtract(a: BigInteger): BigInteger;
38
- multiply(a: BigInteger): BigInteger;
39
- divide(a: BigInteger): BigInteger;
40
- protected remainder(a: BigInteger): BigInteger;
41
- protected divideAndRemainder(a: BigInteger): BigInteger[];
42
- modPow(e: BigInteger, m: BigInteger): BigInteger;
43
- modInverse(m: BigInteger): BigInteger;
44
- protected pow(e: number): BigInteger;
45
- gcd(a: BigInteger): BigInteger;
46
- isProbablePrime(t: number): boolean;
47
- copyTo(r: BigInteger): void;
48
- fromInt(x: number): void;
49
- protected fromString(s: string | number[], b: number): void;
50
- clamp(): void;
51
- dlShiftTo(n: number, r: BigInteger): void;
52
- drShiftTo(n: number, r: BigInteger): void;
53
- protected lShiftTo(n: number, r: BigInteger): void;
54
- protected rShiftTo(n: number, r: BigInteger): void;
55
- subTo(a: BigInteger, r: BigInteger): void;
56
- multiplyTo(a: BigInteger, r: BigInteger): void;
57
- squareTo(r: BigInteger): void;
58
- divRemTo(m: BigInteger, q: BigInteger, r: BigInteger): void;
59
- invDigit(): number;
60
- protected isEven(): boolean;
61
- protected exp(e: number, z: IReduction): BigInteger;
62
- protected chunkSize(r: number): number;
63
- protected toRadix(b: number): string;
64
- fromRadix(s: string, b: number): void;
65
- protected fromNumber(a: number, b: number | SecureRandom, c?: number | SecureRandom): void;
66
- protected bitwiseTo(a: BigInteger, op: (a: number, b: number) => number, r: BigInteger): void;
67
- protected changeBit(n: number, op: (a: number, b: number) => number): BigInteger;
68
- protected addTo(a: BigInteger, r: BigInteger): void;
69
- protected dMultiply(n: number): void;
70
- dAddOffset(n: number, w: number): void;
71
- multiplyLowerTo(a: BigInteger, n: number, r: BigInteger): void;
72
- multiplyUpperTo(a: BigInteger, n: number, r: BigInteger): void;
73
- protected modInt(n: number): number;
74
- protected millerRabin(t: number): boolean;
75
- protected square(): BigInteger;
76
- gcda(a: BigInteger, callback: (x: BigInteger) => void): void;
77
- fromNumberAsync(a: number, b: number | SecureRandom, c: number | SecureRandom, callback: () => void): void;
78
- s: number;
79
- t: number;
80
- DB: number;
81
- DM: number;
82
- DV: number;
83
- FV: number;
84
- F1: number;
85
- F2: number;
86
- am: (i: number, x: number, w: BigInteger, j: number, c: number, n: number) => number;
87
- [index: number]: number;
88
- static ONE: BigInteger;
89
- static ZERO: BigInteger;
90
- }
91
- export interface IReduction {
92
- convert(x: BigInteger): BigInteger;
93
- revert(x: BigInteger): BigInteger;
94
- mulTo(x: BigInteger, y: BigInteger, r: BigInteger): void;
95
- sqrTo(x: BigInteger, r: BigInteger): void;
96
- }
97
- export declare function nbi(): BigInteger;
98
- export declare function parseBigInt(str: string, r: number): BigInteger;
99
- export declare function intAt(s: string, i: number): number;
100
- export declare function nbv(i: number): BigInteger;
101
- export declare function nbits(x: number): number;
1
+ import { SecureRandom } from "./rng.js";
2
+ /**
3
+ * @type Class
4
+ */
5
+ export declare class BigInteger {
6
+ constructor(a: number | number[] | string, b?: number | SecureRandom, c?: number | SecureRandom);
7
+ toString(b: number): string;
8
+ protected negate(): BigInteger;
9
+ abs(): BigInteger;
10
+ compareTo(a: BigInteger): number;
11
+ bitLength(): number;
12
+ mod(a: BigInteger): BigInteger;
13
+ modPowInt(e: number, m: BigInteger): BigInteger;
14
+ protected clone(): BigInteger;
15
+ protected intValue(): number;
16
+ protected byteValue(): number;
17
+ protected shortValue(): number;
18
+ protected signum(): 1 | 0 | -1;
19
+ toByteArray(): number[];
20
+ protected equals(a: BigInteger): boolean;
21
+ protected min(a: BigInteger): BigInteger;
22
+ protected max(a: BigInteger): BigInteger;
23
+ protected and(a: BigInteger): BigInteger;
24
+ protected or(a: BigInteger): BigInteger;
25
+ protected xor(a: BigInteger): BigInteger;
26
+ protected andNot(a: BigInteger): BigInteger;
27
+ protected not(): BigInteger;
28
+ protected shiftLeft(n: number): BigInteger;
29
+ protected shiftRight(n: number): BigInteger;
30
+ protected getLowestSetBit(): number;
31
+ protected bitCount(): number;
32
+ protected testBit(n: number): boolean;
33
+ protected setBit(n: number): BigInteger;
34
+ protected clearBit(n: number): BigInteger;
35
+ protected flipBit(n: number): BigInteger;
36
+ add(a: BigInteger): BigInteger;
37
+ subtract(a: BigInteger): BigInteger;
38
+ multiply(a: BigInteger): BigInteger;
39
+ divide(a: BigInteger): BigInteger;
40
+ protected remainder(a: BigInteger): BigInteger;
41
+ protected divideAndRemainder(a: BigInteger): BigInteger[];
42
+ modPow(e: BigInteger, m: BigInteger): BigInteger;
43
+ modInverse(m: BigInteger): BigInteger;
44
+ protected pow(e: number): BigInteger;
45
+ gcd(a: BigInteger): BigInteger;
46
+ isProbablePrime(t: number): boolean;
47
+ copyTo(r: BigInteger): void;
48
+ fromInt(x: number): void;
49
+ protected fromString(s: string | number[], b: number): void;
50
+ clamp(): void;
51
+ dlShiftTo(n: number, r: BigInteger): void;
52
+ drShiftTo(n: number, r: BigInteger): void;
53
+ protected lShiftTo(n: number, r: BigInteger): void;
54
+ protected rShiftTo(n: number, r: BigInteger): void;
55
+ subTo(a: BigInteger, r: BigInteger): void;
56
+ multiplyTo(a: BigInteger, r: BigInteger): void;
57
+ squareTo(r: BigInteger): void;
58
+ divRemTo(m: BigInteger, q: BigInteger, r: BigInteger): void;
59
+ invDigit(): number;
60
+ protected isEven(): boolean;
61
+ protected exp(e: number, z: IReduction): BigInteger;
62
+ protected chunkSize(r: number): number;
63
+ protected toRadix(b: number): string;
64
+ fromRadix(s: string, b: number): void;
65
+ protected fromNumber(a: number, b: number | SecureRandom, c?: number | SecureRandom): void;
66
+ protected bitwiseTo(a: BigInteger, op: (a: number, b: number) => number, r: BigInteger): void;
67
+ protected changeBit(n: number, op: (a: number, b: number) => number): BigInteger;
68
+ protected addTo(a: BigInteger, r: BigInteger): void;
69
+ protected dMultiply(n: number): void;
70
+ dAddOffset(n: number, w: number): void;
71
+ multiplyLowerTo(a: BigInteger, n: number, r: BigInteger): void;
72
+ multiplyUpperTo(a: BigInteger, n: number, r: BigInteger): void;
73
+ protected modInt(n: number): number;
74
+ protected millerRabin(t: number): boolean;
75
+ protected square(): BigInteger;
76
+ gcda(a: BigInteger, callback: (x: BigInteger) => void): void;
77
+ fromNumberAsync(a: number, b: number | SecureRandom, c: number | SecureRandom, callback: () => void): void;
78
+ s: number;
79
+ t: number;
80
+ DB: number;
81
+ DM: number;
82
+ DV: number;
83
+ FV: number;
84
+ F1: number;
85
+ F2: number;
86
+ am: (i: number, x: number, w: BigInteger, j: number, c: number, n: number) => number;
87
+ [index: number]: number;
88
+ static ONE: BigInteger;
89
+ static ZERO: BigInteger;
90
+ }
91
+ export interface IReduction {
92
+ convert(x: BigInteger): BigInteger;
93
+ revert(x: BigInteger): BigInteger;
94
+ mulTo(x: BigInteger, y: BigInteger, r: BigInteger): void;
95
+ sqrTo(x: BigInteger, r: BigInteger): void;
96
+ }
97
+ export declare function nbi(): BigInteger;
98
+ export declare function parseBigInt(str: string, r: number): BigInteger;
99
+ export declare function intAt(s: string, i: number): number;
100
+ export declare function nbv(i: number): BigInteger;
101
+ export declare function nbits(x: number): number;
@@ -1,204 +1,204 @@
1
- /// <reference types="node" />
2
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3
- import * as mod from './modular.js';
4
- import * as ut from './utils.js';
5
- import { CHash, Hex, PrivKey } from './utils.js';
6
- import { Group, GroupConstructor, BasicCurve, AffinePoint } from './curve.js';
7
- export type { AffinePoint };
8
- declare type HmacFnSync = (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
9
- declare type EndomorphismOpts = {
10
- beta: bigint;
11
- splitScalar: (k: bigint) => {
12
- k1neg: boolean;
13
- k1: bigint;
14
- k2neg: boolean;
15
- k2: bigint;
16
- };
17
- };
18
- export declare type BasicWCurve<T> = BasicCurve<T> & {
19
- a: T;
20
- b: T;
21
- allowedPrivateKeyLengths?: readonly number[];
22
- wrapPrivateKey?: boolean;
23
- endo?: EndomorphismOpts;
24
- isTorsionFree?: (c: ProjConstructor<T>, point: ProjPointType<T>) => boolean;
25
- clearCofactor?: (c: ProjConstructor<T>, point: ProjPointType<T>) => ProjPointType<T>;
26
- };
27
- declare type Entropy = Hex | true;
28
- export declare type SignOpts = {
29
- lowS?: boolean;
30
- extraEntropy?: Entropy;
31
- prehash?: boolean;
32
- };
33
- export declare type VerOpts = {
34
- lowS?: boolean;
35
- prehash?: boolean;
36
- };
37
- /**
38
- * ### Design rationale for types
39
- *
40
- * * Interaction between classes from different curves should fail:
41
- * `k256.Point.BASE.add(p256.Point.BASE)`
42
- * * For this purpose we want to use `instanceof` operator, which is fast and works during runtime
43
- * * Different calls of `curve()` would return different classes -
44
- * `curve(params) !== curve(params)`: if somebody decided to monkey-patch their curve,
45
- * it won't affect others
46
- *
47
- * TypeScript can't infer types for classes created inside a function. Classes is one instance of nominative types in TypeScript and interfaces only check for shape, so it's hard to create unique type for every function call.
48
- *
49
- * We can use generic types via some param, like curve opts, but that would:
50
- * 1. Enable interaction between `curve(params)` and `curve(params)` (curves of same params)
51
- * which is hard to debug.
52
- * 2. Params can be generic and we can't enforce them to be constant value:
53
- * if somebody creates curve from non-constant params,
54
- * it would be allowed to interact with other curves with non-constant params
55
- *
56
- * TODO: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#unique-symbol
57
- */
58
- export interface ProjPointType<T> extends Group<ProjPointType<T>> {
59
- readonly px: T;
60
- readonly py: T;
61
- readonly pz: T;
62
- multiply(scalar: bigint): ProjPointType<T>;
63
- toAffine(iz?: T): AffinePoint<T>;
64
- isTorsionFree(): boolean;
65
- clearCofactor(): ProjPointType<T>;
66
- assertValidity(): void;
67
- hasEvenY(): boolean;
68
- toRawBytes(isCompressed?: boolean): Uint8Array;
69
- toHex(isCompressed?: boolean): string;
70
- multiplyUnsafe(scalar: bigint): ProjPointType<T>;
71
- multiplyAndAddUnsafe(Q: ProjPointType<T>, a: bigint, b: bigint): ProjPointType<T> | undefined;
72
- _setWindowSize(windowSize: number): void;
73
- }
74
- export interface ProjConstructor<T> extends GroupConstructor<ProjPointType<T>> {
75
- new (x: T, y: T, z: T): ProjPointType<T>;
76
- fromAffine(p: AffinePoint<T>): ProjPointType<T>;
77
- fromHex(hex: Hex): ProjPointType<T>;
78
- fromPrivateKey(privateKey: PrivKey): ProjPointType<T>;
79
- normalizeZ(points: ProjPointType<T>[]): ProjPointType<T>[];
80
- }
81
- export declare type CurvePointsType<T> = BasicWCurve<T> & {
82
- fromBytes: (bytes: Uint8Array) => AffinePoint<T>;
83
- toBytes: (c: ProjConstructor<T>, point: ProjPointType<T>, compressed: boolean) => Uint8Array;
84
- };
85
- export declare type CurvePointsRes<T> = {
86
- ProjectivePoint: ProjConstructor<T>;
87
- normPrivateKeyToScalar: (key: PrivKey) => bigint;
88
- weierstrassEquation: (x: T) => T;
89
- isWithinCurveOrder: (num: bigint) => boolean;
90
- };
91
- export declare const DER: {
92
- Err: {
93
- new (m?: string): {
94
- name: string;
95
- message: string;
96
- stack?: string;
97
- };
98
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
99
- prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any;
100
- stackTraceLimit: number;
101
- };
102
- _parseInt(data: Uint8Array): {
103
- d: bigint;
104
- l: Uint8Array;
105
- };
106
- toSig(hex: string | Uint8Array): {
107
- r: bigint;
108
- s: bigint;
109
- };
110
- hexFromSig(sig: {
111
- r: bigint;
112
- s: bigint;
113
- }): string;
114
- };
115
- export declare function weierstrassPoints<T>(opts: CurvePointsType<T>): {
116
- ProjectivePoint: ProjConstructor<T>;
117
- normPrivateKeyToScalar: (key: PrivKey) => bigint;
118
- weierstrassEquation: (x: T) => T;
119
- isWithinCurveOrder: (num: bigint) => boolean;
120
- };
121
- export interface SignatureType {
122
- readonly r: bigint;
123
- readonly s: bigint;
124
- readonly recovery?: number;
125
- assertValidity(): void;
126
- addRecoveryBit(recovery: number): SignatureType;
127
- hasHighS(): boolean;
128
- normalizeS(): SignatureType;
129
- recoverPublicKey(msgHash: Hex): ProjPointType<bigint>;
130
- toCompactRawBytes(): Uint8Array;
131
- toCompactHex(): string;
132
- toDERRawBytes(isCompressed?: boolean): Uint8Array;
133
- toDERHex(isCompressed?: boolean): string;
134
- }
135
- export declare type SignatureConstructor = {
136
- new (r: bigint, s: bigint): SignatureType;
137
- fromCompact(hex: Hex): SignatureType;
138
- fromDER(hex: Hex): SignatureType;
139
- };
140
- declare type SignatureLike = {
141
- r: bigint;
142
- s: bigint;
143
- };
144
- export declare type PubKey = Hex | ProjPointType<bigint>;
145
- export declare type CurveType = BasicWCurve<bigint> & {
146
- hash: CHash;
147
- hmac: HmacFnSync;
148
- randomBytes: (bytesLength?: number) => Uint8Array;
149
- lowS?: boolean;
150
- bits2int?: (bytes: Uint8Array) => bigint;
151
- bits2int_modN?: (bytes: Uint8Array) => bigint;
152
- };
153
- declare function validateOpts(curve: CurveType): Readonly<{
154
- readonly nBitLength: number;
155
- readonly nByteLength: number;
156
- readonly Fp: mod.Field<bigint>;
157
- readonly n: bigint;
158
- readonly h: bigint;
159
- readonly hEff?: bigint;
160
- readonly Gx: bigint;
161
- readonly Gy: bigint;
162
- readonly allowInfinityPoint?: boolean;
163
- readonly a: bigint;
164
- readonly b: bigint;
165
- readonly allowedPrivateKeyLengths?: readonly number[];
166
- readonly wrapPrivateKey?: boolean;
167
- readonly endo?: EndomorphismOpts;
168
- readonly isTorsionFree?: (c: ProjConstructor<bigint>, point: ProjPointType<bigint>) => boolean;
169
- readonly clearCofactor?: (c: ProjConstructor<bigint>, point: ProjPointType<bigint>) => ProjPointType<bigint>;
170
- readonly hash: ut.CHash;
171
- readonly hmac: HmacFnSync;
172
- readonly randomBytes: (bytesLength?: number) => Uint8Array;
173
- lowS: boolean;
174
- readonly bits2int?: (bytes: Uint8Array) => bigint;
175
- readonly bits2int_modN?: (bytes: Uint8Array) => bigint;
176
- }>;
177
- export declare type CurveFn = {
178
- CURVE: ReturnType<typeof validateOpts>;
179
- getPublicKey: (privateKey: PrivKey, isCompressed?: boolean) => Uint8Array;
180
- getSharedSecret: (privateA: PrivKey, publicB: Hex, isCompressed?: boolean) => Uint8Array;
181
- sign: (msgHash: Hex, privKey: PrivKey, opts?: SignOpts) => SignatureType;
182
- verify: (signature: Hex | SignatureLike, msgHash: Hex, publicKey: Hex, opts?: VerOpts) => boolean;
183
- ProjectivePoint: ProjConstructor<bigint>;
184
- Signature: SignatureConstructor;
185
- utils: {
186
- normPrivateKeyToScalar: (key: PrivKey) => bigint;
187
- isValidPrivateKey(privateKey: PrivKey): boolean;
188
- randomPrivateKey: () => Uint8Array;
189
- precompute: (windowSize?: number, point?: ProjPointType<bigint>) => ProjPointType<bigint>;
190
- };
191
- };
192
- export declare function weierstrass(curveDef: CurveType): CurveFn;
193
- export declare function SWUFpSqrtRatio<T>(Fp: mod.Field<T>, Z: T): (u: T, v: T) => {
194
- isValid: boolean;
195
- value: T;
196
- };
197
- export declare function mapToCurveSimpleSWU<T>(Fp: mod.Field<T>, opts: {
198
- A: T;
199
- B: T;
200
- Z: T;
201
- }): (u: T) => {
202
- x: T;
203
- y: T;
204
- };
1
+ /// <reference types="node" />
2
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3
+ import * as mod from './modular.js';
4
+ import * as ut from './utils.js';
5
+ import { CHash, Hex, PrivKey } from './utils.js';
6
+ import { Group, GroupConstructor, BasicCurve, AffinePoint } from './curve.js';
7
+ export type { AffinePoint };
8
+ declare type HmacFnSync = (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
9
+ declare type EndomorphismOpts = {
10
+ beta: bigint;
11
+ splitScalar: (k: bigint) => {
12
+ k1neg: boolean;
13
+ k1: bigint;
14
+ k2neg: boolean;
15
+ k2: bigint;
16
+ };
17
+ };
18
+ export declare type BasicWCurve<T> = BasicCurve<T> & {
19
+ a: T;
20
+ b: T;
21
+ allowedPrivateKeyLengths?: readonly number[];
22
+ wrapPrivateKey?: boolean;
23
+ endo?: EndomorphismOpts;
24
+ isTorsionFree?: (c: ProjConstructor<T>, point: ProjPointType<T>) => boolean;
25
+ clearCofactor?: (c: ProjConstructor<T>, point: ProjPointType<T>) => ProjPointType<T>;
26
+ };
27
+ declare type Entropy = Hex | true;
28
+ export declare type SignOpts = {
29
+ lowS?: boolean;
30
+ extraEntropy?: Entropy;
31
+ prehash?: boolean;
32
+ };
33
+ export declare type VerOpts = {
34
+ lowS?: boolean;
35
+ prehash?: boolean;
36
+ };
37
+ /**
38
+ * ### Design rationale for types
39
+ *
40
+ * * Interaction between classes from different curves should fail:
41
+ * `k256.Point.BASE.add(p256.Point.BASE)`
42
+ * * For this purpose we want to use `instanceof` operator, which is fast and works during runtime
43
+ * * Different calls of `curve()` would return different classes -
44
+ * `curve(params) !== curve(params)`: if somebody decided to monkey-patch their curve,
45
+ * it won't affect others
46
+ *
47
+ * TypeScript can't infer types for classes created inside a function. Classes is one instance of nominative types in TypeScript and interfaces only check for shape, so it's hard to create unique type for every function call.
48
+ *
49
+ * We can use generic types via some param, like curve opts, but that would:
50
+ * 1. Enable interaction between `curve(params)` and `curve(params)` (curves of same params)
51
+ * which is hard to debug.
52
+ * 2. Params can be generic and we can't enforce them to be constant value:
53
+ * if somebody creates curve from non-constant params,
54
+ * it would be allowed to interact with other curves with non-constant params
55
+ *
56
+ * TODO: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#unique-symbol
57
+ */
58
+ export interface ProjPointType<T> extends Group<ProjPointType<T>> {
59
+ readonly px: T;
60
+ readonly py: T;
61
+ readonly pz: T;
62
+ multiply(scalar: bigint): ProjPointType<T>;
63
+ toAffine(iz?: T): AffinePoint<T>;
64
+ isTorsionFree(): boolean;
65
+ clearCofactor(): ProjPointType<T>;
66
+ assertValidity(): void;
67
+ hasEvenY(): boolean;
68
+ toRawBytes(isCompressed?: boolean): Uint8Array;
69
+ toHex(isCompressed?: boolean): string;
70
+ multiplyUnsafe(scalar: bigint): ProjPointType<T>;
71
+ multiplyAndAddUnsafe(Q: ProjPointType<T>, a: bigint, b: bigint): ProjPointType<T> | undefined;
72
+ _setWindowSize(windowSize: number): void;
73
+ }
74
+ export interface ProjConstructor<T> extends GroupConstructor<ProjPointType<T>> {
75
+ new (x: T, y: T, z: T): ProjPointType<T>;
76
+ fromAffine(p: AffinePoint<T>): ProjPointType<T>;
77
+ fromHex(hex: Hex): ProjPointType<T>;
78
+ fromPrivateKey(privateKey: PrivKey): ProjPointType<T>;
79
+ normalizeZ(points: ProjPointType<T>[]): ProjPointType<T>[];
80
+ }
81
+ export declare type CurvePointsType<T> = BasicWCurve<T> & {
82
+ fromBytes: (bytes: Uint8Array) => AffinePoint<T>;
83
+ toBytes: (c: ProjConstructor<T>, point: ProjPointType<T>, compressed: boolean) => Uint8Array;
84
+ };
85
+ export declare type CurvePointsRes<T> = {
86
+ ProjectivePoint: ProjConstructor<T>;
87
+ normPrivateKeyToScalar: (key: PrivKey) => bigint;
88
+ weierstrassEquation: (x: T) => T;
89
+ isWithinCurveOrder: (num: bigint) => boolean;
90
+ };
91
+ export declare const DER: {
92
+ Err: {
93
+ new (m?: string): {
94
+ name: string;
95
+ message: string;
96
+ stack?: string;
97
+ };
98
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
99
+ prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any;
100
+ stackTraceLimit: number;
101
+ };
102
+ _parseInt(data: Uint8Array): {
103
+ d: bigint;
104
+ l: Uint8Array;
105
+ };
106
+ toSig(hex: string | Uint8Array): {
107
+ r: bigint;
108
+ s: bigint;
109
+ };
110
+ hexFromSig(sig: {
111
+ r: bigint;
112
+ s: bigint;
113
+ }): string;
114
+ };
115
+ export declare function weierstrassPoints<T>(opts: CurvePointsType<T>): {
116
+ ProjectivePoint: ProjConstructor<T>;
117
+ normPrivateKeyToScalar: (key: PrivKey) => bigint;
118
+ weierstrassEquation: (x: T) => T;
119
+ isWithinCurveOrder: (num: bigint) => boolean;
120
+ };
121
+ export interface SignatureType {
122
+ readonly r: bigint;
123
+ readonly s: bigint;
124
+ readonly recovery?: number;
125
+ assertValidity(): void;
126
+ addRecoveryBit(recovery: number): SignatureType;
127
+ hasHighS(): boolean;
128
+ normalizeS(): SignatureType;
129
+ recoverPublicKey(msgHash: Hex): ProjPointType<bigint>;
130
+ toCompactRawBytes(): Uint8Array;
131
+ toCompactHex(): string;
132
+ toDERRawBytes(isCompressed?: boolean): Uint8Array;
133
+ toDERHex(isCompressed?: boolean): string;
134
+ }
135
+ export declare type SignatureConstructor = {
136
+ new (r: bigint, s: bigint): SignatureType;
137
+ fromCompact(hex: Hex): SignatureType;
138
+ fromDER(hex: Hex): SignatureType;
139
+ };
140
+ declare type SignatureLike = {
141
+ r: bigint;
142
+ s: bigint;
143
+ };
144
+ export declare type PubKey = Hex | ProjPointType<bigint>;
145
+ export declare type CurveType = BasicWCurve<bigint> & {
146
+ hash: CHash;
147
+ hmac: HmacFnSync;
148
+ randomBytes: (bytesLength?: number) => Uint8Array;
149
+ lowS?: boolean;
150
+ bits2int?: (bytes: Uint8Array) => bigint;
151
+ bits2int_modN?: (bytes: Uint8Array) => bigint;
152
+ };
153
+ declare function validateOpts(curve: CurveType): Readonly<{
154
+ readonly nBitLength: number;
155
+ readonly nByteLength: number;
156
+ readonly Fp: mod.Field<bigint>;
157
+ readonly n: bigint;
158
+ readonly h: bigint;
159
+ readonly hEff?: bigint;
160
+ readonly Gx: bigint;
161
+ readonly Gy: bigint;
162
+ readonly allowInfinityPoint?: boolean;
163
+ readonly a: bigint;
164
+ readonly b: bigint;
165
+ readonly allowedPrivateKeyLengths?: readonly number[];
166
+ readonly wrapPrivateKey?: boolean;
167
+ readonly endo?: EndomorphismOpts;
168
+ readonly isTorsionFree?: (c: ProjConstructor<bigint>, point: ProjPointType<bigint>) => boolean;
169
+ readonly clearCofactor?: (c: ProjConstructor<bigint>, point: ProjPointType<bigint>) => ProjPointType<bigint>;
170
+ readonly hash: ut.CHash;
171
+ readonly hmac: HmacFnSync;
172
+ readonly randomBytes: (bytesLength?: number) => Uint8Array;
173
+ lowS: boolean;
174
+ readonly bits2int?: (bytes: Uint8Array) => bigint;
175
+ readonly bits2int_modN?: (bytes: Uint8Array) => bigint;
176
+ }>;
177
+ export declare type CurveFn = {
178
+ CURVE: ReturnType<typeof validateOpts>;
179
+ getPublicKey: (privateKey: PrivKey, isCompressed?: boolean) => Uint8Array;
180
+ getSharedSecret: (privateA: PrivKey, publicB: Hex, isCompressed?: boolean) => Uint8Array;
181
+ sign: (msgHash: Hex, privKey: PrivKey, opts?: SignOpts) => SignatureType;
182
+ verify: (signature: Hex | SignatureLike, msgHash: Hex, publicKey: Hex, opts?: VerOpts) => boolean;
183
+ ProjectivePoint: ProjConstructor<bigint>;
184
+ Signature: SignatureConstructor;
185
+ utils: {
186
+ normPrivateKeyToScalar: (key: PrivKey) => bigint;
187
+ isValidPrivateKey(privateKey: PrivKey): boolean;
188
+ randomPrivateKey: () => Uint8Array;
189
+ precompute: (windowSize?: number, point?: ProjPointType<bigint>) => ProjPointType<bigint>;
190
+ };
191
+ };
192
+ export declare function weierstrass(curveDef: CurveType): CurveFn;
193
+ export declare function SWUFpSqrtRatio<T>(Fp: mod.Field<T>, Z: T): (u: T, v: T) => {
194
+ isValid: boolean;
195
+ value: T;
196
+ };
197
+ export declare function mapToCurveSimpleSWU<T>(Fp: mod.Field<T>, opts: {
198
+ A: T;
199
+ B: T;
200
+ Z: T;
201
+ }): (u: T) => {
202
+ x: T;
203
+ y: T;
204
+ };
@@ -1,8 +1,8 @@
1
- declare const _default: string;
2
- export declare namespace formatters {
3
- function RFC1738(value: any): string;
4
- function RFC3986(value: any): any;
5
- }
6
- declare const RFC1738_1: string;
7
- declare const RFC3986_1: string;
8
- export { _default as default, RFC1738_1 as RFC1738, RFC3986_1 as RFC3986 };
1
+ declare const _default: string;
2
+ export declare namespace formatters {
3
+ function RFC1738(value: any): string;
4
+ function RFC3986(value: any): any;
5
+ }
6
+ declare const RFC1738_1: string;
7
+ declare const RFC3986_1: string;
8
+ export { _default as default, RFC1738_1 as RFC1738, RFC3986_1 as RFC3986 };
@@ -1,4 +1,4 @@
1
- import formats = require("./formats.cjs");
2
- import parse = require("./parse.cjs");
3
- import stringify = require("./stringify.cjs");
4
- export { formats, parse, stringify };
1
+ import formats = require("./formats.cjs");
2
+ import parse = require("./parse.cjs");
3
+ import stringify = require("./stringify.cjs");
4
+ export { formats, parse, stringify };
@@ -1,2 +1,2 @@
1
- declare function _exports(str: any, opts: any): any;
2
- export = _exports;
1
+ declare function _exports(str: any, opts: any): any;
2
+ export = _exports;
@@ -1,2 +1,2 @@
1
- declare function _exports(object: any, opts: any): string;
2
- export = _exports;
1
+ declare function _exports(object: any, opts: any): string;
2
+ export = _exports;