navio-blsct
    Preparing search index...

    Class Signature

    Represents the signature of a transaction.

    Examples:

    const { PublicKey, Scalar, Signature } = require('navio-blsct')
    const sk = Scalar.random()
    const pk = PublicKey.fromScalar(sk)
    const sig = Signature.generate(sk, 'navio')
    sig.verify(pk, 'navio')
    const ser = sig.serialize()
    const deser = Signature.deserialize(ser)
    ser === deser.serialize() // true

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    obj: any
    objSize: number

    Methods

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

    • Verifies the signature against a public key and message.

      Parameters

      • pubKey: PublicKey

        The public key used to verify the signature.

      • msg: string

        The message that was signed.

      Returns boolean

      true if the signature is valid for the given public key and message, otherwise false.

    • Serializes the signature to a hexadecimal string.

      Parameters

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

        The hexadecimal string to serialize.

      Returns Signature

      A hexadecimal string representation of the signature.

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

    • Generates a new Signature instance.

      Parameters

      • privKey: Scalar

        The private key used to sign the message.

      • msg: string

        The message to be signed.

      Returns Signature

      A new Signature instance containing the signature of the message.