Class: FROST::SecretShare

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

Overview

A secret share generated by performing a (t-out-of-n) secret sharing scheme.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier, share, group) ⇒ SecretShare

Generate secret share.

Parameters:

  • identifier (Integer)

    Identifier of this share.

  • share (Integer)

    A share.

Raises:

  • (ArgumentError)


11
12
13
14
15
16
17
18
19
# File 'lib/frost/secret_share.rb', line 11

def initialize(identifier, share, group)
  raise ArgumentError, "identifier must be Integer." unless identifier.is_a?(Integer)
  raise ArgumentError, "share must be Integer." unless share.is_a?(Integer)
  raise ArgumentError, "group must be ECDSA::Group" unless group.is_a?(ECDSA::Group)

  @identifier = identifier
  @share = share
  @group = group
end

Instance Attribute Details

#groupObject (readonly)

Returns the value of attribute group.



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

def group
  @group
end

#identifierObject (readonly)

Returns the value of attribute identifier.



4
5
6
# File 'lib/frost/secret_share.rb', line 4

def identifier
  @identifier
end

#shareObject (readonly)

Returns the value of attribute share.



5
6
7
# File 'lib/frost/secret_share.rb', line 5

def share
  @share
end

Instance Method Details

#to_keyFROST::SigningKey

Generate signing share key.

Returns:



29
30
31
# File 'lib/frost/secret_share.rb', line 29

def to_key
  FROST::SigningKey.new(share, group)
end

#to_pointECDSA::Point

Compute public key.

Returns:

  • (ECDSA::Point)


23
24
25
# File 'lib/frost/secret_share.rb', line 23

def to_point
  group.generator * share
end