1
1
/**
2
- * secp256k1 curve parameters. Equation is x³ + ax + b.
2
+ * secp256k1 curve parameters. Equation is x³ + ax + b, but a=0 - which makes it x³+b .
3
3
* Gx and Gy are generator coordinates. p is field order, n is group order.
4
4
*/
5
5
declare const CURVE : {
@@ -32,22 +32,14 @@ export interface AffinePoint {
32
32
}
33
33
/** Point in 3d xyz projective coordinates. 3d takes less inversions than 2d. */
34
34
declare class Point {
35
+ static BASE : Point ;
36
+ static ZERO : Point ;
35
37
readonly px : bigint ;
36
38
readonly py : bigint ;
37
39
readonly pz : bigint ;
38
40
constructor ( px : bigint , py : bigint , pz : bigint ) ;
39
- /** Generator / base point */
40
- static readonly BASE : Point ;
41
- /** Identity / zero point */
42
- static readonly ZERO : Point ;
43
- /** Create 3d xyz point from 2d xy. (0, 0) => (0, 1, 0), not (0, 0, 1) */
44
- static fromAffine ( p : AffinePoint ) : Point ;
45
41
/** Convert Uint8Array or hex string to Point. */
46
- static fromHex ( hex : Hex ) : Point ;
47
- /** Create point from a private key. */
48
- static fromPrivateKey ( k : PrivKey ) : Point ;
49
- get x ( ) : bigint ;
50
- get y ( ) : bigint ;
42
+ static fromBytes ( bytes : Bytes ) : Point ;
51
43
/** Equality check: compare points P&Q. */
52
44
equals ( other : Point ) : boolean ;
53
45
/** Flip point over y coordinate. */
@@ -61,16 +53,22 @@ declare class Point {
61
53
*/
62
54
add ( other : Point ) : Point ;
63
55
mul ( n : bigint , safe ?: boolean ) : Point ;
64
- mulAddQUns ( R : Point , u1 : bigint , u2 : bigint ) : Point ;
65
56
/** Convert point to 2d xy affine point. (x, y, z) ∋ (x=x/z, y=y/z) */
66
- toAffine ( ) : AffinePoint ;
67
- /** Checks if the point is valid and on-curve. */
68
- assertValidity ( ) : Point ;
69
- multiply ( n : bigint ) : Point ;
70
57
aff ( ) : AffinePoint ;
58
+ /** Checks if the point is valid and on-curve. */
71
59
ok ( ) : Point ;
60
+ toBytes ( isCompressed ?: boolean ) : Bytes ;
61
+ /** Create 3d xyz point from 2d xy. (0, 0) => (0, 1, 0), not (0, 0, 1) */
62
+ static fromAffine ( p : AffinePoint ) : Point ;
63
+ static fromPrivateKey ( k : PrivKey ) : Point ;
64
+ static fromHex ( hex : Hex ) : Point ;
65
+ get x ( ) : bigint ;
66
+ get y ( ) : bigint ;
67
+ multiply ( n : bigint ) : Point ;
68
+ toAffine ( ) : AffinePoint ;
72
69
toHex ( isCompressed ?: boolean ) : string ;
73
- toRawBytes ( isCompressed ?: boolean ) : Bytes ;
70
+ toRawBytes ( c ?: boolean ) : Bytes ;
71
+ assertValidity ( ) : Point ;
74
72
}
75
73
/** Creates 33/65-byte public key from 32-byte private key. */
76
74
declare const getPublicKey : ( privKey : PrivKey , isCompressed ?: boolean ) => Bytes ;
0 commit comments