Class: FROST::DKG::SecretPackage

Inherits:
Object
  • Object
show all
Defined in:
lib/frost/dkg/secret_package.rb

Overview

Package to hold participants’ secret share.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier, min_signers, max_signers, polynomial) ⇒ SecretPackage

Constructor.

Raises:

  • (ArgumentError)


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 = PublicPackage.new(identifier, polynomial.gen_commitments, polynomial.gen_proof_of_knowledge(identifier))
end

Instance Attribute Details

#identifierObject (readonly)

Returns the value of attribute identifier.



6
7
8
# File 'lib/frost/dkg/secret_package.rb', line 6

def identifier
  @identifier
end

#max_signersObject (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_signersObject (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

#polynomialObject (readonly)

Returns the value of attribute polynomial.



7
8
9
# File 'lib/frost/dkg/secret_package.rb', line 7

def polynomial
  @polynomial
end

#public_packageObject (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

#contextFROST::Context

Get FROST context.



48
49
50
# File 'lib/frost/dkg/secret_package.rb', line 48

def context
  polynomial.context
end

#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

#groupECDSA::Group

Get group.



42
43
44
# File 'lib/frost/dkg/secret_package.rb', line 42

def group
  polynomial.group
end

#verification_pointECDSA::Point

Get verification point.



54
55
56
# File 'lib/frost/dkg/secret_package.rb', line 54

def verification_point
  polynomial.verification_point
end