Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Side by Side Diff: components/os_crypt/key_storage_linux.h

Issue 1973483002: OSCrypt for POSIX uses libsecret to store a randomised encryption key. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactored CL Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_OS_CRYPT_KEY_STORAGE_LINUX_H_
6 #define COMPONENTS_OS_CRYPT_KEY_STORAGE_LINUX_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/macros.h"
12
vabr (Chromium) 2016/05/13 15:10:18 nit: Normally, code in components is in a namespac
cfroussios 2016/05/13 17:09:11 Acknowledged.
13 class KeyStorage {
14 public:
15 KeyStorage() = default;
16 virtual ~KeyStorage() = default;
17
18 // Gets the encryption key from the OS password-managing library. If a key is
19 // not found, a new key will be generated, stored and returned.
20 virtual std::string GetKey() = 0;
21
22 // Load the service. False is returned if the service is not available.
23 virtual bool Init() = 0;
24
25 // Tries to load available services. Returns the first that succeeds or
vabr (Chromium) 2016/05/13 15:10:18 nit: Please be careful with calling stuff a "servi
cfroussios 2016/05/13 17:09:11 Done.
26 // null if none succeed.
27 static std::unique_ptr<KeyStorage> FindService();
28
29 private:
30 DISALLOW_COPY_AND_ASSIGN(KeyStorage);
31 };
32
33 class KeyStorageLibsecret : public KeyStorage {
vabr (Chromium) 2016/05/13 15:10:18 Please separate the implementations of KeyStorage
cfroussios 2016/05/13 17:09:11 Specifically on the separation of mock from produc
34 public:
35 std::string GetKey() override;
vabr (Chromium) 2016/05/13 15:10:18 nit: We usually prefix the block with overrides wi
cfroussios 2016/05/13 17:09:12 Done.
36 bool Init() override;
37 };
38
39 class KeyStorageMock : public KeyStorage {
40 public:
41 explicit KeyStorageMock(std::string in_key = "");
vabr (Chromium) 2016/05/13 15:10:18 Also, whenever you need to initialize an empty str
vabr (Chromium) 2016/05/13 15:10:18 Please use 2 constructors instead of the default a
cfroussios 2016/05/13 17:09:11 Done.
cfroussios 2016/05/13 17:09:11 Done.
42
43 std::string GetKey() override;
vabr (Chromium) 2016/05/13 15:10:18 // KeyStorage (See above why.)
cfroussios 2016/05/13 17:09:11 Done.
44 bool Init() override;
45
46 void ResetTo(std::string);
vabr (Chromium) 2016/05/13 15:10:18 nit: Please name the argument.
cfroussios 2016/05/13 17:09:12 Done.
47
48 private:
49 std::string key;
vabr (Chromium) 2016/05/13 15:10:18 nit: Trailing underscore: key_
cfroussios 2016/05/13 17:09:11 Done.
50 };
51
52 #endif // COMPONENTS_OS_CRYPT_KEY_STORAGE_LINUX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698