UNPKG

1.38 kBTypeScriptView Raw
1// Type definitions for ecurve 1.0
2// Project: https://github.com/cryptocoinjs/ecurve#readme
3// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
6/// <reference types= "node" />
7
8import BigInteger = require('bigi');
9
10export class Curve {
11 p: BigInteger;
12 a: BigInteger;
13 b: BigInteger;
14 G: Point;
15 n: BigInteger;
16 h: BigInteger;
17 constructor(p: BigInteger, a: BigInteger, b: BigInteger, Gx: BigInteger, Gy: BigInteger, n: BigInteger, h: BigInteger);
18 isInfinity(Q: any): boolean;
19 isOnCurve(Q: any): boolean;
20 pointFromX(isOdd: boolean, x: Point): Point;
21 validate(Q: any): boolean;
22}
23export class Point {
24 x: BigInteger;
25 y: BigInteger;
26 z: BigInteger;
27 affineX: BigInteger;
28 affineY: BigInteger;
29 constructor(curve: Curve, x: BigInteger, y: BigInteger, z: BigInteger);
30 add(b: Point): Point;
31 equals(other: Point): boolean;
32 getEncoded(compressed?: boolean): Buffer;
33 multiply(k: any): Point;
34 multiplyTwo(j: any, x: any, k: any): Point;
35 negate(): Point;
36 toString(): string;
37 twice(): Point;
38 static decodeFrom(curve: Curve, buffer: Buffer): any;
39 static fromAffine(curve: Curve, x: BigInteger, y: BigInteger): Point;
40}
41export function getCurveByName(name: string): Curve;