chromium/chrome/browser/web_applications/proto/web_app_isolation_data.proto

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package web_app.proto;

// Contains information specific to Isolated Web Apps.
message IsolationData {
  // Information needed to load data from a browser-owned Web Bundle.
  message OwnedBundle {
    optional string dir_name_ascii = 1;
    optional bool dev_mode = 2;
  }
  // Information needed to load data from a Web Bundle that is not owned by the
  // browser.
  message UnownedBundle {
    // The file path is (de)serialized using Pickle to and from `base::FilePath`
    // via its (de)serialization methods `base::FilePath::WriteToPickle` and
    // `base::FilePath::ReadFromPickle`. Depending on the OS, file paths may
    // either use `std::string` or `std::wstring` internally, and are not
    // guaranteed to be safely convertible to UTF-8. The Pickle format includes
    // a header representing the original data type of the file path, which
    // means that it is impossible to ever accidentally deserialize a
    // `std::wstring` into a `std::string` and vice versa. The (de)serialization
    // code is also easier to read than manually written code that converts
    // bytes to and from `std::wstring` / `std::string`.
    optional bytes path = 1;
  }
  // Information needed to load data for an app using a proxy.
  message Proxy {
    optional string proxy_url = 1;
  }

  // The location of the app - required.
  oneof location {
    OwnedBundle owned_bundle = 1;
    UnownedBundle unowned_bundle = 2;
    Proxy proxy = 3;
  }

  // The partition_name of every <controlledframe> StoragePartition managed by
  // this Isolated Web App.
  repeated string controlled_frame_partitions = 4;

  // The version of the IWA - required.
  optional string version = 5;

  // Provides information about the integrity block of this IWA's signed web
  // bundle.
  message IntegrityBlockData {
    message SignatureInfoEd25519 {
      // base64-encoded key bytes.
      optional string public_key = 1;

      // Hex-encoded signature bytes.
      optional string signature = 2;
    }
    message SignatureInfoEcdsaP256SHA256 {
      // base64-encoded key bytes.
      optional string public_key = 1;

      // Hex-encoded signature bytes.
      optional string signature = 2;
    }
    message SignatureInfoUnknown {}

    message SignatureInfo {
      oneof signature_info {
        // Add all new types to `web_app::test::CreateSignatures()` for test
        // coverage.
        SignatureInfoEd25519 ed25519 = 1;
        SignatureInfoEcdsaP256SHA256 ecdsa_p256_sha256 = 2;
        SignatureInfoUnknown unknown = 3;
      }
    }

    repeated SignatureInfo signatures = 1;
  }

  message PendingUpdateInfo {
    // The location of the pending update - required.
    oneof location {
      OwnedBundle owned_bundle = 1;
      UnownedBundle unowned_bundle = 2;
      Proxy proxy = 3;
    }
    // The version of the pending update - required.
    optional string version = 4;

    optional IntegrityBlockData integrity_block_data = 5;
  }

  optional PendingUpdateInfo pending_update_info = 6;

  optional IntegrityBlockData integrity_block_data = 7;
}