# Class BSV::Primitives::KeyShares <a id="class-BSV-Primitives-KeyShares"></a>

**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**
```ruby
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] <a id="attribute-i-integrity"></a> <a id="integrity-instance_method"></a>
- **@return** [String] first 8 hex characters of the Hash160 of the compressed public key

### `points` [R] <a id="attribute-i-points"></a> <a id="points-instance_method"></a>
- **@return** [Array<PointInFiniteField>] the share points

### `threshold` [R] <a id="attribute-i-threshold"></a> <a id="threshold-instance_method"></a>
- **@return** [Integer] the minimum number of shares required to reconstruct the key

## Public Class Methods
### `from_backup_format(shares)` <a id="method-c-from_backup_format"></a> <a id="from_backup_format-class_method"></a>
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<String>] backup-format share strings
- **@raise** [ArgumentError] if any share is malformed or shares are inconsistent
- **@return** [KeyShares]

## Public Instance Methods
### `initialize(points, threshold, integrity)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
- **@param** `points` [Array<PointInFiniteField>] share points
- **@param** `threshold` [Integer] reconstruction threshold
- **@param** `integrity` [String] integrity check string
- **@return** [KeyShares] a new instance of KeyShares

### `to_backup_format()` <a id="method-i-to_backup_format"></a> <a id="to_backup_format-instance_method"></a>
Serialise shares to backup format strings.
- **@return** [Array<String>] one backup string per share point
