Define strict TLS trust plugin API
This commit is contained in:
1 parent
f1fcef9b85
commit
1eeb8bac05
17 files changed
+834
-194
No files matched your search
+13
-7
@@ -40,18 +40,18 @@ const scenarios = {
|
||||
label: "Conflicting community advice",
|
||||
facts: conflictingCommunityAdvice,
|
||||
plugins: [
|
||||
createCommunityAdvicePlugin({
|
||||
configure(createCommunityAdvicePlugin({
|
||||
id: "community.archivists",
|
||||
name: "Regional archivists",
|
||||
trusted: true,
|
||||
message: "The archivists recognize this exact certificate and recommend trust.",
|
||||
}),
|
||||
createCommunityAdvicePlugin({
|
||||
}), "advisor"),
|
||||
configure(createCommunityAdvicePlugin({
|
||||
id: "community.network-watch",
|
||||
name: "Independent network watch",
|
||||
trusted: false,
|
||||
message: "The network observers report an unexpected certificate change.",
|
||||
}),
|
||||
}), "advisor"),
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -105,14 +105,16 @@ elements.clear.addEventListener("click", () => {
|
||||
|
||||
async function render() {
|
||||
const facts = scenarios[state.scenario].facts;
|
||||
const plugins = [createFirefoxValidationPlugin()];
|
||||
const plugins = [configure(createFirefoxValidationPlugin(), "advisor")];
|
||||
if (state.communityEnabled) {
|
||||
plugins.push(
|
||||
...(scenarios[state.scenario].plugins ?? [createVillageCommunityPlugin()]),
|
||||
...(scenarios[state.scenario].plugins ?? [
|
||||
configure(createVillageCommunityPlugin(), "advisor"),
|
||||
]),
|
||||
);
|
||||
}
|
||||
const userPlugin = createUserDecisionPlugin(state.userDecision);
|
||||
if (userPlugin) plugins.push(userPlugin);
|
||||
if (userPlugin) plugins.push(configure(userPlugin, "decision-authority"));
|
||||
|
||||
const result = await new TrustRunner({ plugins }).evaluate(facts);
|
||||
renderStatus(result);
|
||||
@@ -197,4 +199,8 @@ function formatCode(value = "") {
|
||||
return value.replaceAll("-", " ");
|
||||
}
|
||||
|
||||
function configure(plugin, mode) {
|
||||
return { plugin, mode };
|
||||
}
|
||||
|
||||
render();
|
||||
Reference in new issue
Block a user