Add Support For Key Module

Created on 2 April 2025, 2 months ago

Problem/Motivation

Leverage the Key module to store the site key and site secret.

Steps to reproduce

Proposed resolution

Enhance the form and module to check for either the existing turnstile_site_key and turnstile_secret_key or a new site_key_id and secret_key_id setup in the Key module.

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

1.1

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @jimparo
  • 🇺🇸United States greatmatter

    Please try out the dev version and let me know if it's working the way you intended.

  • In the form, I added an option to select Key Module and then expose two fields, one for the site key and one for the secret key. I also added a service to grab the available keys from the key module and populate the dropdowns. I added two helper functions in the module and used suggest for the key module rather than adding it as a dependency. The only issue was that the original form fields for site key and secret key were required so I had to enter some placeholder values to save the form. I tried to create a patch with my changes and have added it to the comment here.

  • 🇮🇹Italy drein

    Hello,
    I'm the new one here, just a user who wanted to use this module.
    Frankly, I really didn't appreciate that Turnstyle now depends on the Keys module.
    I mean, it used to be great: there were just two fields—one for the key, one for the secret key—and that was it.
    Now, instead, it has been decided to rely on an external module, which is installed by only 34 people and isn't covered by Drupal's security policy. I have absolutely nothing against the Keys module—of course not!
    But I think this functionality should be made optional, and users should be allowed to use the module as it has always been: simple and quick.
    Honestly, I haven’t been able to configure Turnstyle now—probably due to my own technical limitations—I keep getting an error when I enter the keys, but I hope I’ve made my point clear.
    Please, let people have the choice...

    ---

    Would you like help polishing this message further before posting it somewhere?

  • 🇺🇸United States greatmatter

    @drein - I'm sorry you're having issues with the change. I think there may be some confusion; the Turnstile module does not rely on the "Keys" module, but instead the "Key" module, which, as of this comment is installed by 50,922 sites.

    I'd love to help you get your Turnstile module up and running, though.

    1. Visit /admin/config/system/keys
    2. Click "+ Add Key" (or visit /admin/config/system/keys/add )
    3. Enter the following:
      • Key Name: Turnstile
      • Type Settings > Key Type: Authentication (Multivalue)
      • Provider settings > Key Provider: Configuration
      • Value:
        {
            "site_key": "0xXXXXXXXXXXXXXXXXXXXXXX",
            "secret_key": "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
        }

        Please replace the 0x... with your own values

    4. Click "Save"
    5. Visit /admin/config/people/captcha/turnstile
    6. Under "Keys" select Turnstile
    7. Click "Save configuration"

    Please let me know if you still experience any issues.

Production build 0.71.5 2024