Sha256: 58317cd79cf4c9113e3c824c3cbba8f57b23050315dfad4d06383fe7e1a30ef5
Contents?: true
Size: 577 Bytes
Versions: 2
Compression:
Stored size: 577 Bytes
Contents
module CiderCi module OpenSession module Signature class ValidationError < StandardError end extend self def create(secret, message) OpenSSL::HMAC.hexdigest( OpenSSL::Digest.new('sha1'), secret, message) end def valid?(signature, secret, message) signature == create(secret, message) end def validate!(signature, secret, message) unless valid?(signature, secret, message) fail ValidationError, 'Signature validation failed!' end end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
cider_ci-open_session-1.0.0 | lib/cider_ci/open_session/signature.rb |
cider_ci-open_session-rails-1.0.0 | lib/cider_ci/open_session/signature.rb |