* Compute a checksum from restrictions content for HTTP caching
( restrictions: PolicyLimitsResponse['restrictions'], )
| 150 | * Compute a checksum from restrictions content for HTTP caching |
| 151 | */ |
| 152 | function computeChecksum( |
| 153 | restrictions: PolicyLimitsResponse['restrictions'], |
| 154 | ): string { |
| 155 | const sorted = sortKeysDeep(restrictions) |
| 156 | const normalized = jsonStringify(sorted) |
| 157 | const hash = createHash('sha256').update(normalized).digest('hex') |
| 158 | return `sha256:${hash}` |
| 159 | } |
| 160 | |
| 161 | /** |
| 162 | * Check if the current user is eligible for policy limits. |
no test coverage detected