Sha256: d26526bf6be626622855b884744a03165f3dc3afb08819fa633b10c9392e0952
Contents?: true
Size: 592 Bytes
Versions: 3
Compression:
Stored size: 592 Bytes
Contents
module TFA class Storage def initialize(filename) @storage = PStore.new(File.join(Dir.home, ".#{filename}.pstore")) end def all_secrets open_readonly do |storage| storage.roots.map { |key| { key => storage[key] } } end end def secret_for(key) open_readonly do |storage| storage[key] end end def save(key, value) @storage.transaction do @storage[key] = value end end private def open_readonly @storage.transaction(true) do yield @storage end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tfa-0.0.6 | lib/tfa/storage.rb |
tfa-0.0.5 | lib/tfa/storage.rb |
tfa-0.0.4 | lib/tfa/storage.rb |