CoolCMS API

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

Methods

displayPrefix()

public static displayPrefix(string $key) : string
Parameters
$key : string
Return values
string

generate()

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
Return values
string
On this page

Search results