Sha256: 0eeda126d09495b36901548804541650da122645a2a5c28c229d8bbff0bd3044
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
require 'aws-sdk' module CredStash class << self def get(name) secret = Secret.find(name) if secret.falsified? raise "Invalid secret. #{name} has falsified" end secret.decrypted_value rescue CredStash::ItemNotFound nil end def put(name, value) secret = Secret.new(name: name, value: value) secret.encrypt! secret.save end def list Repository.new.list.inject({}) {|h, item| h[item.name] = item.version; h } end def delete(name) # TODO needs delete target version option repository = Repository.new item = repository.select(name).first repository.delete(item) end private def get_highest_version(name) item = Repository.new.select(name, pluck: 'version', limit: 1).first if item item.version.to_i else 0 end end end end require 'cred_stash/config' require 'cred_stash/cipher_key' require 'cred_stash/cipher' require 'cred_stash/error' require 'cred_stash/repository' require 'cred_stash/secret'
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rcredstash-0.4.0 | lib/cred_stash.rb |