ThresholdViewingKey
SIP Protocol API Reference v0.7.0
SIP Protocol API Reference / ThresholdViewingKey
Class: ThresholdViewingKey
Section titled “Class: 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.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ThresholdViewingKey():
ThresholdViewingKey
Returns
Section titled “Returns”ThresholdViewingKey
Methods
Section titled “Methods”create()
Section titled “create()”
staticcreate(params):ThresholdShares
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:7290
Create threshold shares from a viewing key
Parameters
Section titled “Parameters”params
Section titled “params”Configuration parameters
threshold
Section titled “threshold”number
totalShares
Section titled “totalShares”number
viewingKey
Section titled “viewingKey”`0x${string}`
Returns
Section titled “Returns”Threshold shares with commitment
Throws
Section titled “Throws”ValidationError if parameters are invalid
Example
Section titled “Example”const threshold = ThresholdViewingKey.create({ threshold: 3, totalShares: 5, viewingKey: '0xabc123...',})reconstruct()
Section titled “reconstruct()”
staticreconstruct(shares):`0x${string}`
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:7311
Reconstruct viewing key from threshold shares
Parameters
Section titled “Parameters”shares
Section titled “shares”string[]
Array of encoded shares (must be >= threshold)
Returns
Section titled “Returns”`0x${string}`
Reconstructed viewing key
Throws
Section titled “Throws”ValidationError if insufficient or invalid shares
Example
Section titled “Example”const viewingKey = ThresholdViewingKey.reconstruct([ 'share1', 'share2', 'share3',])verifyShare()
Section titled “verifyShare()”
staticverifyShare(share,expectedCommitment):boolean
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:7327
Verify a share without revealing the viewing key
Parameters
Section titled “Parameters”string
Encoded share to verify
expectedCommitment
Section titled “expectedCommitment”string
Expected commitment hash
Returns
Section titled “Returns”boolean
True if share is valid
Example
Section titled “Example”const isValid = ThresholdViewingKey.verifyShare( 'share1', 'commitment_hash')