Method: Ccrypto::Ruby::SecretSharingEngine#initialize

Defined in:
lib/ccrypto/ruby/engines/secret_sharing_engine.rb

#initialize(*args, &block) ⇒ SecretSharingEngine

Returns a new instance of SecretSharingEngine.

Raises:

  • (SecretSharingException)


8
9
10
11
12
13
# File 'lib/ccrypto/ruby/engines/secret_sharing_engine.rb', line 8

def initialize(*args, &block)
  @config = args.first 
  raise SecretSharingException, "SecretSharingConfig is required" if not @config.is_a?(Ccrypto::SecretSharingConfig)
  raise SecretSharingException, "split_into value must be more than 1" if not @config.split_into.to_i > 1
  raise SecretSharingException, "required_parts value (#{@config.required_parts}) must be less than or equal split_into value (#{@config.split_into})." if not @config.required_parts.to_i < @config.split_into.to_i
end