module Vines::Kit

A module for utility methods with no better home.

Public Class Methods

auth_token() click to toggle source

Generates a random 128 character authentication token.

# File lib/vines/kit.rb, line 19
def self.auth_token
  SecureRandom.hex(64)
end
hmac(key, data) click to toggle source

Create a hex-encoded, SHA-512 HMAC of the data, using the secret key.

# File lib/vines/kit.rb, line 7
def self.hmac(key, data)
  digest = OpenSSL::Digest.new("sha512")
  OpenSSL::HMAC.hexdigest(digest, key, data)
end
uuid() click to toggle source

Generates a random uuid per rfc 4122 that's useful for including in stream, iq, and other xmpp stanzas.

# File lib/vines/kit.rb, line 14
def self.uuid
  SecureRandom.uuid
end