Sha256: 75639e28728b56806a243cc24e785e26298c311a31d56c423df7aae457686716

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

require 'time'
require_relative 'evervault/version'
require_relative 'evervault/client'
require_relative 'evervault/config'
require_relative 'evervault/errors/errors'
require_relative 'evervault/utils/validation_utils'

module Evervault
  class << self
    attr_accessor :app_id, :api_key

    def encrypt(...)
      client.encrypt(...)
    end

    def decrypt(...)
      client.decrypt(...)
    end

    def run(...)
      client.run(...)
    end

    def enable_outbound_relay(...)
      client.enable_outbound_relay(...)
    end

    def create_run_token(...)
      client.create_run_token(...)
    end

    def create_client_side_decrypt_token(data, expiry = nil)
      expiry = (expiry.to_f * 1000).to_i unless expiry.nil?
      client.create_token('api:decrypt', data, expiry)
    end

    def configure(...)
      client.configure(...)
    end

    private

    def client
      @client ||= begin
        Evervault::Utils::ValidationUtils.validate_app_uuid_and_api_key(app_id, api_key)
        Evervault::Client.new(app_uuid: app_id, api_key: api_key)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
evervault-3.0.1 lib/evervault.rb