LookupAPIKey (open)
Obtain an API key
Syntax
LOADLIB "mod::system/lib/keystore.whlib";
RECORD FUNCTION LookupAPIKey(STRING type, STRING requestdomain, RECORD options)Parameters
STRING typeKey type you're looking up. Must be "google" or "google-recaptcha" at this moment
STRING requestdomainDomain or URL for which you're requesting a key
RECORD optionsOptions
allowmissingIf true, returns a default record if not found. Otherwise, the function will throw
scopeTarget use for the key. client for an apikey you can send to the user (eg javascript),
server for an apikey to use when directly communicating to the api. 'any' if you don't care
Return value
RECORDThe api keys, or throws if no match is found (unless allowmissing is set)
apikeyThe API key
privatekeyThe private key, if set