This is an old revision of the document!
Table of Contents
Tokenizer
Layer: Core · Source: lib/core/Tokenizer.php:33 (lines 33–138)
final class Tokenizer
implementing minimum requirements for secure user authentication in scriptlog with long-term persistence - login with “Remember Me” Cookies
Docblock Metadata
^ Tag ^ Value ^ | ''@category'' | Core Class | | ''@author'' | M.Noermoehammad | | ''@license'' | MIT | | ''@version'' | 1.0 | | ''@see'' | https://github.com/ircmaxell/RandomLib | | ''@see'' | https://stackoverflow.com/questions/1846202/php-how-to-generate-a-random-unique-alphanumeric-string | | ''@see'' | https://phppot.com/php/secure-remember-me-for-login-using-php-session-and-cookies/ | | ''@see'' | https://paragonie.com/blog/2015/05/using-encryption-and-authentication-correctly | | ''@see'' | https://gist.github.com/wopot/94e33bdd1d7faaaa56e2 | | ''@see'' | https://paragonie.com/blog/2015/04/secure-authentication-php-with-long-term-persistence | | ''@see'' | https://paragonie.com/blog/2015/11/choosing-right-cryptography-library-for-your-php-project-guide | | ''@see'' | https://www.zimuel.it/blog/cryptography-made-easy-with-zend-framework |
Inheritance
No parent, interface or trait. This is a root type.
Constants (0)
None.
Properties (0)
None declared.
Methods (6)
^ Visibility ^ Method ^ Summary ^ Line ^ | public static | ''getSelectorKey()'' | getSelectorKey | 48 | | public static | ''createToken()'' | Create token | 62 | | public static | ''setRandomPasswordProtected()'' | setRandomPasswordProtected | 78 | | public static | ''isPasswordValid()'' | getRandomPasswordProtected | 95 | | public static | ''setRandomSelectorProtected()'' | setRandomSelectorProtected | 109 | | public static | ''isSelectorValid()'' | isSelectorValid | 127 |
getSelectorKey()
public static function getSelectorKey(): string
lines 48–51 (4)
getSelectorKey
Derives a stable 32-byte key for selector encryption from the application key (SHA-256 output is always 32 bytes and deterministic).
Takes no parameters.
Returns: string — string 32 raw bytes
createToken()
public static function createToken($length)
lines 62–68 (7)
Create token
^ Parameter ^ Type ^ Default ^ Description ^ | ''$length'' | ''(untyped)'' | //required// | //none// |
Returns: (none declared) — string
setRandomPasswordProtected()
public static function setRandomPasswordProtected($password)
lines 78–84 (7)
setRandomPasswordProtected
^ Parameter ^ Type ^ Default ^ Description ^ | ''$password'' | ''(untyped)'' | //required// | //none// |
Returns: (none declared) — string
isPasswordValid()
public static function isPasswordValid($password, $hash)
lines 95–99 (5)
getRandomPasswordProtected
^ Parameter ^ Type ^ Default ^ Description ^ | ''$password'' | ''(untyped)'' | //required// | //none// | | ''$hash'' | ''(untyped)'' | //required// | //none// |
Returns: (none declared) — bool
setRandomSelectorProtected()
public static function setRandomSelectorProtected($selector, $key)
lines 109–116 (8)
setRandomSelectorProtected
^ Parameter ^ Type ^ Default ^ Description ^ | ''$selector'' | ''(untyped)'' | //required// | //none// | | ''$key'' | ''(untyped)'' | //required// | //none// |
Returns: (none declared) — string
isSelectorValid()
public static function isSelectorValid($cipher_data, $selector, $key)
lines 127–137 (11)
isSelectorValid
^ Parameter ^ Type ^ Default ^ Description ^ | ''$cipher_data'' | ''(untyped)'' | //required// | //none// | | ''$selector'' | ''(untyped)'' | //required// | //none// | | ''$key'' | ''(untyped)'' | //required// | //none// |
Returns: (none declared) — bool
This page is generated from source by 'tools/gendoc'. Edits will be overwritten.
