Sha256: 84b43b9f5dec53d15a89ee82e503ca12594f5a37208c4124f2227fd9ce97565a

Contents?: true

Size: 324 Bytes

Versions: 3

Compression:

Stored size: 324 Bytes

Contents

module TFA
  class TotpCommand
    def initialize(storage)
      @storage = storage
    end

    def run(arguments)
      name = arguments.first
      ::ROTP::TOTP.new(secret_for(name)).now
    end

    private

    def secret_for(name)
      @storage.transaction(true) do
        @storage[name]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tfa-0.0.3 lib/tfa/totp_command.rb
tfa-0.0.2 lib/tfa/totp_command.rb
tfa-0.0.1 lib/tfa/totp_command.rb