isWrappedBasicAuthHeaderValue function
Returns true if the provided value is a Serverpod-wrapped auth key.
Implementation
bool isWrappedBasicAuthHeaderValue(String value) {
var parts = value.split(' ');
if (parts[0].toLowerCase() != basicAuthSchemeName.toLowerCase()) return false;
// if the value starts with the basic scheme, it must be valid and wrapped or we throw for invalid query
if (parts.length == 2 && _base64RegExp.hasMatch(parts[1])) {
return true;
} else {
throw AuthHeaderEncodingException(
'Invalid "basic" auth scheme value "$value"');
}
}