Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @stablelib/tss

Index

Variables

HASH_ID_NULL: 0 = 0
HASH_ID_SHA1: 1 = 1
HASH_ID_SHA256: 2 = 2
HASH_ID_VENDOR_MIN: 128 = 128
IDENTIFIER_LENGTH: 16 = 16
MAX_SECRET_LENGTH: 65534 = 65534
MAX_SHARES: 255 = 255

Functions

  • combine(shares: Uint8Array[], customHash?: new () => Hash, customHashId?: number): Uint8Array
  • Combines robust shares to restore the original secret. The number of shares must be equal to or greater than threshold.

    If a custom hash was used when creating shares, it must be passed as an argument along with the hash identifier.

    Parameters

    • shares: Uint8Array[]
    • Optional customHash: new () => Hash
        • new (): Hash
        • Returns Hash

    • Optional customHashId: number

    Returns Uint8Array

  • combineRaw(shares: Uint8Array[], threshold?: number): Uint8Array
  • Combine raw shares to restore the original secret.

    The number of shares must be equal to or greater than threshold, which must also be passed as an argument.

    Parameters

    • shares: Uint8Array[]
    • threshold: number = shares.length

    Returns Uint8Array

  • readIdentifier(share: Uint8Array): Uint8Array
  • Returns copy of identifier from robust share.

    Parameters

    • share: Uint8Array

    Returns Uint8Array

  • readThreshold(share: Uint8Array): number
  • Returns threshold specified when creating this robust share.

    Parameters

    • share: Uint8Array

    Returns number

  • split(secret: Uint8Array, threshold: number, totalShares: number, identifier?: Uint8Array, hash?: null | (new () => Hash), hashId?: number, prng?: RandomSource): Uint8Array[]
  • Split secret into the given number of robust shares, threshold number of which can be used with combine() to recover it.

    Identifier is an arbitrary 16 bytes used to describe and identify shares, which will be appended to shares and can be read with readIdentifier().

    The default hash function used to verify correctness of restored secret is SHA-256. To use another function, pass its constructor and identifier. Pass null as hash function to avoid hashing secret.

    Parameters

    • secret: Uint8Array
    • threshold: number
    • totalShares: number
    • identifier: Uint8Array = ...
    • hash: null | (new () => Hash) = SHA256
    • hashId: number = ...
    • Optional prng: RandomSource

    Returns Uint8Array[]

  • splitRaw(secret: Uint8Array, threshold: number, totalShares: number, prng?: RandomSource): Uint8Array[]
  • Split secret into the given number of raw shares, threshold number of which can be used with combineRaw() to recover it.

    It is recommended to use split(), which produces robust shares with identifier and hash of secret.

    Parameters

    • secret: Uint8Array
    • threshold: number
    • totalShares: number
    • Optional prng: RandomSource

    Returns Uint8Array[]

Generated using TypeDoc