chromium/third_party/blink/public/common/storage_key/proto/storage_key.proto

// Copyright 2021 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";

package storage_key_proto;

message StorageKey {
  // TODO(crbug.com/1274598): There isn't a fuzzer right now that defines
  // reliably non-opaque fuzzers.
  message Origin {
    enum Scheme {
      HTTP = 0;
      HTTPS = 1;
    }

    required Scheme scheme = 1;
    // Randomly pick from a list for now
    required int32 host = 2;
    required int32 port = 3;
  }

  message TopLevelSite {
    // The top-level site can either be an origin or a schemeful site, both of
    // which take URLs as inputs
    enum UrlType {
      ORIGIN = 0;
      SCHEMEFUL_SITE = 1;
    }

    required Origin origin = 1;
    required UrlType url_type = 2;
  }

  // blink::UnguessableToken doesn't actually have a fuzz-able constructor, so
  // this will simply signify that one should be created.
  enum UnguessableToken { CREATE = 0; }

  message AncestorChainBit {
    // The AncestorChainBit can either be same-site or cross-site.
    enum BitType {
      SAME_SITE = 0;
      CROSS_SITE = 1;
    }

    optional BitType bit = 1 [default = SAME_SITE];
  }

  required Origin origin = 1;

  oneof OneOf {
    TopLevelSite top_level_site = 2;
    UnguessableToken unguessable_token = 3;
  }

  // The AncestorChainBit was added after the StorageKey proto was in use, so
  // for backwards compatibility, it must be optional.
  optional AncestorChainBit ancestor_chain_bit = 4;
}