blob: 76ffccb427cd5b38ca479985c8f3172491d79cc9 [file] [log] [blame]
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_DISK_CACHE_CACHE_ENCRYPTION_DELEGATE_H_
#define NET_DISK_CACHE_CACHE_ENCRYPTION_DELEGATE_H_
#include <cstdint>
#include <vector>
#include "base/containers/span.h"
#include "base/functional/callback.h"
#include "net/base/net_export.h"
namespace net {
class NET_EXPORT CacheEncryptionDelegate {
public:
CacheEncryptionDelegate() = default;
virtual ~CacheEncryptionDelegate() = default;
// Async init. Don't call any other methods before |callback| is called with
// success. If already initialized, should run the callback immediately.
virtual void Init(base::OnceClosure callback) = 0;
virtual bool EncryptData(base::span<const uint8_t> plaintext,
std::vector<uint8_t>* ciphertext) = 0;
virtual bool DecryptData(base::span<const uint8_t> ciphertext,
std::vector<uint8_t>* plaintext) = 0;
};
} // namespace net
#endif // NET_DISK_CACHE_CACHE_ENCRYPTION_DELEGATE_H_