module Helpema::SSSS

Attributes

version[RW]

Public Instance Methods

combine(secrets:, threshold:, hexmode:false) click to toggle source
# File lib/helpema/ssss.rb, line 39
def combine(secrets:, threshold:, hexmode:false)
  raise 'Need threshold number of secrets.' unless secrets.size >= threshold
  SSSS._combine(secrets:secrets, threshold:threshold, hexmode:hexmode)
end
split( secret:, threshold:, shares:, token:nil, level:nil, hexmode:false ) click to toggle source
# File lib/helpema/ssss.rb, line 17
  def split(
    secret:, threshold:,
    shares:, token:nil,
    level:nil,
    hexmode:false
  ) = SSSS._split(
    secret:secret,
    threshold:threshold,
    shares:shares,
    token:token,
    level:level,
    hexmode:hexmode)
  SSSS.define_command(:_combine,
    cmd: 'ssss-combine', v: SSSS.version,
    usage: {Q:true,t:2,x:false}, synonyms: {threshold: :t, hexmode: :x},
    mode: 'w+', exception: 'ssss-combine failed.',
    err: [:child, :out]
  ) do |pipe, options, blk|
    secrets,n = options.fetch_values(:secrets,:threshold)
    secrets.first(n).each{pipe.puts _1}
    pipe.read.lines.last.chomp
  end
  def combine(secrets:, threshold:, hexmode:false)
    raise 'Need threshold number of secrets.' unless secrets.size >= threshold
    SSSS._combine(secrets:secrets, threshold:threshold, hexmode:hexmode)
  end

  extend self
end