Sha256: 997a9766c1727560f4c8982799bc0496bbfda0d44e43e09ef91e03ac2e180ac7
Contents?: true
Size: 502 Bytes
Versions: 3
Compression:
Stored size: 502 Bytes
Contents
module TFA class TotpCommand def initialize(storage) @storage = storage end def run(name) secret = secret_for(name) secret ? password_for(secret) : all_passwords end private def password_for(secret) ::ROTP::TOTP.new(secret).now end def all_passwords @storage.each do |hash| hash[hash.keys.first] = password_for(hash[hash.keys.first]) end end def secret_for(key) @storage.secret_for(key) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tfa-0.0.11 | lib/tfa/totp_command.rb |
tfa-0.0.10 | lib/tfa/totp_command.rb |
tfa-0.0.9 | lib/tfa/totp_command.rb |