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

    Interface WeierstrassPoint<T>

    Projective XYZ point used by short Weierstrass curves.

    interface WeierstrassPoint<T> {
        X: T;
        Y: T;
        Z: T;
        get x(): T;
        get y(): T;
        add(other: WeierstrassPoint): WeierstrassPoint;
        assertValidity(): void;
        clearCofactor(): WeierstrassPoint;
        double(): WeierstrassPoint;
        equals(other: WeierstrassPoint): boolean;
        is0(): boolean;
        isSmallOrder(): boolean;
        isTorsionFree(): boolean;
        multiply(scalar: bigint): WeierstrassPoint;
        multiplyUnsafe(scalar: bigint): WeierstrassPoint;
        negate(): WeierstrassPoint;
        precompute(windowSize?: number, isLazy?: boolean): WeierstrassPoint;
        subtract(other: WeierstrassPoint): WeierstrassPoint;
        toAffine(invertedZ?: T): AffinePoint<T>;
        toBytes(
            isCompressed?: boolean,
        ): Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>;
        toHex(isCompressed?: boolean): string;
    }

    Type Parameters

    • T

    Hierarchy (View Summary)

    Index

    Accessors

    • get x(): T

      affine x coordinate. Different from projective X.

      Returns T

    • get y(): T

      affine y coordinate. Different from projective Y.

      Returns T

    Methods

    • 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 WeierstrassPoint

      Prime-order point.

    • Compare two points for equality.

      Parameters

      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 WeierstrassPoint

      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 WeierstrassPoint

      Product 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 WeierstrassPoint

      Same point instance with precompute tables attached.

    • Converts point to 2D xy affine coordinates.

      Parameters

      • OptionalinvertedZ: T

        Optional inverted Z coordinate for batch normalization.

      Returns AffinePoint<T>

      Affine x/y coordinates.

    • Encode the point into compressed or uncompressed SEC1 bytes.

      Parameters

      • OptionalisCompressed: boolean

        Whether to use the compressed form.

      Returns Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>

      Encoded point bytes.

    • Encode the point into compressed or uncompressed SEC1 hex.

      Parameters

      • OptionalisCompressed: boolean

        Whether to use the compressed form.

      Returns string

      Encoded point hex.

    Properties

    X: T

    projective X coordinate. Different from affine x.

    Y: T

    projective Y coordinate. Different from affine y.

    Z: T

    projective z coordinate