diff --git a/README.md b/README.md index 80bdc12..fe359ba 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ round1_outputs = {} # Round 1: # For each participant, perform the first part of the DKG protocol. 1.upto(max_signer) do |i| - polynomial, package = FROST::DKG.part1(i, min_signer, max_signer, group) + polynomial, package = FROST::DKG.generate_secret(i, min_signer, max_signer, group) secrets[i] = polynomial round1_outputs[i] = package end @@ -93,7 +93,7 @@ end # Each participant sends their commitments and proof to other participants. received_package = {} 1.upto(max_signer) do |i| - received_package[i] = round1_outputs.select {|k, _| k != i}.values + received_package[i] = round1_outputs.select { |k, _| k != i }.values end # Each participant verify knowledge of proof in received package. @@ -118,7 +118,7 @@ end # Each participant verify received shares. 1.upto(max_signer) do |i| received_shares[i].each do |send_by, share| - target_package = received_package[i].find{ |package| package.identifier == send_by } + target_package = received_package[i].find { |package| package.identifier == send_by } expect(target_package.verify_share(share)).to be true end end @@ -126,7 +126,7 @@ end # Each participant compute signing share. signing_shares = {} 1.upto(max_signer) do |i| - shares = received_shares[i].map{|_, share| share} + shares = received_shares[i].map { |_, share| share } signing_shares[i] = FROST::DKG.compute_signing_share(secrets[i], shares) end diff --git a/lib/frost/dkg.rb b/lib/frost/dkg.rb index 041684e..dfaa5c8 100644 --- a/lib/frost/dkg.rb +++ b/lib/frost/dkg.rb @@ -11,7 +11,7 @@ module DKG # @param [Integer] identifier # @param [ECDSA::Group] group Group of elliptic curve. # @return [Array] The triple of polynomial and public package(FROST::DKG::Package) - def part1(identifier, min_signers, max_signers, group) + def generate_secret(identifier, min_signers, max_signers, group) raise ArgumentError, "identifier must be Integer" unless identifier.is_a?(Integer) raise ArgumentError, "identifier must be greater than 0." if identifier < 1 raise ArgumentError, "group must be ECDSA::Group." unless group.is_a?(ECDSA::Group) diff --git a/spec/frost/dkg_spec.rb b/spec/frost/dkg_spec.rb index 49f1b94..5f7ab33 100644 --- a/spec/frost/dkg_spec.rb +++ b/spec/frost/dkg_spec.rb @@ -113,7 +113,7 @@ # Round 1: # For each participant, perform the first part of the DKG protocol. 1.upto(max_signer) do |i| - polynomial, package = FROST::DKG.part1(i, min_signer, max_signer, group) + polynomial, package = FROST::DKG.generate_secret(i, min_signer, max_signer, group) secrets[i] = polynomial round1_outputs[i] = package end