UNPKG

libnexa-ts

Version:

A pure and powerful Nexa SDK library.

70 lines 2.24 kB
import { default as BN } from '../crypto/bn.extension'; import { curve, BNInput } from 'elliptic'; export default class Point { private static readonly ec; ecPoint: curve.short.ShortPoint; private static _g; constructor(point: curve.short.ShortPoint, skipValidation?: boolean); /** * Will return the X coordinate of the Point * * @returns A BN instance of the X coordinate */ getX(): BN; /** * Will return the Y coordinate of the Point * * @returns A BN instance of the Y coordinate */ getY(): BN; add(p: Point): Point; mul(k: BN): Point; mulAdd(k1: BN, p2: Point, k2: BN): Point; eq(p: Point): boolean; /** * Will determine if the point is valid * * @see {@link https://www.iacr.org/archive/pkc2003/25670211/25670211.pdf} * @throws A validation error if exists * @returns An instance of the same Point */ validate(): this; hasSquare(): boolean; private static isSquare; /** * Instantiate a valid secp256k1 Point from the X and Y coordinates. * * @param x - The X coordinate * @param y - The Y coordinate * @see {@link https://github.com/indutny/elliptic} * @throws A validation error if exists */ static ecPoint(x: BNInput, y: BNInput, isRed?: boolean): Point; /** * * Instantiate a valid secp256k1 Point from only the X coordinate * * @param odd - If the Y coordinate is odd * @param x - The X coordinate * @throws A validation error if exists */ static ecPointFromX(odd: boolean, x: BNInput): Point; /** * * Will return a secp256k1 ECDSA base point. * * @see {@link https://en.bitcoin.it/wiki/Secp256k1} * @returns An instance of the base point. */ static getG(): Point; /** * * Will return the max of range of valid private keys as governed by the secp256k1 ECDSA standard. * * @see {@link https://en.bitcoin.it/wiki/Private_key#Range_of_valid_ECDSA_private_keys} * @returns A BN instance of the number of points on the curve */ static getN(): BN; static pointToCompressed(point: Point): Uint8Array; } //# sourceMappingURL=point.d.ts.map