class Uhide::Main

Public Class Methods

‼️(❗;) click to toggle source
# File lib/uhide/main.rb, line 7
def ‼️ ; .colorize :magenta; end
✈️() click to toggle source
# File lib/uhide/main.rb, line 124
def ✈️
  begin
     @@🔑
    
    💾
    
    loop do
      print @@☔
      🤖 🧼 gets
    end
    
  rescue SystemExit, Interrupt
    🚽
    exit!
  end
  
end
(🔑, 😐: true) click to toggle source
# File lib/uhide/main.rb, line 19
def  🔑, 😐: true
  print 🔑
  ✍️ = 🧼 STDIN.noecho(&:gets)
  @@✍️ = ✍️ if 😐
  🚽
  return ✍️
end
💾() click to toggle source
# File lib/uhide/main.rb, line 41
def 💾
  ⚛️ = ActiveSupport::MessageEncryptor.new(
    ActiveSupport::KeyGenerator.new(@@✍️).generate_key 🧂, ActiveSupport::MessageEncryptor.key_len
  )
  
  🥾 = !(not @@🗄️['〽️'])
  📖 = 🗃️ '〽️', {}, ⚛️: ⚛️
  📀 '〽️', 📖, ⚛️: ⚛️ if 🥾
end
📀(🗂️, 📖, ⚛️: false) click to toggle source
# File lib/uhide/main.rb, line 51
def 📀 🗂️, 📖, ⚛️: false
  if ⚛️
    📕 = ⚛️.encrypt_and_sign 📖
  else
    📕 = 📖
  end
  
  📕 = Marshal.dump 📕
  File.write "./#{🗂️}", 📕
  return 📕
end
🔒(🏷️, 💎) click to toggle source
# File lib/uhide/main.rb, line 36
def 🔒 🏷️, 💎
  @@🗄️['〽️'][🏷️] = 💎
  💾
end
🔓(🏷️: nil) click to toggle source
# File lib/uhide/main.rb, line 27
def 🔓 🏷️: nil
  if 🏷️.nil?
    puts @@🗄️['〽️']
  else
    puts @@🗄️['〽️'][🏷️]
  end
  
end
🗃️(🗂️, 💎, ⚛️: false) click to toggle source
# File lib/uhide/main.rb, line 63
def 🗃️ 🗂️, 💎, ⚛️: false
  if @@🗄️[🗂️]
    return @@🗄️[🗂️]
  end
  
  begin
    📕 = File.read "./#{🗂️}"
  rescue Errno::ENOENT
    📕 = 📀 🗂️, 💎, ⚛️: ⚛️
  end
  
  if not 📕.empty?
    📕 = Marshal.load 📕
    
    if ⚛️
      begin
        📖 = ⚛️.decrypt_and_verify 📕
      rescue ActiveSupport::MessageVerifier::InvalidSignature
        puts ‼️ 🔑
        exit!
      end
      
    else
      📖 = 📕
    end
    
  end
  
  return @@🗄️[🗂️] = 📖
end
🚽() click to toggle source
# File lib/uhide/main.rb, line 10
def 🚽
  print "\r"
  $stdout.flush
end
🤖(🗣️) click to toggle source
# File lib/uhide/main.rb, line 94
def 🤖 🗣️
  👾, 🏷️, 💎 = 🗣️.split
  
  if 👾.nil?
    return
  end
  
  case 👾.to_sym
  when :get
    if 🏷️
      🔓 🏷️: 🏷️
    else
      🔓
    end
    
  when :set
    🔒 🏷️, 💎
    
  when :exit, :quit
    exit!
    
  when :help
    puts "For help, quit and run `uhide -h` from your shell"
    
  else
    puts ‼️('unsupported') + ' 👾'
  end
  
end
🧂() click to toggle source
# File lib/uhide/main.rb, line 8
def 🧂; 🗃️ '🧂', SecureRandom.random_bytes; end
🧼(🗑️) click to toggle source
# File lib/uhide/main.rb, line 15
def 🧼 🗑️
  🗑️.chomp
end