PHP Class Elgg\Database\SiteSecret

Since: 1.10.0
Show file Open project: elgg/elgg Class Usage Examples

Public Methods

Method Description
__construct ( ConfigTable $configTable ) Constructor
get ( boolean $raw = false ) : string Returns the site secret.
getStrength ( ) : string Get the strength of the site secret
init ( ) : mixed Initialise the site secret (32 bytes: "z" to indicate format + 186-bit key in Base64 URL).
setTestingSecret ( string $secret ) : void Set a secret to be used in testing

Method Details

__construct() public method

Constructor
public __construct ( ConfigTable $configTable )
$configTable ConfigTable Config table

get() public method

Used to generate difficult to guess hashes for sessions and action tokens.
public get ( boolean $raw = false ) : string
$raw boolean If true, a binary key will be returned
return string Site secret.

getStrength() public method

If "weak" or "moderate" is returned, this assumes we're running on the same system that created the key.
public getStrength ( ) : string
return string "strong", "moderate", or "weak"

init() public method

Used during installation and saves as a config. Note: Old secrets were hex encoded.
public init ( ) : mixed
return mixed The site secret hash or false

setTestingSecret() public method

Set a secret to be used in testing
public setTestingSecret ( string $secret ) : void
$secret string Testing site secret. 32 alphanums starting with "z"
return void