diff --git a/lib/frost/signing_key.rb b/lib/frost/signing_key.rb index d3b4693..82b8c9b 100644 --- a/lib/frost/signing_key.rb +++ b/lib/frost/signing_key.rb @@ -18,7 +18,7 @@ def initialize(scalar, group = ECDSA::Group::Secp256k1) # Generate signing key. # @param [ECDSA::Group] group Group of elliptic curve. - def self.generate(group = ECDSA::Group::Secp256k1) + def self.generate(group) scalar = 1 + SecureRandom.random_number(group.order - 1) SigningKey.new(scalar, group) end diff --git a/spec/signing_key_spec.rb b/spec/signing_key_spec.rb index a3b10bc..89bdbe0 100644 --- a/spec/signing_key_spec.rb +++ b/spec/signing_key_spec.rb @@ -5,7 +5,7 @@ describe "#new" do context 'valid key range' do it do - expect{described_class.generate}.not_to raise_error + expect{described_class.generate(ECDSA::Group::Secp256k1)}.not_to raise_error end end context 'invalid key range' do