Class: ReCaptcha::SecureTokenBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/re_captcha/secure_token_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(private_key) ⇒ SecureTokenBuilder

Returns a new instance of SecureTokenBuilder.



8
9
10
# File 'lib/re_captcha/secure_token_builder.rb', line 8

def initialize(private_key)
  @private_key = private_key
end

Instance Method Details

#buildObject



12
13
14
15
16
17
# File 'lib/re_captcha/secure_token_builder.rb', line 12

def build
  json_token = generate_json_token
  private_key_digest = digest_key @private_key
  cipher = prepare_cipher private_key_digest
  encode_token json_token, cipher
end