navio-blsct
    Preparing search index...

    Class PublicKey

    Represents an element in the BLS12-381 G1 curve group that is used as a public key.

    Examples:

    const { PublicKey, Point, Scalar, ViewKey } = require('navio-blsct')
    const s123 = new Scalar(123)
    const pk123 = PublicKey.fromScalar(s123)
    const s234 = new Scalar(234)
    const pk234 = PublicKey.fromScalar(s234)
    pk123.equals(pk234) // false
    pk123.equals(pk123) // true
    const p = Point.random()
    const pk = PublicKey.fromPoint(p)
    pk.getPoint()
    const vk = new ViewKey()
    PublicKey.generateNonce(pk, vk)
    const ser = pk.serialize()
    const deser = PublicKey.deserialize(ser)
    ser == deser.serialize()

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    obj: any
    objSize: number

    Methods

    • Returns if the provied public key is equal to this public key.

      Parameters

      • other: PublicKey

        The public key to compare with.

      Returns boolean

      true if the public keys are equal, false otherwise.

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

      Returns any

      The underlying object 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.

    • Deserializes a hexadecimal string into a PublicKey instance.

      Parameters

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

        The hexadecimal string to convert.

      Returns PublicKey

      The PublicKey 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.