Skip to content

Commit

Permalink
update method comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rohenaz committed Sep 3, 2024
1 parent d8c2f1d commit 08b7536
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
15 changes: 7 additions & 8 deletions primitives/ec/privatekey.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,11 @@ func (p *PrivateKey) ToPolynomial(threshold int) (*keyshares.Polynomial, error)
*
* @param threshold The minimum number of shares required to reconstruct the private key.
* @param totalShares The total number of shares to generate.
* @param prime The prime number to be used in Shamir's Secret Sharing Scheme.
* @returns An array of shares.
* @returns A KeyShares object containing the shares, threshold and integrity.
*
* @example
* const key = NewPrivateKey()
* const shares = key.toKeyShares(2, 5)
* key, _ := NewPrivateKey()
* shares, _ := key.ToKeyShares(2, 5)
*/
func (p *PrivateKey) ToKeyShares(threshold int, totalShares int) (keyShares *keyshares.KeyShares, error error) {
if threshold < 2 {
Expand Down Expand Up @@ -298,13 +297,13 @@ func PrivateKeyFromKeyShares(keyShares *keyshares.KeyShares) (*PrivateKey, error
}

/**
* @method toBackupShares
* @method ToBackupShares
*
* Creates a backup of the private key by splitting it into shares.
*
*
* @param threshold The number of shares which will be required to reconstruct the private key.
* @param totalShares The number of shares to generate for distribution.
* @param shares The total number of shares to generate for distribution.
* @returns
*/
func (p *PrivateKey) ToBackupShares(threshold int, shares int) ([]string, error) {
Expand All @@ -317,11 +316,11 @@ func (p *PrivateKey) ToBackupShares(threshold int, shares int) ([]string, error)

/**
*
* @method fromBackupShares
* @method PrivateKeyFromBackupShares
*
* Creates a private key from backup shares.
*
* @param shares
* @param shares in backup format
* @returns PrivateKey
*/
func PrivateKeyFromBackupShares(shares []string) (*PrivateKey, error) {
Expand Down
9 changes: 3 additions & 6 deletions primitives/keyshares/keyshares.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,11 @@ func NewKeySharesFromBackupFormat(shares []string) (keyShares *KeyShares, error
}

/**
* @method toBackupShares
* @method ToBackupFormat
*
* Creates a backup of the private key by splitting it into shares.
* Creates a backup of the keyshares
*
*
* @param threshold The number of shares which will be required to reconstruct the private key.
* @param totalShares The number of shares to generate for distribution.
* @returns
* @returns shares in backup format
*/
func (k *KeyShares) ToBackupFormat() ([]string, error) {
backupShares := make([]string, 0)
Expand Down

0 comments on commit 08b7536

Please sign in to comment.