Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "tss/tss"

Index

Variables

HASH_ID_NULL

HASH_ID_NULL: 0 = 0

HASH_ID_SHA1

HASH_ID_SHA1: 1 = 1

HASH_ID_SHA256

HASH_ID_SHA256: 2 = 2

HASH_ID_VENDOR_MIN

HASH_ID_VENDOR_MIN: 128 = 128

IDENTIFIER_LENGTH

IDENTIFIER_LENGTH: 16 = 16

MAX_SECRET_LENGTH

MAX_SECRET_LENGTH: 65534 = 65534

MAX_SHARES

MAX_SHARES: 255 = 255

Functions

combine

  • combine(shares: Uint8Array[], customHash?: object, 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: object
    • Optional customHashId: number

    Returns Uint8Array

combineRaw

  • 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[]
    • Default value threshold: number = shares.length

    Returns Uint8Array

readIdentifier

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

    Parameters

    • share: Uint8Array

    Returns Uint8Array

readThreshold

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

    Parameters

    • share: Uint8Array

    Returns number

split

  • split(secret: Uint8Array, threshold: number, totalShares: number, identifier?: Uint8Array, hash?: object | null, 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
    • Default value identifier: Uint8Array = new Uint8Array(IDENTIFIER_LENGTH)
    • Default value hash: object | null = SHA256
    • Default value hashId: number = hash ? HASH_ID_SHA256 : HASH_ID_NULL
    • Optional prng: RandomSource

    Returns Uint8Array[]

splitRaw

  • 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