ApiClientKey
in package
FinalYes
Shape of an application key for the external Api: a recognizable prefix plus 32 random bytes (64 hex characters).
The database holds only the sha256 digest of the whole key (cms_system_api_clients.key_hash)
and the beginning of the key to tell keys apart in the admin. The admin sees the readable key
once, in the response to creating or replacing the key.
Table of Contents
Constants
- DISPLAY_LENGTH : int = 16
- How many characters of the key (including the prefix) are stored and shown in the admin.
- PREFIX : string = 'coolcms_'
- RANDOM_BYTES : int = 32
Methods
- displayPrefix() : string
- generate() : array{key: string, hash: string, displayPrefix: string}
- hash() : string
Constants
DISPLAY_LENGTH
How many characters of the key (including the prefix) are stored and shown in the admin.
public
int
DISPLAY_LENGTH
= 16
PREFIX
public
string
PREFIX
= 'coolcms_'
RANDOM_BYTES
private
int
RANDOM_BYTES
= 32
Methods
displayPrefix()
public
static displayPrefix(string $key) : string
Parameters
- $key : string
Return values
stringgenerate()
public
static generate() : array{key: string, hash: string, displayPrefix: string}
Return values
array{key: string, hash: string, displayPrefix: string}hash()
public
static hash(string $key) : string
Parameters
- $key : string