Sha256: f0a71b4ef005f6ab7827a471f3ebb4ee672c0e074629098f1c4005b0b165cad4

Contents?: true

Size: 397 Bytes

Versions: 1

Compression:

Stored size: 397 Bytes

Contents

require "openssl"
require "base64"

module XapoUtils

    module_function
            
    def encrypt(payload, secret)
        cipher = OpenSSL::Cipher::AES.new("256-ECB")
        cipher.encrypt
        cipher.key = secret        

        encrypted = cipher.update(payload) + cipher.final

        return Base64.encode64(encrypted)
    end

    def timestamp; (Time.now.to_f * 1000).to_i end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xapo_sdk-0.0.1.pre.1 lib/xapo_utils.rb