Class BSV::Primitives::KeyShares ¶
Inherits: Object
A set of Shamir's Secret Sharing shares derived from a private key.
Holds the evaluation points (shares), a reconstruction threshold, and an integrity string for verifying that recombined shares produce the correct key. Supports serialisation to and from a human-readable backup format.
Backup format per share: "Base58(x).Base58(y).threshold.integrity"
This format is compatible with the Go and TypeScript reference SDKs.
@example Round-trip through backup format
shares = key.to_key_shares(2, 5)
backup = shares.to_backup_format
rebuilt = KeyShares.from_backup_format(backup[0..1])
key = PrivateKey.from_key_shares(rebuilt)
Attributes¶
integrity [R] ¶
- @return [String] first 8 hex characters of the Hash160 of the compressed public key
points [R] ¶
- @return [Array
] the share points
threshold [R] ¶
- @return [Integer] the minimum number of shares required to reconstruct the key
Public Class Methods¶
from_backup_format(shares) ¶
Deserialise shares from backup format strings.
Each string must have the form "Base58(x).Base58(y).threshold.integrity". All shares must agree on threshold and integrity. - @param shares [Array
Public Instance Methods¶
initialize(points, threshold, integrity) ¶
- @param
points[Array] share points - @param
threshold[Integer] reconstruction threshold - @param
integrity[String] integrity check string - @return [KeyShares] a new instance of KeyShares
to_backup_format() ¶
Serialise shares to backup format strings. - @return [Array