DefinitelyTyped/types/ecurve/index.d.ts
2017-03-24 14:27:52 -07:00

42 lines
1.3 KiB
TypeScript

// Type definitions for ecurve 1.0
// Project: https://github.com/cryptocoinjs/ecurve#readme
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types= "node" />
import BigInteger = require('bigi');
export class Curve {
p: BigInteger;
a: BigInteger;
b: BigInteger;
G: Point;
n: BigInteger;
h: BigInteger;
constructor(p: BigInteger, a: BigInteger, b: BigInteger, Gx: BigInteger, Gy: BigInteger, n: BigInteger, h: BigInteger);
isInfinity(Q: any): boolean;
isOnCurve(Q: any): boolean;
pointFromX(isOdd: boolean, x: Point): Point;
validate(Q: any): boolean;
}
export class Point {
x: BigInteger;
y: BigInteger;
z: BigInteger;
affineX: BigInteger;
affineY: BigInteger;
constructor(curve: Curve, x: BigInteger, y: BigInteger, z: BigInteger);
add(b: Point): Point;
equals(other: Point): boolean;
getEncoded(compressed?: boolean): Buffer;
multiply(k: any): Point;
multiplyTwo(j: any, x: any, k: any): Point;
negate(): Point;
toString(): string;
twice(): Point;
static decodeFrom(curve: Curve, buffer: Buffer): any;
static fromAffine(curve: Curve, x: BigInteger, y: BigInteger): Point;
}
export function getCurveByName(name: string): Curve;