Module: Totpc::Passphrase

Included in:
Secrets
Defined in:
lib/totpc/passphrase.rb

Overview

methods to ask passphrase

Instance Method Summary collapse

Instance Method Details

#ask_noecho(prompt) ⇒ Object



4
5
6
7
8
9
# File 'lib/totpc/passphrase.rb', line 4

def ask_noecho(prompt)
  STDOUT.print prompt
  input = STDIN.noecho(&:gets).chomp
  puts
  input
end

#confirm_passphrase(pass) ⇒ Object



15
16
17
18
# File 'lib/totpc/passphrase.rb', line 15

def confirm_passphrase(pass)
  return pass if pass == ask_noecho('Passphrase(confirm): ')
  nil
end

#passphraseObject



11
12
13
# File 'lib/totpc/passphrase.rb', line 11

def passphrase
  ask_noecho('Passphrase: ')
end