This commit is contained in:
Hailey
2025-08-31 13:28:49 -07:00
parent 0d8e633084
commit f3949569c8
-27
View File
@@ -1,27 +0,0 @@
/**
* Validates a proxy header is valid if supplied
*/
export const isValidProxyHeaderOrThrow = (val: string) => {
if (!val) {
return
}
if (!val.startsWith('did:')) {
throw new Error(
'Configured proxy header is invalid. Does not start with `did:`',
)
}
const pts = val.split('#')
if (pts.length !== 2) {
throw new Error(
'Configured proxy header is invalid. Does not contain a single `#`',
)
}
if (pts[1].length < 1) {
throw new Error(
'Configured proxy header is invalid. Does not contain a valid service after the `#`',
)
}
}