Class: Confium::TC::Session
- Inherits:
-
Object
- Object
- Confium::TC::Session
- Defined in:
- lib/confium/tc/session.rb
Instance Attribute Summary collapse
-
#num_parties ⇒ Object
readonly
Returns the value of attribute num_parties.
-
#party_index ⇒ Object
readonly
Returns the value of attribute party_index.
-
#scheme ⇒ Object
readonly
Returns the value of attribute scheme.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#threshold ⇒ Object
readonly
Returns the value of attribute threshold.
Instance Method Summary collapse
- #complete? ⇒ Boolean
-
#initialize(scheme:, threshold:, num_parties:, party_index:) ⇒ Session
constructor
A new instance of Session.
- #result ⇒ Object
- #set_local_share(share_bytes) ⇒ Object
Constructor Details
#initialize(scheme:, threshold:, num_parties:, party_index:) ⇒ Session
Returns a new instance of Session.
24 25 26 27 28 29 30 31 32 |
# File 'lib/confium/tc/session.rb', line 24 def initialize(scheme:, threshold:, num_parties:, party_index:) @scheme = scheme @threshold = threshold @num_parties = num_parties @party_index = party_index @state = :pending @local_share = nil @result = nil end |
Instance Attribute Details
#num_parties ⇒ Object (readonly)
Returns the value of attribute num_parties.
22 23 24 |
# File 'lib/confium/tc/session.rb', line 22 def num_parties @num_parties end |
#party_index ⇒ Object (readonly)
Returns the value of attribute party_index.
22 23 24 |
# File 'lib/confium/tc/session.rb', line 22 def party_index @party_index end |
#scheme ⇒ Object (readonly)
Returns the value of attribute scheme.
22 23 24 |
# File 'lib/confium/tc/session.rb', line 22 def scheme @scheme end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
22 23 24 |
# File 'lib/confium/tc/session.rb', line 22 def state @state end |
#threshold ⇒ Object (readonly)
Returns the value of attribute threshold.
22 23 24 |
# File 'lib/confium/tc/session.rb', line 22 def threshold @threshold end |
Instance Method Details
#complete? ⇒ Boolean
39 40 41 |
# File 'lib/confium/tc/session.rb', line 39 def complete? @state == :completed end |
#result ⇒ Object
43 44 45 46 |
# File 'lib/confium/tc/session.rb', line 43 def result raise "Session not complete" unless complete? @result end |
#set_local_share(share_bytes) ⇒ Object
34 35 36 37 |
# File 'lib/confium/tc/session.rb', line 34 def set_local_share(share_bytes) raise ArgumentError, "share must be a String" unless share_bytes.is_a?(String) @local_share = share_bytes end |