// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module network.mojom;
import "url/mojom/origin.mojom";
union TrustTokenAccessDetails {
TrustTokenIssuanceDetails issuance;
TrustTokenRedemptionDetails redemption;
TrustTokenSigningDetails signing;
};
struct TrustTokenIssuanceDetails {
// This is the origin that is triggering a Trust Token access. If the access
// is triggered from a resource request, `origin` is the origin of the
// top-level frame of the initial request; if they're being triggered by a
// script, it's the origin of the window or service worker.
url.mojom.Origin origin;
// This is the origin of the issuer being used by this Trust Token operation
// if applicable.
url.mojom.Origin? issuer;
// Whether the Trust Token operation was blocked.
bool blocked = false;
};
struct TrustTokenRedemptionDetails {
// This is the origin that is triggering a Trust Token access. If the access
// is triggered from a resource request, `origin` is the origin of the
// top-level frame of the initial request; if they're being triggered by a
// script, it's the origin of the window or service worker.
url.mojom.Origin origin;
// This is the origin of the issuer being used by this Trust Token operation
// if applicable.
url.mojom.Origin? issuer;
// Whether the Trust Token operation was blocked.
bool blocked = false;
};
struct TrustTokenSigningDetails {
// This is the origin that is triggering a Trust Token access. If the access
// is triggered from a resource request, `origin` is the origin of the
// request; if they're being triggered by a script, it's the origin of the
// window or service worker.
url.mojom.Origin origin;
// Whether the Trust Token operation was blocked.
bool blocked = false;
};
// Cloneable interface to observe trust token operations being performed in
// the NetworkService from other services (primarily the browser process).
// Users of TrustTokenAccessObserver should create a dedicated observer for
// each network request context (URLLoaderFactory) they are interested in
// observing.
interface TrustTokenAccessObserver {
// Called when an attempt has been made to access trust tokens by the
// NetworkService with the details about the trust token access.
OnTrustTokensAccessed(TrustTokenAccessDetails details);
// Called to create a copy of this observer. (e.g. when cloning observers
// from ResourceRequest).
Clone(pending_receiver<TrustTokenAccessObserver> listener);
};