class Passpit::Keeper
Public Class Methods
withdraw(name, secret)
click to toggle source
# File lib/passpit/keeper.rb, line 4 def withdraw(name, secret) token = pit[name] return 'Password not found.'.colorize(:red) unless token begin data = JWT.decode(token, secret, true, { algorithm: 'HS256' }) rescue JWT::VerificationError => error return 'Secret phrase is wrong.'.colorize(:red) end if Clipboard.copy(data[0]['password']) return 'The password has been copied to your clipboard.'.colorize(:green) else return 'Something went wrong.'.colorize(:red) end end
Private Class Methods
pit()
click to toggle source
# File lib/passpit/keeper.rb, line 24 def pit YAML.load_file(Passpit::Config.pit_path) end