FROST Ed25519 TypeScript Library - v0.2.2-alpha.3
    Preparing search index...

    Class Identifier<C>

    A FROST participant identifier.

    The identifier is a field element in the scalar field that the secret polynomial is defined over, corresponding to some x-coordinate for a polynomial f(x) = y. MUST NOT be zero in the field, as f(0) = the shared secret.

    Type Parameters

    Index

    Methods

    • Internal

      Create a new Identifier from a scalar. For internal use only.

      Type Parameters

      Parameters

      • ciphersuite: C

        The ciphersuite to use

      • scalar: Scalar<C>

        The scalar value

      Returns Identifier<C>

      The new Identifier

      If the scalar is zero

    • Internal

      Get the inner scalar.

      Returns Scalar<C>

      The underlying scalar value

    • Derive an Identifier from an arbitrary byte string.

      This feature is not part of the specification and is just a convenient way of creating identifiers.

      Each possible byte string will map to a uniformly random identifier.

      Type Parameters

      Parameters

      • ciphersuite: C

        The ciphersuite to use

      • bytes: Uint8Array

        The byte string to derive from

      Returns Identifier<C>

      The derived Identifier

      If the ciphersuite does not support identifier derivation, or if the mapped identifier is zero (which is unpredictable, but should happen with negligible probability).

    • Serialize the identifier using the ciphersuite encoding.

      Returns Uint8Array

      The serialized identifier as bytes

    • Deserialize an Identifier from a serialized buffer.

      Type Parameters

      Parameters

      • ciphersuite: C

        The ciphersuite to use for deserialization

      • bytes: Uint8Array

        The serialized bytes

      Returns Identifier<C>

      The deserialized Identifier

      If deserialization fails or the scalar is zero

    • Create an Identifier from a 16-bit unsigned integer.

      Uses the classic left-to-right double-and-add algorithm that skips the first bit 1 (since identifiers are never zero, there is always a bit 1), thus sum starts with 1 too.

      Type Parameters

      Parameters

      • ciphersuite: C

        The ciphersuite to use

      • n: number

        The unsigned 16-bit integer (must not be zero)

      Returns Identifier<C>

      The new Identifier

      If n is zero

    • Check equality with another Identifier.

      Parameters

      • other: Identifier<C>

        The other Identifier to compare with

      Returns boolean

      True if the identifiers are equal

    • Compare this Identifier with another for ordering.

      The comparison is done by serializing both scalars in little-endian order and comparing them lexicographically in big-endian (reversed).

      Parameters

      • other: Identifier<C>

        The other Identifier to compare with

      Returns -1 | 0 | 1

      -1 if this < other, 0 if equal, 1 if this > other

    • Compute a hash code for the Identifier.

      Returns number

      A numeric hash code

    • Convert to a debug string representation.

      Returns string

      A debug string in the format "Identifier(hex)"

    • Clone this Identifier.

      Returns Identifier<C>

      A new Identifier with the same scalar value