fix: bind performance evidence to production resources
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
import { verifySignedReferenceRun } from './reference-evidence.mjs';
|
||||
|
||||
const median = (values) => {
|
||||
if (values.length === 0) throw new Error('At least one value is required.');
|
||||
const sorted = [...values].sort((left, right) => left - right);
|
||||
return sorted[Math.floor(sorted.length / 2)];
|
||||
};
|
||||
|
||||
export const aggregateFiveDriveTraces = (runs) => {
|
||||
export const aggregateFiveDriveTraces = (runs, trustPolicy) => {
|
||||
if (!Array.isArray(runs) || runs.length !== 5) throw new Error('Exactly five drive-trace.v1 runs are required.');
|
||||
for (const run of runs) verifySignedReferenceRun(run, trustPolicy);
|
||||
const profile = runs[0]?.profile;
|
||||
if (typeof profile !== 'string' || runs.some((run) => run?.schema !== 'drive-trace.v1' || run.profile !== profile)) {
|
||||
throw new Error('All runs must use one drive-trace.v1 profile.');
|
||||
|
||||
Reference in New Issue
Block a user