@aptos-labs/ts-sdk - v7.1.0
    Preparing search index...

    Interface CurvePoint<F, P>

    Base interface for all elliptic-curve point instances.

    interface CurvePoint<F, P extends CurvePoint<F, P>> {
        x: F;
        y: F;
        Z?: F;
        add(other: P): P;
        assertValidity(): void;
        clearCofactor(): P;
        double(): P;
        equals(other: P): boolean;
        is0(): boolean;
        isSmallOrder(): boolean;
        isTorsionFree(): boolean;
        multiply(scalar: bigint): P;
        multiplyUnsafe(scalar: bigint): P;
        negate(): P;
        precompute(windowSize?: number, isLazy?: boolean): P;
        subtract(other: P): P;
        toAffine(invertedZ?: F): AffinePoint<F>;
        toBytes(): Uint8Array;
        toHex(): string;
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Methods

    • Add another point from the same curve.

      Parameters

      • other: P

        Point to add.

      Returns P

      Sum point.

    • Assert that the point satisfies the curve equation and subgroup checks.

      Returns void

    • Map the point into the prime-order subgroup when the curve requires it.

      Returns P

      Prime-order point.

    • Double the point.

      Returns P

      Doubled point.

    • Compare two points for equality.

      Parameters

      • other: P

        Point to compare.

      Returns boolean

      Whether the points are equal.

    • Check whether the point is the point at infinity.

      Returns boolean

      Whether the point is zero.

    • Check whether the point lies in a small torsion subgroup.

      Returns boolean

      Whether the point has small order.

    • Check whether the point belongs to the prime-order subgroup.

      Returns boolean

      Whether the point is torsion-free.

    • Multiply the point by a scalar in constant time. Implementations keep the subgroup-scalar contract strict and may reject 0 instead of returning the identity point.

      Parameters

      • scalar: bigint

        Scalar multiplier.

      Returns P

      Product point.

    • Multiply the point by a scalar without constant-time guarantees. Public-scalar callers that need 0 should use this method instead of relying on multiply(...) to return the identity point.

      Parameters

      • scalar: bigint

        Scalar multiplier.

      Returns P

      Product point.

    • Negate the point.

      Returns P

      Negated point.

    • Massively speeds up p.multiply(n) by using precompute tables (caching). See wNAF. Cache state lives in internal WeakMaps keyed by point identity, not on the point object. Repeating precompute(...) for the same point identity replaces the remembered window size and forces table regeneration for that point.

      Parameters

      • OptionalwindowSize: number

        Precompute window size.

      • OptionalisLazy: boolean

        calculate cache now. Default (true) ensures it's deferred to first multiply()

      Returns P

      Same point instance with precompute tables attached.

    • Subtract another point from the same curve.

      Parameters

      • other: P

        Point to subtract.

      Returns P

      Difference point.

    • Converts point to 2D xy affine coordinates.

      Parameters

      • OptionalinvertedZ: F

        Optional inverted Z coordinate for batch normalization.

      Returns AffinePoint<F>

      Affine x/y coordinates.

    • Encode the point into the curve's canonical byte form.

      Returns Uint8Array

      Encoded point bytes.

    • Encode the point into the curve's canonical hex form.

      Returns string

      Encoded point hex.

    Properties

    x: F

    Affine x coordinate. Different from projective / extended X coordinate.

    y: F

    Affine y coordinate. Different from projective / extended Y coordinate.

    Z?: F

    Projective Z coordinate when the point keeps projective state.