Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.
This module offers a generic approach to store password-like secrets into the
database. Just like a password, a secret does not get stored in plain text but
rather a salted hash thereof. Therefore the clear text of a secret cannot be
retrieved from the database. But given a clear text string it is possible to
verify if it matches the hash stored in the database.
API
The secret module does not expose any user interface but only two methods and
one hook which can be used by third party modules.
secrets_put_secret($password, $expire = 0x7FFFFFFF)
Given a password in plain text, create a new record in the database which is valid until the given expiry date (unix timestamp). Returns the sid (secret id) on success.
secret_check_secret($sid, $password)
Verify if the given plain text password matches the secret with the given sid. Returns true or false.
hook_secrets_delete_multiple(array $sids)
Invoked whenever one or more secrets are going to be deleted (after hitting their expiry date).
Brings the power of the legacy Google Translate's Website Translator into Drupal, providing an instant translated version of your site's text. Provides the translate switch as a block.