Class: ActiverecordCursorPagination::SqlSigner
- Inherits:
-
Object
- Object
- ActiverecordCursorPagination::SqlSigner
- Defined in:
- lib/activerecord_cursor_pagination/sql_signer.rb
Instance Method Summary collapse
-
#sign(sql) ⇒ String
Sign SQL.
Instance Method Details
#sign(sql) ⇒ String
Sign SQL
10 11 12 13 14 15 16 17 18 |
# File 'lib/activerecord_cursor_pagination/sql_signer.rb', line 10 def sign(sql) return nil if sql.nil? sql = format sql digest = OpenSSL::Digest.new 'sha1' hmac = OpenSSL::HMAC.digest digest, secret_key, sql hash = Base64.encode64 hmac hash.gsub /\n+/, "" end |