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(context, identifier, share) ⇒ SecretShare

Generate secret share.

Parameters:

  • context (FROST::Context)
  • identifier (Integer)

    Identifier of this share.

  • share (Integer)

    A share.

Raises:

  • (ArgumentError)


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

def initialize(context, identifier, share)
  raise ArgumentError, "identifier must be Integer." unless identifier.is_a?(Integer)
  raise ArgumentError, "share must be Integer." unless share.is_a?(Integer)
  raise ArgumentError "context must be FROST::Context." unless context.is_a?(FROST::Context)

  @identifier = identifier
  @share = share
  @context = context
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



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

def context
  @context
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

#groupECDSA::Group

Get group

Returns:

  • (ECDSA::Group)


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

def group
  context.group
end

#to_keyFROST::SigningKey

Generate signing share key.

Returns:



36
37
38
# File 'lib/frost/secret_share.rb', line 36

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

#to_pointECDSA::Point

Compute public key.

Returns:

  • (ECDSA::Point)


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

def to_point
  group.generator * share
end