RAILGUN Reloaded
    Preparing search index...

    Trusted-dealer and coordinator-less DKG primitive helpers for Baby Jubjub FROST.

    This class exposes the math and encrypted-share transport helpers used by DKGManager, but does not enforce end-to-end protocol sequencing itself.

    Hierarchy

    • RailJubCurvePoint
      • TrustedDKG
    Index
    • Returns bigint

    • Returns the subgroup order used by the FROST and DKG primitives.

      Returns any

      The Baby Jubjub subgroup order.

    • Returns the additive identity for the Baby Jubjub subgroup.

      Returns Point<bigint>

      The affine identity point.

    • Samples a scalar uniformly from the subgroup order.

      Parameters

      • rejectionSampling: boolean = true

        When true, uses rejection sampling to avoid bias.

      Returns bigint

      A uniformly sampled scalar.

    • Multiplies the subgroup generator by a scalar.

      Parameters

      • k: bigint

        Scalar multiplier.

      Returns Point<bigint>

      The resulting affine point.

    • Multiplies an affine point by a scalar.

      Parameters

      • A: Point<bigint>

        Affine point.

      • k: bigint

        Scalar multiplier.

      Returns Point<bigint>

      The resulting affine point.

    • Serializes an affine subgroup point using RFC 8032-style compression.

      Parameters

      • A: Point<bigint>

        Affine point to serialize.

      Returns Uint8Array

      The compressed 32-byte point encoding.

    • Deserializes a compressed point and verifies subgroup membership.

      Parameters

      • buf: Uint8Array

        Compressed point bytes.

      Returns Point<bigint>

      The decoded affine point.

    • Serializes a scalar into the canonical 32-byte form expected by the repo.

      Parameters

      • s: bigint

        Scalar to serialize.

      Returns Uint8Array

      The serialized scalar bytes.

    • Deserializes a scalar from the canonical 32-byte form.

      Parameters

      • buf: Uint8Array

        Serialized scalar bytes.

      Returns bigint

      The decoded scalar.

    • Compares two affine points for coordinate equality.

      Parameters

      • a: Point<bigint>

        First affine point.

      • b: Point<bigint>

        Second affine point.

      Returns boolean

      true when both coordinates match.

    • Converts a scalar into the repo's canonical 32-byte little-endian form.

      Parameters

      • a: bigint

        Scalar to encode.

      Returns Uint8Array<ArrayBufferLike>

      Encoded bytes.

    • Decodes a scalar from the repo's canonical 32-byte little-endian form.

      Parameters

      • a: Uint8Array

        Encoded bytes.

      Returns bigint

      The decoded scalar.

    • Reduces a bigint modulo the full curve order.

      Parameters

      • x: bigint

        Value to reduce.

      Returns any

      The reduced scalar.

    • Reduces a bigint modulo the prime-order subgroup.

      Parameters

      • x: bigint

        Value to reduce.

      Returns any

      The reduced scalar.

    • Computes a multiplicative inverse in the subgroup field.

      Parameters

      • a: bigint

        Scalar to invert.

      Returns bigint

      The multiplicative inverse modulo the subgroup order.

    • Applies EdDSA bit pruning to a 32-byte buffer.

      Parameters

      • buff: Uint8Array

        Input bytes.

      Returns Uint8Array<ArrayBuffer>

      The pruned buffer.

    • Derives the Baby Jubjub secret scalar for the provided private key.

      Parameters

      • prv: Uint8Array

        Private key bytes.

      Returns bigint

      The derived subgroup scalar divided by the cofactor.

    • Maps an Edwards point into Montgomery coordinates when the mapping exists.

      Parameters

      • ed: { x: bigint; y: bigint }

        Edwards affine point.

        • x: bigint

          Edwards x-coordinate.

        • y: bigint

          Edwards y-coordinate.

      Returns { u: bigint; v: bigint }

      The mapped Montgomery coordinates.

    • Evaluates the sharing polynomial for a participant identifier.

      Parameters

      • x: bigint

        Participant identifier.

      • coefficients: bigint[]

        Polynomial coefficients in ascending order.

      Returns any

      The polynomial value modulo the subgroup order.

    • Generates trusted-dealer coefficients, shares, and commitments.

      Parameters

      • secretKey: bigint

        Dealer secret used as the constant term, which is the polynomial's base value.

      • MAX_PARTICIPANTS: number

        Total number of participant shares to generate.

      • MIN_PARTICIPANTS: number

        Threshold required for reconstruction or signing.

      Returns {
          participantPrivateKeys: { x_i: number; y_i: bigint }[];
          coefficients: bigint[];
          base: any;
          vssCommitment: any[];
      }

      Dealer shares, polynomial coefficients, and public commitments.

    • Computes Baby Jubjub commitments for each polynomial coefficient.

      Parameters

      • coefficients: bigint[]

        Polynomial coefficients in ascending order.

      Returns any[]

      The per-coefficient public commitments.

    • Verifies a single Feldman VSS share against a dealer's commitments.

      Parameters

      • share_i: { i: bigint; sk_i: bigint }

        Participant share input.

        • i: bigint

          Participant identifier.

        • sk_i: bigint

          Share scalar for that participant.

      • vssCommitment: Point<bigint>[]

        Dealer commitment vector.

      • _MIN_PARTICIPANTS: number

        Threshold parameter kept for compatibility.

      Returns boolean

      true when the share matches the commitment vector.

    • Splits a secret into per-participant shares using the supplied coefficients.

      Parameters

      • s: bigint

        Secret used as the constant term, which is the polynomial's base value.

      • coefficients: bigint[]

        Additional polynomial coefficients.

      • MAX_PARTICIPANTS: number

        Total number of shares to derive.

      Returns { secretKeyShares: { x_i: number; y_i: bigint }[]; coefficients: bigint[] }

      The derived shares and the full coefficient list including s.

    • Derives the group public key, participant public keys, and viewing key.

      Parameters

      • MAX_PARTICIPANTS: number

        Total number of participants.

      • MIN_PARTICIPANTS: number

        Threshold used to evaluate participant public keys.

      • vssCommitment: Point<bigint>[]

        Dealer commitment vector.

      Returns {
          PK: Point<bigint>;
          participantPublicKeys: any[];
          viewingPrivateKey: Uint8Array<ArrayBuffer>;
      }

      Derived group metadata for the trusted-dealer flow.

    • Validates that recipient identifiers are strictly increasing positive integers.

      Parameters

      • ids: number[]

        Recipient identifier list to validate.

      Returns void

    • Parameters

      • coefficients: bigint[]
      • recipientIds: number[]

      Returns Record<number, bigint>

    • Combines every dealer's constant commitment into the group public key.

      Parameters

      • allDealerCommitments: Point<bigint>[][]

        Commitment vectors from every dealer.

      Returns Point<bigint>

      The aggregate group public key.

    • Verifies that every dealer commitment lives in the expected subgroup.

      Parameters

      • allDealerCommitments: Point<bigint>[][]

        Commitment vectors from every dealer.

      Returns boolean

      true when all commitments live in the expected subgroup.

    • Verifies a finalized participant share against a dealer's commitments.

      Parameters

      • id: number

        Participant identifier.

      • sk_i: bigint

        Share scalar for that participant.

      • commitments: Point<bigint>[]

        Dealer commitment vector.

      Returns boolean

      true when the share matches the commitments.

    • Computes the Lagrange coefficient for a participant identifier at zero.

      Parameters

      • ids: bigint[]

        Participant identifiers in the reconstruction subset.

      • x_i: bigint

        Identifier to evaluate.

      Returns bigint

      The interpolation coefficient reduced modulo the subgroup order.

    • Reconstructs the polynomial constant from a threshold subset of shares.

      Parameters

      • subset: { id: number; s_i: bigint }[]

        Threshold subset of participant shares.

      Returns bigint

      The reconstructed constant term.

    • Derives a deterministic viewing key from the set of dealer commitments.

      By design this is a pure function of the (broadcast) dealer commitments, so every participant independently derives the same viewing key without any extra exchange. This is intentional: each share-holder must load the same shareable viewing key into the engine to have view access to the funds the group controls. Consequently this value is NOT secret against anyone who observes the dealer commitments — its confidentiality relies on those commitments not leaking outside the participant set, not on per-participant secret entropy.

      Parameters

      • allDealerCommitments: Point<bigint>[][]

        Commitment vectors from every dealer.

      Returns Uint8Array

      The derived 32-byte shared viewing private key.

    • Finalizes a participant's aggregate signing share from all dealer shares.

      Parameters

      • participantId: number

        Participant identifier.

      • s_ki_byDealer: { dealerId: number; s_ki: bigint }[]

        Share contribution from every dealer.

      • allDealerCommitments: Point<bigint>[][]

        Commitment vectors from every dealer.

      Returns {
          share: { id: number; skShare: bigint; skShareDiv8: bigint };
          PKGroup: Point<bigint>;
          viewingPrivateKey: Uint8Array;
      }

      The finalized participant share, group public key, and viewing key.

    • Computes the canonical digest of the full dealer-commitment set.

      Parameters

      • allDealerCommitments: Point<bigint>[][]

        Commitment vectors from every dealer.

      Returns bigint

      Digest used as AAD when encrypting and decrypting shares.

    • Encrypts each dealer share for its intended recipient with AES-GCM + AAD.

      Parameters

      • shares: Record<number, bigint>

        Map of recipient id to share scalar.

      • keyById: Record<number, Uint8Array>

        Map of recipient id to derived shared secret.

      • allDealerCommitments: Point<bigint>[][]

        Commitment vectors from every dealer.

      Returns Record<number, EncryptedShare>

      A map of recipient id to encrypted share payload.

    • Decrypts a single encrypted share for the specified participant.

      Parameters

      • enc: EncryptedShare

        Encrypted share payload.

      • keyBytes: Uint8Array

        AES-GCM key bytes.

      • participantId: number

        Recipient participant identifier.

      • allDealerCommitments: Point<bigint>[][]

        Commitment vectors from every dealer.

      Returns bigint

      The decrypted share scalar.

    curveOrder: any = order
    generator: any = Base8
    Fr: any = FrValue
    order: any = subOrder
    identity: Point<bigint> = ...
    fieldPrime: any = r
    blake512: (msg: Input, opts?: Object) => Uint8Array = blake512
    contextString: "FROST-EDBABYJUJUB-BLAKE512-v1" = 'FROST-EDBABYJUJUB-BLAKE512-v1'
    hasher: RFC9591Hasher