class Nib::Crypt::Key
Public Instance Methods
create!()
click to toggle source
# File lib/nib/crypt/key.rb, line 4 def create! `openssl rand -out #{name} -hex 512` end
local?()
click to toggle source
# File lib/nib/crypt/key.rb, line 8 def local? @local ||= File.exist?(name) end
pull()
click to toggle source
# File lib/nib/crypt/key.rb, line 20 def pull `aws s3 cp s3://#{bucket}/${PWD##*/}.#{name} #{name}` end
push()
click to toggle source
# File lib/nib/crypt/key.rb, line 16 def push `aws s3 cp #{name} s3://#{bucket}/${PWD##*/}.#{name}` end
remote?()
click to toggle source
# File lib/nib/crypt/key.rb, line 12 def remote? @remote ||= !`aws s3 ls s3://#{bucket}/${PWD##*/}.#{name}`.empty? end
Private Instance Methods
bucket()
click to toggle source
# File lib/nib/crypt/key.rb, line 30 def bucket ENV.fetch('NIB_CRYPT_BUCKET_NAME') { raise MissingBucketError } end
name()
click to toggle source
# File lib/nib/crypt/key.rb, line 26 def name DEFAULT_KEY_NAME end