-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_vault_keyset_rpc_impl.h
65 lines (52 loc) · 2.64 KB
/
create_vault_keyset_rpc_impl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright 2023 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CRYPTOHOME_CREATE_VAULT_KEYSET_RPC_IMPL_H_
#define CRYPTOHOME_CREATE_VAULT_KEYSET_RPC_IMPL_H_
#include <memory>
#include <string>
#include "cryptohome/auth_blocks/auth_block_utility.h"
#include "cryptohome/auth_factor/types/manager.h"
#include "cryptohome/auth_session_manager.h"
#include "cryptohome/keyset_management.h"
#include "cryptohome/vault_keyset.h"
namespace cryptohome {
class CreateVaultKeysetRpcImpl {
public:
CreateVaultKeysetRpcImpl(KeysetManagement* keyset_management,
AuthBlockUtility* auth_block_utility,
AuthFactorDriverManager* auth_factor_driver_manager);
CreateVaultKeysetRpcImpl(const CreateVaultKeysetRpcImpl&) = delete;
CreateVaultKeysetRpcImpl& operator=(const CreateVaultKeysetRpcImpl&) = delete;
void CreateVaultKeyset(
const user_data_auth::CreateVaultKeysetRequest& request,
AuthSession& auth_session,
StatusCallback on_done);
private:
bool ClearKeyDataFromInitialKeyset(
const ObfuscatedUsername& obfuscated_username, bool disable_key_data);
void CreateAndPersistVaultKeyset(const KeyData& key_data,
const bool disable_key_data,
AuthSession& auth_session,
StatusCallback on_done,
CryptohomeStatus callback_error,
std::unique_ptr<KeyBlobs> key_blobs,
std::unique_ptr<AuthBlockState> auth_state);
CryptohomeStatus AddVaultKeyset(const std::string& key_label,
const KeyData& key_data,
const ObfuscatedUsername& obfuscated_username,
const FileSystemKeyset& file_system_keyset,
bool is_initial_keyset,
VaultKeysetIntent vk_backup_intent,
std::unique_ptr<KeyBlobs> key_blobs,
std::unique_ptr<AuthBlockState> auth_state);
KeysetManagement* const keyset_management_;
AuthBlockUtility* const auth_block_utility_;
AuthFactorDriverManager* const auth_factor_driver_manager_;
// Used to decrypt/ encrypt & store credentials.
std::unique_ptr<VaultKeyset> initial_vault_keyset_;
// Should be the last member.
base::WeakPtrFactory<CreateVaultKeysetRpcImpl> weak_factory_{this};
};
} // namespace cryptohome
#endif // CRYPTOHOME_CREATE_VAULT_KEYSET_RPC_IMPL_H_