Class: FROST::DKG::SecretPackage
- Inherits:
-
Object
- Object
- FROST::DKG::SecretPackage
- Defined in:
- lib/frost/dkg/secret_package.rb
Overview
Package to hold participants’ secret share.
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#max_signers ⇒ Object
readonly
Returns the value of attribute max_signers.
-
#min_signers ⇒ Object
readonly
Returns the value of attribute min_signers.
-
#polynomial ⇒ Object
readonly
Returns the value of attribute polynomial.
-
#public_package ⇒ Object
readonly
Returns the value of attribute public_package.
Instance Method Summary collapse
-
#gen_share(identifier) ⇒ FROST::SecretShare
Generate secret share for identifier.
-
#group ⇒ ECDSA::Group
Get group.
-
#initialize(identifier, min_signers, max_signers, polynomial) ⇒ SecretPackage
constructor
Constructor.
-
#verification_point ⇒ ECDSA::Point
Get verification point.
Constructor Details
#initialize(identifier, min_signers, max_signers, polynomial) ⇒ SecretPackage
Constructor.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/frost/dkg/secret_package.rb', line 17 def initialize(identifier, min_signers, max_signers, polynomial) raise ArgumentError, "identifier must be Integer." unless identifier.is_a?(Integer) raise ArgumentError, "identifier must be greater than 0." if identifier < 1 raise ArgumentError, "min_signers must be Integer." unless min_signers.is_a?(Integer) raise ArgumentError, "max_signers must be Integer." unless max_signers.is_a?(Integer) raise ArgumentError, "polynomial must be FROST::Polynomial." unless polynomial.is_a?(FROST::Polynomial) raise ArgumentError, "max_signers must be greater than or equal to min_signers." if max_signers < min_signers raise ArgumentError, "Number of coefficients of polynomial and min_signers do not match." unless min_signers == polynomial.coefficients.length @identifier = identifier @min_signers = min_signers @max_signers = max_signers @polynomial = polynomial @public_package = Package.new(identifier, polynomial.gen_commitments, polynomial.gen_proof_of_knowledge(identifier)) end |
Instance Attribute Details
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
6 7 8 |
# File 'lib/frost/dkg/secret_package.rb', line 6 def identifier @identifier end |
#max_signers ⇒ Object (readonly)
Returns the value of attribute max_signers.
10 11 12 |
# File 'lib/frost/dkg/secret_package.rb', line 10 def max_signers @max_signers end |
#min_signers ⇒ Object (readonly)
Returns the value of attribute min_signers.
9 10 11 |
# File 'lib/frost/dkg/secret_package.rb', line 9 def min_signers @min_signers end |
#polynomial ⇒ Object (readonly)
Returns the value of attribute polynomial.
7 8 9 |
# File 'lib/frost/dkg/secret_package.rb', line 7 def polynomial @polynomial end |
#public_package ⇒ Object (readonly)
Returns the value of attribute public_package.
8 9 10 |
# File 'lib/frost/dkg/secret_package.rb', line 8 def public_package @public_package end |
Instance Method Details
#gen_share(identifier) ⇒ FROST::SecretShare
Generate secret share for identifier.
36 37 38 |
# File 'lib/frost/dkg/secret_package.rb', line 36 def gen_share(identifier) polynomial.gen_share(identifier) end |
#group ⇒ ECDSA::Group
Get group.
42 43 44 |
# File 'lib/frost/dkg/secret_package.rb', line 42 def group polynomial.group end |
#verification_point ⇒ ECDSA::Point
Get verification point.
48 49 50 |
# File 'lib/frost/dkg/secret_package.rb', line 48 def verification_point polynomial.verification_point end |