cert_provisioning.mojom 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // Copyright 2022 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. module crosapi.mojom;
  5. import "mojo/public/mojom/base/time.mojom";
  6. // Maps to the C++ enum CertProvisioningWorkerState from
  7. // cert_provisioning_common.h .
  8. [Stable, Extensible]
  9. enum CertProvisioningProcessState {
  10. [Default] kInitState = 0,
  11. kKeypairGenerated = 1,
  12. kStartCsrResponseReceived = 2,
  13. kVaChallengeFinished = 3,
  14. kKeyRegistered = 4,
  15. kKeypairMarked = 5,
  16. kSignCsrFinished = 6,
  17. kFinishCsrResponseReceived = 7,
  18. kSucceeded = 8,
  19. // The states below should never be sent, but it's good for diagnostic
  20. // purposes to be able to recognize them if it still happens.
  21. kInconsistentDataError = 9,
  22. kFailed = 10,
  23. kCanceled = 11,
  24. };
  25. [Stable]
  26. struct CertProvisioningBackendServerError {
  27. // The time of the error.
  28. mojo_base.mojom.Time time;
  29. // The code of the error. For the meaning of the codes see the
  30. // DeviceManagementStatus enum in cloud_policy_constants.h. The codes are
  31. // guaranteed to be stable.
  32. int32 status_code = 0;
  33. };
  34. [Stable]
  35. struct CertProvisioningProcessStatus {
  36. // ID of the certificate provisioning process from the policy.
  37. string cert_profile_id@0;
  38. // Human-readable certificate profile name (UTF-8).
  39. string cert_profile_name@1;
  40. // The DER-encoded X.509 SubjectPublicKeyInfo (SPKI).
  41. array<uint8> public_key@2;
  42. // The last time when the process changed its state. Time of failure for
  43. // failed processes.
  44. mojo_base.mojom.Time last_update_time@3;
  45. // In case the device had problems connecting to the DMServer, this field will
  46. // contain the time of the last attempt and the reason of failure.
  47. CertProvisioningBackendServerError? last_backend_server_error@4;
  48. // Contains the current state for currently active processes or the last
  49. // non-failure state for failed ones.
  50. CertProvisioningProcessState state@5 =
  51. CertProvisioningProcessState.kInitState;
  52. // Contains "false" if the process is still running, contains "true" if the
  53. // process failed. Successfully finished processes are not returned.
  54. bool did_fail@6 = false;
  55. // Contains “true” if the process was initiated by
  56. // RequiredClientCertificateForDevice policy, contains “false” if by
  57. // RequiredClientCertificateForUser.
  58. bool is_device_wide@7 = false;
  59. // Describes the reason for failure in case a worker enters the failed state.
  60. [MinVersion=1]
  61. string? failure_message@8;
  62. };
  63. // This interface is implemented by classes that want to register themself as
  64. // certificate provisioning observers and receive notifications when
  65. // CertProvisioningProcessStatus of at least one process significantly changes.
  66. [Stable, Uuid="33dcc3c5-f9f6-4d28-be35-119b8f499d88"]
  67. interface CertProvisioningObserver {
  68. // Ash calls this to notify the observer about a new change.
  69. OnStateChanged@0();
  70. };
  71. // This interface provides methods to get information about the status of the
  72. // certificate provisioning feature and control it.
  73. // It is implemented by Ash-Chrome.
  74. [Stable, Uuid="ff60efaf-bb5c-4aff-903f-72abcb613df6"]
  75. interface CertProvisioning {
  76. // Adds an observer that will be notified about updates from the certificate
  77. // provisioning feature.
  78. AddObserver@0(
  79. pending_remote<CertProvisioningObserver> observer);
  80. // Returns the information about all currently active and recently failed cert
  81. // provisioning processes.
  82. GetStatus@1() =>
  83. (array<CertProvisioningProcessStatus> result);
  84. // Instructs Ash to immediately attempt the next planned step in provisioning
  85. // of the certificate with `cert_profile_id`. Specifically, if the process is
  86. // waiting for a notification from the server-side, this will make Ash reach
  87. // out to the server-side and check for the current status. Otherwise it might
  88. // do nothing.
  89. UpdateOneProcess@2(string cert_profile_id);
  90. };