Commit eed85ab5 authored by Erik Chen's avatar Erik Chen Committed by Commit Bot

Rename ChallengeAttestationOnlyKeystoreResult to KeystoreStringResult.

This CL is a refactor with no intended behavior change. This is in
preparation for adding future methods to KeystoreService that return the
same type.

Bug: 1127505
Change-Id: Ia96d37301533cde335a38771d067c6054c164535
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2485347Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarMaksim Ivanov <emaxx@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Auto-Submit: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819478}
parent 19640abf
......@@ -31,8 +31,8 @@ void KeystoreServiceAsh::ChallengeAttestationOnlyKeystore(
ChallengeAttestationOnlyKeystoreCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!crosapi::mojom::IsKnownEnumValue(type)) {
mojom::ChallengeAttestationOnlyKeystoreResultPtr result_ptr =
mojom::ChallengeAttestationOnlyKeystoreResult::New();
crosapi::mojom::KeystoreStringResultPtr result_ptr =
mojom::KeystoreStringResult::New();
result_ptr->set_error_message("unsupported keystore type");
std::move(callback).Run(std::move(result_ptr));
return;
......@@ -110,8 +110,8 @@ void KeystoreServiceAsh::DidChallengeAttestationOnlyKeystore(
void* challenge_key_ptr,
const chromeos::attestation::TpmChallengeKeyResult& result) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
mojom::ChallengeAttestationOnlyKeystoreResultPtr result_ptr =
mojom::ChallengeAttestationOnlyKeystoreResult::New();
crosapi::mojom::KeystoreStringResultPtr result_ptr =
mojom::KeystoreStringResult::New();
if (result.IsSuccess()) {
result_ptr->set_challenge_response(result.challenge_response);
} else {
......
......@@ -106,7 +106,7 @@ EnterprisePlatformKeysChallengeMachineKeyFunction::Run() {
void EnterprisePlatformKeysChallengeMachineKeyFunction::
OnChallengeAttestationOnlyKeystore(ResultPtr result) {
using Result = crosapi::mojom::ChallengeAttestationOnlyKeystoreResult;
using Result = crosapi::mojom::KeystoreStringResult;
switch (result->which()) {
case Result::Tag::ERROR_MESSAGE:
Respond(Error(result->get_error_message()));
......@@ -148,7 +148,7 @@ EnterprisePlatformKeysChallengeUserKeyFunction::Run() {
void EnterprisePlatformKeysChallengeUserKeyFunction::
OnChallengeAttestationOnlyKeystore(ResultPtr result) {
using Result = crosapi::mojom::ChallengeAttestationOnlyKeystoreResult;
using Result = crosapi::mojom::KeystoreStringResult;
switch (result->which()) {
case Result::Tag::ERROR_MESSAGE:
Respond(Error(result->get_error_message()));
......
......@@ -68,7 +68,7 @@ class EnterprisePlatformKeysChallengeMachineKeyFunction
~EnterprisePlatformKeysChallengeMachineKeyFunction() override = default;
ResponseAction Run() override;
using ResultPtr = crosapi::mojom::ChallengeAttestationOnlyKeystoreResultPtr;
using ResultPtr = crosapi::mojom::KeystoreStringResultPtr;
void OnChallengeAttestationOnlyKeystore(ResultPtr result);
DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.challengeMachineKey",
ENTERPRISE_PLATFORMKEYS_CHALLENGEMACHINEKEY)
......@@ -80,7 +80,7 @@ class EnterprisePlatformKeysChallengeUserKeyFunction
~EnterprisePlatformKeysChallengeUserKeyFunction() override = default;
ResponseAction Run() override;
using ResultPtr = crosapi::mojom::ChallengeAttestationOnlyKeystoreResultPtr;
using ResultPtr = crosapi::mojom::KeystoreStringResultPtr;
void OnChallengeAttestationOnlyKeystore(ResultPtr result);
DECLARE_EXTENSION_FUNCTION("enterprise.platformKeys.challengeUserKey",
ENTERPRISE_PLATFORMKEYS_CHALLENGEUSERKEY)
......
......@@ -33,7 +33,7 @@ class KeystoreServiceLacrosBrowserTest : public InProcessBrowserTest {
// Tests that providing an incorrectly formatted user keystore challenge returns
// failure.
IN_PROC_BROWSER_TEST_F(KeystoreServiceLacrosBrowserTest, WrongFormattingUser) {
crosapi::mojom::ChallengeAttestationOnlyKeystoreResultPtr result;
crosapi::mojom::KeystoreStringResultPtr result;
std::string challenge = "asdf";
crosapi::mojom::KeystoreServiceAsyncWaiter async_waiter(
keystore_service_remote().get());
......
......@@ -24,9 +24,9 @@ enum KeystoreType {
kDevice = 1,
};
// Returned by ChallengeAttestationOnlyKeystore().
[Stable]
union ChallengeAttestationOnlyKeystoreResult {
// Returned by methods that either return a string, or an error.
[Stable, RenamedFrom="crosapi.mojom.ChallengeAttestationOnlyKeystoreResult"]
union KeystoreStringResult {
// Implies failure.
string error_message;
......@@ -60,7 +60,7 @@ interface KeystoreService {
// certificate with the migrated key.
ChallengeAttestationOnlyKeystore@0(
string challenge, KeystoreType type, bool migrate) =>
(ChallengeAttestationOnlyKeystoreResult result);
(KeystoreStringResult result);
// Returns the key stores available to the client. These are used as inputs to
// the other methods on this interface.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment