small strict improvements (#1428)

* small `strict` improvements

* fix type

* use isObject
This commit is contained in:
Alex Christoffer Rasmussen
2025-01-06 14:07:36 +01:00
committed by GitHub
parent 743d7fa782
commit cd913fc144
5 changed files with 32 additions and 20 deletions
@@ -74,10 +74,11 @@ export function revoke(): ReturnType<typeof hasAuth> {
*/
export function handleClientSecret(clientSecret: string): ClientSecret {
const clientSecretObject = JSON.parse(clientSecret);
const isValid = validateClientSecret(clientSecretObject);
if (!isValid) {
throw new Error('Client secret invalid');
try {
validateClientSecret(clientSecretObject);
} catch (error) {
throw new Error(`Client secret is invalid: ${error}`);
}
return clientSecretObject;