Class: FROST::Commitments
- Inherits:
-
Object
- Object
- FROST::Commitments
- Defined in:
- lib/frost/commitments.rb
Overview
Participant commitment
Instance Attribute Summary collapse
-
#binding ⇒ Object
readonly
Returns the value of attribute binding.
-
#hiding ⇒ Object
readonly
Returns the value of attribute hiding.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
Class Method Summary collapse
-
.encode_group_commitment(commitment_list) ⇒ String
Encodes a list of participant commitments into a byte string.
Instance Method Summary collapse
- #encode ⇒ Object
-
#initialize(identifier, hiding, binding) ⇒ Commitments
constructor
Constructor.
Constructor Details
#initialize(identifier, hiding, binding) ⇒ Commitments
Constructor
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/frost/commitments.rb', line 13 def initialize(identifier, hiding, binding) raise ArgumentError, "id must be Integer." unless identifier.is_a?(Integer) raise ArgumentError, "id must be greater than 0." if identifier < 1 raise ArgumentError, "hiding must be ECDSA::Point." unless hiding.is_a?(ECDSA::Point) raise ArgumentError, "binding must be ECDSA::Point." unless binding.is_a?(ECDSA::Point) @identifier = identifier @hiding = hiding @binding = binding end |
Instance Attribute Details
#binding ⇒ Object (readonly)
Returns the value of attribute binding.
7 8 9 |
# File 'lib/frost/commitments.rb', line 7 def binding @binding end |
#hiding ⇒ Object (readonly)
Returns the value of attribute hiding.
6 7 8 |
# File 'lib/frost/commitments.rb', line 6 def hiding @hiding end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
5 6 7 |
# File 'lib/frost/commitments.rb', line 5 def identifier @identifier end |
Class Method Details
.encode_group_commitment(commitment_list) ⇒ String
Encodes a list of participant commitments into a byte string
32 33 34 |
# File 'lib/frost/commitments.rb', line 32 def self.encode_group_commitment(commitment_list) commitment_list.map(&:encode).join end |
Instance Method Details
#encode ⇒ Object
24 25 26 27 |
# File 'lib/frost/commitments.rb', line 24 def encode id = FROST.encode_identifier(identifier, hiding.group) id + [hiding.to_hex + binding.to_hex].pack("H*") end |