navio-blsct
    Preparing search index...

    Class Point

    Represents an element in the BLS12-381 G1 curve group. A wrapper of MclG1Pointin navio-core.

    Instantiating a Point object without a parameter returns a random point. Examples:

    const { Point, Scalar } = require('navio-blsct')
    const p1 = new Point() // random point
    const p2 = Point.random()
    const s = new Scalar()
    const p3 = Point.fromScalar(s)
    p3.isValid() // true
    const p4 = Point.base()
    const p5 = Point.base()
    p4.equals(p5) // true
    const p6 = Point.deserialize(p4.serialize())
    p6.equals(p4) // true
    const ser = p1.serialize()
    const deser = Point.deserialize(ser)
    ser === deser.serialize() // true

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    obj: any
    objSize: number

    Methods

    • Returns if the point is equal to the provided point.

      Parameters

      • other: Point

        The point to compare with.

      Returns boolean

      true if the points are equal, false otherwise.

    • Checks if the point is valid.

      Returns boolean

      true if the point is valid, false otherwise.

    • Returns the underlying C++ object, transferring ownership from this instance to the caller.

      Returns any

      The underlying object of the instance.

    • Serializes the instance to a hexadecimal string.

      Returns string

      A hexadecimal string representation of the instance.

    • Returns the size of the underlying C++ object.

      Returns number

      The size of the underlying C++ object in bytes.

    • Returns a string representation of the instance.

      Returns string

      A string representation of the instance.

    • Returnsthe underlying C++ object.

      Returns any

      The underlying C++ object.

    • Returns the base point of the BLS12-381 G1 curve.

      Returns Point

      The base point of the BLS12-381 G1 curve.

    • Deserializes a hexadecimal string into a Point instance.

      Parameters

      • this: new (obj: any) => Point
      • hex: string

        The hexadecimal string to convert.

      Returns Point

      The Point instance represented by the input string.

    • Constucts a new instance using the provided object.

      Type Parameters

      Parameters

      • this: new (obj: any, objSize?: number) => T
      • obj: any

        The object to use for the new instance.

      Returns T

      A new instance of the class.

    • Constructs a new instance using the provided object and size.

      Type Parameters

      Parameters

      • this: new (obj: any) => T
      • obj: any

        The object to use for the new instance.

      • objSize: number

        The size of the object.

      Returns T

      A new instance of the class.

    • Computes the product of the BLS12-381 G1 base point and the given scalar.

      Parameters

      • scalar: Scalar

        The scalar by which to multiply the base point.

      Returns Point

      The point on the BLS12-381 G1 curve obtained by multiplying the base point by the scalar.

    • Returns a random point. *

      Returns Point

      A random point on the BLS12-381 G1 curve.