chromium/components/os_crypt/async/common/encryptor.mojom

// 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.

module os_crypt_async.mojom;

import "components/os_crypt/async/common/algorithm.mojom";
import "mojo/public/mojom/base/shared_memory.mojom";

// Corresponds to `os_crypt_async::Encryptor::Key` in
// components/os_crypt/async/common/encryptor.h. See documentation in that class
// for more details.
struct Key {
  // The algorithm of this key.
  Algorithm algorithm;
  // The key data. Passed as a shared memory region to avoid the key entering
  // any mojo buffers.
  mojo_base.mojom.UnsafeSharedMemoryRegion key;
};

// Corresponds to `os_crypt_async::Encryptor` in
// components/os_crypt/async/common/encryptor.h. See documentation in that class
// for more details.
struct Encryptor {
  // The provider key to use for encryption from the `key_entries` map below.
  string provider_for_encryption;
  // A map of provider names to Key entries to use for encrypt and decrypt
  // operations.
  map<string, Key> key_entries;
};