Skip to content

ThresholdViewingKey

SIP Protocol API Reference v0.7.0


SIP Protocol API Reference / ThresholdViewingKey

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:7273

Threshold Viewing Key implementation using Shamir’s Secret Sharing

Allows splitting a viewing key into N-of-M shares where any N shares can reconstruct the original key, but fewer than N shares reveal nothing.

new ThresholdViewingKey(): ThresholdViewingKey

ThresholdViewingKey

static create(params): ThresholdShares

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:7290

Create threshold shares from a viewing key

Configuration parameters

number

number

`0x${string}`

ThresholdShares

Threshold shares with commitment

ValidationError if parameters are invalid

const threshold = ThresholdViewingKey.create({
threshold: 3,
totalShares: 5,
viewingKey: '0xabc123...',
})

static reconstruct(shares): `0x${string}`

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:7311

Reconstruct viewing key from threshold shares

string[]

Array of encoded shares (must be >= threshold)

`0x${string}`

Reconstructed viewing key

ValidationError if insufficient or invalid shares

const viewingKey = ThresholdViewingKey.reconstruct([
'share1',
'share2',
'share3',
])

static verifyShare(share, expectedCommitment): boolean

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:7327

Verify a share without revealing the viewing key

string

Encoded share to verify

string

Expected commitment hash

boolean

True if share is valid

const isValid = ThresholdViewingKey.verifyShare(
'share1',
'commitment_hash'
)