d0976c9d524ee428053266757aa17c7ef1b66a12 chmalee Wed Feb 18 12:20:45 2026 -0800 Libify the api key set/revoke methods, refs #36517 diff --git src/hg/inc/hubSpaceKeys.h src/hg/inc/hubSpaceKeys.h index 75d3ce75840..ff2a37d46c4 100644 --- src/hg/inc/hubSpaceKeys.h +++ src/hg/inc/hubSpaceKeys.h @@ -50,20 +50,32 @@ /* Free a list of dynamically allocated hubSpaceKeys's */ void hubSpaceKeysOutput(struct hubSpaceKeys *el, FILE *f, char sep, char lastSep); /* Print out hubSpaceKeys. Separate fields with sep. Follow last field with lastSep. */ #define hubSpaceKeysTabOut(el,f) hubSpaceKeysOutput(el,f,'\t','\n'); /* Print out hubSpaceKeys as a line in a tab-separated file. */ #define hubSpaceKeysCommaOut(el,f) hubSpaceKeysOutput(el,f,',',','); /* Print out hubSpaceKeys as a comma separated list including final comma. */ /* -------------------------------- End autoSql Generated Code -------------------------------- */ #define AUTH_TABLE_DEFAULT "apiKeys" -char *userNameForApiKey(struct sqlConnection *conn, char *apiKey); +char *hubSpaceGetApiKey(char *userName); +/* Grab the already created api key if it exists */ + +char *hubSpaceUserNameForApiKey(struct sqlConnection *conn, char *apiKey); /* Return userName associated with apiKey else NULL. If conn is NULL, will create a connection and free it. */ +void hubSpaceRevokeApiKey(char *userName); +/* Remove any api keys for userName. errAborts if userName is NULL. + * Run in an errCatch to handle errors. */ + +char *hubSpaceGenerateApiKey(char *userName); +/* Make a random (but not crypto-secure) api key for userName, for use of hubtools to upload + * to hubspace or for bypassing cloudflare. errAborts if userName is NULL. + * Run in an errCatch to handle errors. */ + #endif /* HUBSPACEKEYS_H */