Commit 1954d7b
Changed files (2)
lib
tfa
spec
lib
lib/tfa/cli.rb
@@ -20,7 +20,7 @@ module TFA
desc "show NAME", "shows the secret for the given key"
def show(name = nil)
- name ? storage.secret_for(name) : storage.all
+ name ? storage.secret_for(name) : storage.all.map { |x| x.keys }.flatten.sort
end
desc "totp NAME", "generate a Time based One Time Password using the secret associated with the given NAME."
spec/lib/cli_spec.rb
@@ -41,14 +41,14 @@ module TFA
end
context "when no key is given" do
- it "returns the secret for all keys" do
+ it "returns the name of each item" do
key = SecureRandom.uuid
subject.add(key, dev_secret)
subject.add("production", prod_secret)
result = subject.show.to_s
- expect(result).to include(dev_secret)
- expect(result).to include(prod_secret)
+ expect(result).to include(key)
+ expect(result).to include("production")
end
end
end